git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH] t7800 readlink not found

From
Junio C Hamano <gitster@pobox.com>
Date
May 31, 2016, 05:51 UTC
Message-ID
<xmqqzir67p1y.fsf@gitster.mtv.corp.google.com>
In-Reply-To
<574D1BEA.5020409@web.de>
Torsten Bögershausen <tboegi@web.de> writes:
Show 14 quoted lines
>> diff --git a/t/t7800-difftool.sh b/t/t7800-difftool.sh
>> index 7ce4cd7..905035c 100755
>> --- a/t/t7800-difftool.sh
>> +++ b/t/t7800-difftool.sh
>> @@ -446,7 +446,7 @@ write_script .git/CHECK_SYMLINKS <<\EOF
>>   for f in file file2 sub/sub
>>   do
>>   	echo "$f"
>> -	readlink "$2/$f"
>> +	ls -ld "$2/$f" | sed -e 's/.* -> //'
>>   done >actual
>>   EOF
>>
> I don't know how portable #ls -ld" really is.

The parts with mode bits, nlinks, uid, gid, size, and date part do have some variations. For example, we have been burned on ACL enabled systems having some funny suffix after the usual mode bits stuff.

However, as far as this test is concerned, I do not think "how portable is the output from ls -ld" is an especially relevant question. None of the things we expect early in the output (the fields I enumerated in the previous paragraph) would contain " -> ". And we know that we do not use a filename that has " -> " (or "->") as a substring in our tests.

We don't have to use readlink, even on platforms where we do have readlink. Building the conditional to be checked at runtime and providing a shell function read_link that uses "ls -ld | sed" or "readlink" depending on the runtime check is wasteful.

Previous: Torsten BögershausenNext: Armin Kunaschik
Message 11 of 14 in “t7800 test failure”
  1. Armin KunaschikMay 24, 2016
  2. Matthieu MoyMay 24, 2016
  3. Junio C HamanoMay 24, 2016
  4. Armin KunaschikMay 24, 2016
  5. Junio C HamanoMay 24, 2016
  6. Armin KunaschikMay 25, 2016
  7. David AguilarMay 27, 2016
  8. Matthieu MoyMay 27, 2016
  9. t7800 readlink not foundArmin Kunaschik, May 31, 2016
  10. Torsten BögershausenMay 31, 2016
  11. Junio C HamanoMay 31, 2016
  12. Armin KunaschikJun 21, 2016
  13. Junio C HamanoJun 21, 2016
  14. Torsten BögershausenJun 21, 2016

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.