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

Re: [PATCH] test-lib: stricter unzip(1) check

From
Johannes Schindelin <johannes.schindelin@gmx.de>
Date
Jul 18, 2016, 13:52 UTC
Message-ID
<alpine.DEB.2.20.1607181536540.3472@virtualbox>
In-Reply-To
<20160718130405.GA19751@sigill.intra.peff.net>
Hi Peff & Eric,
On Mon, 18 Jul 2016, Jeff King wrote:
Show 11 quoted lines
> On Mon, Jul 18, 2016 at 06:44:31AM +0000, Eric Wong wrote:
> 
> > On FreeBSD 10.3 (but presumably any FreeBSD 8+), /usr/bin/unzip
> > exists, but is insufficient for t5003 due to its non-standard
> > handling of the -a option[1].  This version of unzip exits
> > with "1" when given the "-v" flag.
> > 
> > However, the common Info-ZIP version may be installed at
> > /usr/local/bin/unzip (via "pkg install unzip") to pass t5003.
> > This Info-ZIP version exits with "0" when given "-v",
> > so limit the prereq to only versions which return 0 on "-v".

Hrm. That sounds a little magical, and fragile, to me. What if the next person's unzip returns 0 and *still* cannot handle -a?

I'd rather do something like
-- snipsnap --
diff --git a/t/test-lib.sh b/t/test-lib.sh
index 0055ebb..5b9521e 100644
--- a/t/test-lib.sh
+++ b/t/test-lib.sh
@@ -929,7 +929,8 @@ yes () {
 }
 
 # Fix some commands on Windows
-case $(uname -s) in
+uname_s=$(uname -s)
+case $uname_s in
 *MINGW*)
 	# Windows has its own (incompatible) sort and find
 	sort () {
@@ -1100,6 +1101,7 @@ test_lazy_prereq SANITY '
 	return $status
 '
 
+test FreeBSD != $uname_s || GIT_UNZIP=${GIT_UNZIP:-/usr/local/bin/unzip}
 GIT_UNZIP=${GIT_UNZIP:-unzip}
 test_lazy_prereq UNZIP '
 	"$GIT_UNZIP" -v
Previous: Jeff KingNext: Junio C Hamano
Message 3 of 14 in “test-lib: stricter unzip(1) check”
  1. test-lib: stricter unzip(1) checkEric Wong, Jul 18, 2016
  2. Jeff KingJul 18, 2016
  3. Johannes SchindelinJul 18, 2016
  4. Junio C HamanoJul 18, 2016
  5. Jeff KingJul 18, 2016
  6. Junio C HamanoJul 18, 2016
  7. Johannes SchindelinJul 19, 2016
  8. Junio C HamanoJul 19, 2016
  9. Junio C HamanoJul 18, 2016
  10. Eric WongJul 18, 2016
  11. Junio C HamanoJul 18, 2016
  12. Eric WongJul 18, 2016
  13. Junio C HamanoJul 18, 2016
  14. Jeff KingJul 18, 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.