Path fun on Windows
Mads Kiilerich
mads at kiilerich.com
Wed Jun 6 09:10:54 CDT 2012
On 06/06/12 15:37, Adrian Buehlmann wrote:
> For the perspective of the script-level, it might even be better to have
> to deal with unix-like paths only, and let MSYS bash translate the path
> as late as possible.
I guess there is a bit of disagreement between different parts of msys
and bash and tests whether 'c:/foo' is a relative unix path or an
absolute windows path, but it doesn't matter much for our current need.
> I think it would be worth a try and seeing how it works with removing
> the pwd -W alias.
>
> Maybe we then need to find a way to map tempdir paths in the output
> lines like
>
> /tmp/hgtests.qfl8xz/test-a.t
>
> back to
>
> $TESTTMP
>
> Or perhaps we should simply avoid writing such paths to the output.
I guess it will fail in places where we write `pwd` to a config file.
The advantage of `pwd -W` is that it doesn't require further escaping in
sh and is understood by windows.
I don't know if msys has a mode where it use some kind of magic
'//?/c/foo' notation for absolute paths. That could be a bit cleaner ...
and probably cause other problems.
To summarize a bit: There are some inherent problems with posix shell
scripting and native windows paths. msys use some tricks to make it
work. run-tests add some other tricks to work around the real problem
and the msys workarounds, and the tests has to add a few workarounds on
top of that. This adds up to quite a bit of complexity that has to be
understood ... in addition to understanding both windows and posix. It
would be nice to reduce that complexity, but in general it works, and
fixing it doesn't have to be on top of the nice-to-have list. Do you agree?
/Mads
More information about the Mercurial-devel
mailing list