From: Po Lu <luangruo@yahoo.com>
To: "Mattias Engdegård" <mattias.engdegard@gmail.com>
Cc: Eli Zaretskii <eliz@gnu.org>, emacs-devel@gnu.org
Subject: Re: master a89c86888c4 1/3: Detect developer builds in git worktrees as well
Date: Sat, 30 Sep 2023 19:54:24 +0800 [thread overview]
Message-ID: <87edifnafj.fsf@yahoo.com> (raw)
In-Reply-To: <D0C78153-4E06-48BB-9D5C-AA73EAA1BE60@gmail.com> ("Mattias Engdegård"'s message of "Sat, 30 Sep 2023 13:35:40 +0200")
Mattias Engdegård <mattias.engdegard@gmail.com> writes:
> 30 sep. 2023 kl. 13.33 skrev Po Lu <luangruo@yahoo.com>:
>
>> test -o is equally non-portable. I will fix that on master.
>
> The Solaris man page suggested that -o would work. Is it in error, or did I misread it?
>
> https://docs.oracle.com/cd/E86824_01/html/E54763/test-1.html
It functions on Solaris, but not under other POSIX systems.
(autoconf)Limitations of Builtins mentions:
‘test’
The ‘test’ program is the way to perform many file and string
tests. It is often invoked by the alternate name ‘[’, but using
that name in Autoconf code is asking for trouble since it is an M4
quote character.
The ‘-a’, ‘-o’, ‘(’, and ‘)’ operands are not present in all
implementations, and have been marked obsolete by Posix 2008. This
is because there are inherent ambiguities in using them. For
example, ‘test "$1" -a "$2"’ looks like a binary operator to check
whether two strings are both non-empty, but if ‘$1’ is the literal
‘!’, then some implementations of ‘test’ treat it as a negation of
the unary operator ‘-a’.
Thus, portable uses of ‘test’ should never have more than four
arguments, and scripts should use shell constructs like ‘&&’ and
‘||’ instead. If you combine ‘&&’ and ‘||’ in the same statement,
keep in mind that they have equal precedence, so it is often better
to parenthesize even when this is redundant. For example:
# Not portable:
test "X$a" = "X$b" -a \
'(' "X$c" != "X$d" -o "X$e" = "X$f" ')'
# Portable:
test "X$a" = "X$b" &&
{ test "X$c" != "X$d" || test "X$e" = "X$f"; }
‘test’ does not process options like most other commands do; for
example, it does not recognize the ‘--’ argument as marking the end
of options.
It is safe to use ‘!’ as a ‘test’ operator. For example, ‘if test
! -d foo; ...’ is portable even though ‘if ! test -d foo; ...’ is
not.
next prev parent reply other threads:[~2023-09-30 11:54 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-09-29 18:07 master a89c86888c4 1/3: Detect developer builds in git worktrees as well Eli Zaretskii
2023-09-30 11:12 ` Mattias Engdegård
2023-09-30 11:33 ` Po Lu
2023-09-30 11:35 ` Mattias Engdegård
2023-09-30 11:54 ` Po Lu [this message]
2023-09-30 12:18 ` Mattias Engdegård
2023-09-30 12:24 ` Po Lu
2023-09-30 12:29 ` Mattias Engdegård
2023-09-30 13:21 ` Björn Bidar
2023-09-30 14:31 ` Eli Zaretskii
2023-09-30 14:37 ` Po Lu
2023-09-30 18:35 ` Andreas Schwab
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=87edifnafj.fsf@yahoo.com \
--to=luangruo@yahoo.com \
--cc=eliz@gnu.org \
--cc=emacs-devel@gnu.org \
--cc=mattias.engdegard@gmail.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 external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
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.