autoconf-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: more shell portability docs


From: Eric Blake
Subject: Re: more shell portability docs
Date: Wed, 14 May 2008 19:48:54 +0000 (UTC)
User-agent: Loom/3.14 (http://gmane.org/)

Noah Misch <noah <at> cs.caltech.edu> writes:

> 
> Indeed, ash and {Free,Net}BSD /bin/sh have a common origin.

I was a bit surprised to hear that, since /bin/sh OpenBSD 4.0 (the only *BSD 
system I have access to at the moment) is a pdksh clone instead.  Oh well - I 
learned something today.

> 
> $  sh -c '! : | :'; echo $?
> 1
> $ ash -c '! : | :'; echo $?
> 0
> 
> Ash evaluates the pipeline like `{ ! :; } | :'.  Also note this bug affecting
> `!' with a compound command.
> 
> $  sh -c '! { :; }'
> $ ash -c '! { :; }'
> {: not found
> Syntax error: "}" unexpected

Thanks for the clarification.  I've updated the manual accordingly 
(fortunately, the end result is unchanged - portable shell scripts can't use !):

>From 95dfc197494a66dc9a88577d18f1633afc7cff2d Mon Sep 17 00:00:00 2001
From: Eric Blake <address@hidden>
Date: Wed, 14 May 2008 13:41:18 -0600
Subject: [PATCH] Improve documentation of ! issues.

* doc/autoconf.texi (Limitations of Builtins) <!>: Touch up.
Reported by Noah Misch.

Signed-off-by: Eric Blake <address@hidden>
---
 ChangeLog         |    4 ++++
 doc/autoconf.texi |   12 +++++++++---
 2 files changed, 13 insertions(+), 3 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 3782a5b..15adde0 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,9 @@
 2008-05-14  Eric Blake  <address@hidden>
 
+       Improve documentation of ! issues.
+       * doc/autoconf.texi (Limitations of Builtins) <!>: Touch up.
+       Reported by Noah Misch.
+
        Document some FreeBSD shell bugs.
        * doc/autoconf.texi (Limitations of Builtins) <!>: Mention ! issue
        in compound pipe commands.
diff --git a/doc/autoconf.texi b/doc/autoconf.texi
index fd60b7b..ee1ede5 100644
--- a/doc/autoconf.texi
+++ b/doc/autoconf.texi
@@ -13776,13 +13776,19 @@ The Unix version 7 shell did not support
 negating the exit status of commands with @command{!}, and this feature
 is still absent from some shells (e.g., Solaris @command{/bin/sh}).
 Other shells, such as FreeBSD @command{/bin/sh} or @command{ash}, have
-bugs when using @command{!} in compound commands:
+bugs when using @command{!}:
 
 @example
-$ @kbd{sh -c 'true && ! true | true; echo $?'}
+$ @kbd{sh -c '! : | :'; echo $?}
 1
-$ @kbd{ash -c 'true && ! true | true; echo $?'}
+$ @kbd{ash -c '! : | :'; echo $?}
 0
+$ @kbd{sh -c '! @{ :; @}'; echo $?}
+1
+$ @kbd{ash -c '! @{ :; @}'; echo $?}
address@hidden: not found
+Syntax error: "@}" unexpected
+2
 @end example
 
 Shell code like this:
-- 
1.5.5.1








reply via email to

[Prev in Thread] Current Thread [Next in Thread]