[pacman-dev] [PATCH] makepkg: canonicalize paths from environmental variables

Xavier chantry.xavier at gmail.com
Mon Oct 4 02:55:56 EDT 2010

Allan McRae wrote:
> This prevents circular symlinks and weird final package locations
> when using commands like  'PKGDEST="." makepkg'.
> Fixes FS#20922.

Interesting, I just realized something :
I made a dir symlink : bar -> foo/

[xavier at xps-m1530 ~]$ cd foo/
[xavier at xps-m1530 foo]$ echo $PWD ; readlink -f .
[xavier at xps-m1530 foo]$ cd ../bar/
[xavier at xps-m1530 bar]$ echo $PWD ; readlink -f .

So $PWD gives exactly what I was looking for back then for repo-add, absolute
pathname without symlink resolution. I wonder if there is some weird cases where
it wouldn't do what we want. But at least it seems to work for me.

And just in case we ever use readlink/realpath/etc, it would be bad to forget to
run it on the two paths ;)

More information about the pacman-dev mailing list