Subject: Re: [PATCH] tests: factor HOME=$(pwd) in test-lib.sh

From: Matthieu Moy <[email-masked]>
Date: Mon, 30 Aug 2010 12:54:20 +0200

Ævar Arnfjörð Bjarmason <[email-masked]> writes:

> On Mon, Aug 30, 2010 at 09:50, Matthieu Moy <[email-masked]> wrote:
>> The same pattern is used in many tests, and makes it easy for new ones to
>> rely on $HOME being a trashable, clean, directory.
>
> Looks good, but why not:
>
>> +HOME=$(pwd)
>> +export HOME
>
> This instead:
>
> HOME=$TRASH_DIRECTORY
> export HOME
>
> Looks like it might be more correct given this (always an absolute
> path), but I haven't tested:

That should work too, but with your version, I have to think harder to
make sure $TRASH_DIRECTORY is absolute (that should be OK), and won't
make any issue with symlinks (I have no idea whether it is OK or not),
while it's trivially correct with mine (pwd is absolute, and the -P
option of the cd command right above prevents issue with symlinks).

-- 
Matthieu Moy
http://www-verimag.imag.fr/~moy/