tup icon indicating copy to clipboard operation
tup copied to clipboard

Slash conversion

Open FreddieChopin opened this issue 11 years ago • 1 comments

This issue is probably only Windows-specific, but I'm not sure.

Imagine there's this simple tupfile:

FLAGS_a/b/c/file.txt = good
FLAGS_a\b\c\file.txt = almost-good
FLAGS_a/b/c\file.txt = bad

: a/b/c/file.txt |> echo %f $(FLAGS_%f) > %o |> file.txt

There's also this file.txt in a/b/c path.

The problem is that tup converts slashes from forward (typical for Unix) to backslashes (typical for Windows) but only the last slash is converted, so if the file is given like above then wrong flag would be used ("bad" instead of "good"):

d:\1\slash>tup
[ tup ] [0.000s] Scanning filesystem...
[ tup ] [0.143s] Reading in new environment variables...
[ tup ] [0.144s] Parsing Tupfiles...
 1) [0.000s] .
 [ ] 100%
[ tup ] [0.146s] No files to delete.
[ tup ] [0.146s] Generating .gitignore files...
[ tup ] [0.259s] Executing Commands...
 1) [0.020s] echo a/b/c\file.txt bad > file.txt
 [ ] 100%
[ tup ] [0.409s] Updated.

I now that the obvious solution would be to convert them all, but this wouldn't still solve the main issue - a valid Tupfile would work differently on Windows and on Unix (I assume that this conversion is done only for Windows). Other options:

  • no slash conversion when not absolutely necessary, variables with slashes and input/outputs are used exactly as given,
  • disallow backslashes for inputs, outputs and variable names, convert everything to forward slashes,
  • variables matching ignores forward/backward slashes,
  • ...

In my opinion the first option is the most generic and preferable, but I may be wrong about that (;

FreddieChopin avatar Jun 22 '14 09:06 FreddieChopin

I'm having an issue related to this as well, one of the tools I'm invoking does not like the converted slashes and fails to run because of it. It would be nice if there was a flag or something to disable slash conversion.

trap15 avatar Nov 25 '15 01:11 trap15