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

Re: [PATCH v3 1/3] t/lib-httpd: dynamically detect httpd and modules path

From
Patrick Steinhardt <ps@pks.im>
Date
Nov 9, 2023, 07:57 UTC
Message-ID
<ZUyQ9DOLccTeJElf@tanuki>
In-Reply-To
<xmqqzfzn1i9u.fsf@gitster.g>
On Thu, Nov 09, 2023 at 04:46:05PM +0900, Junio C Hamano wrote:
Show 11 quoted lines
> Patrick Steinhardt <ps@pks.im> writes:
> 
> > Yeah, I was grepping for it in our codebase and saw other occurrences,
> > so I assumed it was fair game. If we're going to convert it to the
> > below, how about I send another patch on top that also converts the
> > preexisting instances so that the next one grepping for it isn't going
> > to repeat the same mistake?
> 
> Yup, an independent clean-up would be fine.  Now we need to find a
> way to give better visibility to CodingGuidelines, which already
> says this:

Okay, I'll send one in. Do you want me to send a v4 of this patch series or will you squash in below changes into patch 1/3?

Show 11 quoted lines
>  - We do not write our "test" command with "-a" and "-o" and use "&&"
>    or "||" to concatenate multiple "test" commands instead, because
>    the use of "-a/-o" is often error-prone.  E.g.
> 
>      test -n "$x" -a "$a" = "$b"
> 
>    is buggy and breaks when $x is "=", but
> 
>      test -n "$x" && test "$a" = "$b"
> 
>    does not have such a problem.

I did indeed spot this part of our coding style now. I didn't bother to look farther when I found other examples where we used `-a` and `-o`, but that issue will be gone once we've dropped all of these usages.

Patrick
-- >8 --
diff --git a/t/lib-httpd.sh b/t/lib-httpd.sh
index 6ab8f273a3..0a74922d7f 100644
--- a/t/lib-httpd.sh
+++ b/t/lib-httpd.sh
@@ -60,7 +60,7 @@ for DEFAULT_HTTPD_PATH in '/usr/sbin/httpd' \
 			  "$(command -v httpd)" \
 			  "$(command -v apache2)"
 do
-	if test -n "$DEFAULT_HTTPD_PATH" -a -x "$DEFAULT_HTTPD_PATH"
+	if test -n "$DEFAULT_HTTPD_PATH" && test -x "$DEFAULT_HTTPD_PATH"
 	then
 		break
 	fi
@@ -78,7 +78,7 @@ for DEFAULT_HTTPD_MODULE_PATH in '/usr/libexec/apache2' \
 				 '/usr/libexec/httpd' \
 				 "${DETECTED_HTTPD_ROOT:+${DETECTED_HTTPD_ROOT}/modules}"
 do
-	if test -n "$DEFAULT_HTTPD_MODULE_PATH" -a -d "$DEFAULT_HTTPD_MODULE_PATH"
+	if test -n "$DEFAULT_HTTPD_MODULE_PATH" && test -d "$DEFAULT_HTTPD_MODULE_PATH"
 	then
 		break
 	fi
Previous: Junio C HamanoNext: Jeff King
Message 26 of 41 in “t: improve compatibility with NixOS”
  1. 0/3 t: improve compatibility with NixOSPatrick Steinhardt, Nov 8, 2023
  2. 1/3 t/lib-httpd: dynamically detect httpd and modules pathPatrick Steinhardt, Nov 8, 2023
  3. Junio C HamanoNov 8, 2023
  4. Patrick SteinhardtNov 8, 2023
  5. Jeff KingNov 8, 2023
  6. 2/3 t/lib-httpd: stop using legacy crypt(3) for authenticationPatrick Steinhardt, Nov 8, 2023
  7. Junio C HamanoNov 8, 2023
  8. 3/3 t9164: fix inability to find basename(1) in hooksPatrick Steinhardt, Nov 8, 2023
  9. 0/3 t: improve compatibility with NixOSPatrick Steinhardt, Nov 8, 2023
  10. 1/3 t/lib-httpd: dynamically detect httpd and modules pathPatrick Steinhardt, Nov 8, 2023
  11. Jeff KingNov 8, 2023
  12. Junio C HamanoNov 9, 2023
  13. Patrick SteinhardtNov 9, 2023
  14. 2/3 t/lib-httpd: stop using legacy crypt(3) for authenticationPatrick Steinhardt, Nov 8, 2023
  15. Jeff KingNov 8, 2023
  16. 3/3 t9164: fix inability to find basename(1) in hooksPatrick Steinhardt, Nov 8, 2023
  17. Jeff KingNov 8, 2023
  18. Junio C HamanoNov 8, 2023
  19. Patrick SteinhardtNov 9, 2023
  20. Patrick SteinhardtNov 9, 2023
  21. 0/3 t: improve compatibility with NixOSPatrick Steinhardt, Nov 9, 2023
  22. 1/3 t/lib-httpd: dynamically detect httpd and modules pathPatrick Steinhardt, Nov 9, 2023
  23. Jeff KingNov 9, 2023
  24. Patrick SteinhardtNov 9, 2023
  25. Junio C HamanoNov 9, 2023
  26. Patrick SteinhardtNov 9, 2023
  27. Jeff KingNov 9, 2023
  28. 2/3 t/lib-httpd: stop using legacy crypt(3) for authenticationPatrick Steinhardt, Nov 9, 2023
  29. 3/3 t9164: fix inability to find basename(1) in Subversion hooksPatrick Steinhardt, Nov 9, 2023
  30. Jeff KingNov 9, 2023
  31. Jeff KingNov 9, 2023
  32. 0/3 t: improve compatibility with NixOSPatrick Steinhardt, Nov 10, 2023
  33. 1/3 t/lib-httpd: dynamically detect httpd and modules pathPatrick Steinhardt, Nov 10, 2023
  34. Junio C HamanoNov 11, 2023
  35. Patrick SteinhardtNov 13, 2023
  36. 2/3 t/lib-httpd: stop using legacy crypt(3) for authenticationPatrick Steinhardt, Nov 10, 2023
  37. 3/3 t9164: fix inability to find basename(1) in Subversion hooksPatrick Steinhardt, Nov 10, 2023
  38. Jeff KingNov 10, 2023
  39. Junio C HamanoNov 11, 2023
  40. Patrick SteinhardtNov 13, 2023
  41. Junio C HamanoNov 13, 2023

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.