All of lore.kernel.org
 help / color / mirror / Atom feed
From: Patrick Steinhardt <ps@pks.im>
To: Junio C Hamano <gitster@pobox.com>
Cc: Jeff King <peff@peff.net>, git@vger.kernel.org
Subject: Re: [PATCH v3 1/3] t/lib-httpd: dynamically detect httpd and modules path
Date: Thu, 9 Nov 2023 08:57:40 +0100	[thread overview]
Message-ID: <ZUyQ9DOLccTeJElf@tanuki> (raw)
In-Reply-To: <xmqqzfzn1i9u.fsf@gitster.g>

[-- Attachment #1: Type: text/plain, Size: 2119 bytes --]

On Thu, Nov 09, 2023 at 04:46:05PM +0900, Junio C Hamano wrote:
> 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?

>  - 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


[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

  reply	other threads:[~2023-11-09  7:57 UTC|newest]

Thread overview: 41+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-11-08  7:29 [PATCH 0/3] t: improve compatibility with NixOS Patrick Steinhardt
2023-11-08  7:29 ` [PATCH 1/3] t/lib-httpd: dynamically detect httpd and modules path Patrick Steinhardt
2023-11-08  7:59   ` Junio C Hamano
2023-11-08 10:42     ` Patrick Steinhardt
2023-11-08 16:44       ` Jeff King
2023-11-08  7:30 ` [PATCH 2/3] t/lib-httpd: stop using legacy crypt(3) for authentication Patrick Steinhardt
2023-11-08  8:01   ` Junio C Hamano
2023-11-08  7:30 ` [PATCH 3/3] t9164: fix inability to find basename(1) in hooks Patrick Steinhardt
2023-11-08 14:57 ` [PATCH v2 0/3] t: improve compatibility with NixOS Patrick Steinhardt
2023-11-08 14:57   ` [PATCH v2 1/3] t/lib-httpd: dynamically detect httpd and modules path Patrick Steinhardt
2023-11-08 16:54     ` Jeff King
2023-11-09  0:30       ` Junio C Hamano
2023-11-09  6:30       ` Patrick Steinhardt
2023-11-08 14:57   ` [PATCH v2 2/3] t/lib-httpd: stop using legacy crypt(3) for authentication Patrick Steinhardt
2023-11-08 17:02     ` Jeff King
2023-11-08 14:57   ` [PATCH v2 3/3] t9164: fix inability to find basename(1) in hooks Patrick Steinhardt
2023-11-08 17:21     ` Jeff King
2023-11-08 17:43       ` Junio C Hamano
2023-11-09  6:30         ` Patrick Steinhardt
2023-11-09  7:02           ` Patrick Steinhardt
2023-11-09  7:09 ` [PATCH v3 0/3] t: improve compatibility with NixOS Patrick Steinhardt
2023-11-09  7:09   ` [PATCH v3 1/3] t/lib-httpd: dynamically detect httpd and modules path Patrick Steinhardt
2023-11-09  7:32     ` Jeff King
2023-11-09  7:36       ` Patrick Steinhardt
2023-11-09  7:46         ` Junio C Hamano
2023-11-09  7:57           ` Patrick Steinhardt [this message]
2023-11-09  7:48         ` Jeff King
2023-11-09  7:09   ` [PATCH v3 2/3] t/lib-httpd: stop using legacy crypt(3) for authentication Patrick Steinhardt
2023-11-09  7:10   ` [PATCH v3 3/3] t9164: fix inability to find basename(1) in Subversion hooks Patrick Steinhardt
2023-11-09  7:35     ` Jeff King
2023-11-09  7:36   ` [PATCH v3 0/3] t: improve compatibility with NixOS Jeff King
2023-11-10  8:16 ` [PATCH v4 " Patrick Steinhardt
2023-11-10  8:17   ` [PATCH v4 1/3] t/lib-httpd: dynamically detect httpd and modules path Patrick Steinhardt
2023-11-11  0:00     ` Junio C Hamano
2023-11-13  7:15       ` Patrick Steinhardt
2023-11-10  8:17   ` [PATCH v4 2/3] t/lib-httpd: stop using legacy crypt(3) for authentication Patrick Steinhardt
2023-11-10  8:17   ` [PATCH v4 3/3] t9164: fix inability to find basename(1) in Subversion hooks Patrick Steinhardt
2023-11-10 21:41   ` [PATCH v4 0/3] t: improve compatibility with NixOS Jeff King
2023-11-11  0:10   ` Junio C Hamano
2023-11-13  7:15     ` Patrick Steinhardt
2023-11-13 23:42       ` Junio C Hamano

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

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ZUyQ9DOLccTeJElf@tanuki \
    --to=ps@pks.im \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=peff@peff.net \
    /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.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.