From: Philippe Blain <levraiphilippeblain@gmail.com>
To: Junio C Hamano <gitster@pobox.com>
Cc: Git mailing list <git@vger.kernel.org>,
Derrick Stolee <dstolee@microsoft.com>
Subject: Re: t7900 failures when $HOME is symlinked
Date: Fri, 3 Dec 2021 17:40:37 -0500 [thread overview]
Message-ID: <837581db-b3d7-2a73-9a61-7c40f77f264b@gmail.com> (raw)
In-Reply-To: <xmqq1r2tty13.fsf@gitster.g>
Hi Junio,
Le 2021-12-03 à 12:10, Junio C Hamano a écrit :
> Philippe Blain <levraiphilippeblain@gmail.com> writes:
>
>> Hi Stolee,
>>
>> I noticed two failures, t7900.32 and t7900.36, on a system where
>> $HOME is symlinked, i.e.
>>
>> $ cd $HOME && pwd
>> /home/me
>> $ pwd -P
>> /some/other/path/me
>>
>> These two tests use 'pfx = $(cd $HOME && pwd)', so $pfx is '/home/me',
>> but the actual path that gets written by Git is canonicalized, i.e.
>> '/some/other/path/me'. I think a simple fix would be to use 'pwd -P'
>> instead, which fixes it for me.
>
> Curious. Your personal HOME shouldn't have much to do with the
> tests, but obviously it can indirectly affect the outcome because it
> affects where you place your repository.
Indeed, the source code was cloned somewhere in my HOME.
> HOME during tests is set in t/test-lib.sh, based on where
> TRASH_DIRECTORY is, and the latter is often derived from
> TEST_OUTPUT_DIRECTORY (unless --root is given), which comes from
> TEST_DIRECTORY and it is set like so:
>
> # Test the binaries we have just built. The tests are kept in
> # t/ subdirectory and are run in 'trash directory' subdirectory.
> if test -z "$TEST_DIRECTORY"
> then
> # We allow tests to override this, in case they want to run tests
> # outside of t/, e.g. for running tests on the test library
> # itself.
> TEST_DIRECTORY=$(pwd)
> else
> # ensure that TEST_DIRECTORY is an absolute path so that it
> # is valid even if the current working directory is changed
> TEST_DIRECTORY=$(cd "$TEST_DIRECTORY" && pwd) || exit 1
> fi
> if test -z "$TEST_OUTPUT_DIRECTORY"
> then
> # Similarly, override this to store the test-results subdir
> # elsewhere
> TEST_OUTPUT_DIRECTORY=$TEST_DIRECTORY
> fi
> GIT_BUILD_DIR="$TEST_DIRECTORY"/..
>
> If you want to do $(pwd -P) somewhere, isn't it that one you want to
> change to avoid similar problems in any code, including the ones
> that are not yet written, that uses $(pwd)?
Indeed, that works and it looks like a more robust fix.
Thanks,
Philippe.
prev parent reply other threads:[~2021-12-03 22:40 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-12-03 14:56 t7900 failures when $HOME is symlinked Philippe Blain
2021-12-03 17:10 ` Junio C Hamano
2021-12-03 17:42 ` Jeff King
2021-12-05 10:02 ` Junio C Hamano
2021-12-03 22:40 ` Philippe Blain [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: http://vger.kernel.org/majordomo-info.html
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=837581db-b3d7-2a73-9a61-7c40f77f264b@gmail.com \
--to=levraiphilippeblain@gmail.com \
--cc=dstolee@microsoft.com \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://80x24.org/mirrors/git.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).