[PATCH] Ensure that absolutized paths from hgrc do not contain ../ segments

Thomas Arendsen Hein thomas at intevation.de
Sat Jan 26 04:10:47 CST 2008


* Jesse Glick <jesse.glick at sun.com> [20080126 01:49]:
> Thomas Arendsen Hein wrote:
> >> +hg in dupe | sed "s!$base!<base>!g"
> >> +cd ..
> >> +hg -R a in dupe | sed "s!$base!<base>!g"
> > 
> > ... this sed looks scary.
> 
> Why? It's a simple replacement of one fixed string by another. (The '!' 
> just allows $base to contain some '/' separators.) Do you know of a 
> simpler way to transform
> 
> /tmp/hg.test.whatever.2347YY4/dupe
> 
> into
> 
> <base>/dupe
> 
> that would work with standard POSIX commands?

Which would break for running tests on Windows or if the dir would
contain ! or $ or [.

bos already pushed your patch and just fgreps for /../, which should
not occur.

Thomas

-- 
thomas at intevation.de - http://intevation.de/~thomas/ - OpenPGP key: 0x5816791A
Intevation GmbH, Osnabrueck - Register: Amtsgericht Osnabrueck, HR B 18998
Geschaeftsfuehrer: Frank Koormann, Bernhard Reiter, Dr. Jan-Oliver Wagner


More information about the Mercurial-devel mailing list