[Top][All Lists]

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

Re: Portability problems of "Usual Tools" not described in manual

From: Eric Blake
Subject: Re: Portability problems of "Usual Tools" not described in manual
Date: Tue, 17 Mar 2009 08:43:32 -0600
User-agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv: Gecko/20081209 Thunderbird/ Mnenhy/

Hash: SHA1

According to Russ Allbery on 3/12/2009 10:32 PM:
> (This is Debian bug against the autoconf-doc
> Debian package.)
> Attached is a bug report from a Debian user that notes some additional
> shell portability issues that aren't included in the Autoconf 2.63
> documentation.  (I have not personally verified the reported behavior.)

Thanks for the report.  I would like to verify these claims before
applying any patches, but agree that they are probably worth mentioning.

> 1. sed behaves entirely unpredictable on lines that are not 
> newline-terminated.

Confirmed.  POSIX states that sed is only required to operate on text
files, and also that a file without a trailing newline is not a text file.
 Therefore, there are no requirements on how sed must behave on a file
without a trailing newline.  I'll probably just add a mention to that in
the paragraph that mentions that sed cannot operate on lines longer than
about 4000 bytes, also due to the POSIX restriction that sed need only
handle text files.

> 2. On HP-UX 11.23, regexp matching with expr does not allow multiple sub-
>    expressions:
>      bash-3.1$ expr 'Xfoo' : 'X\(f\(oo\)*\)$'
>      expr: More than one '\(' was used.

Ouch.  I don't have access to HP-UX to verify, but this means we need to
audit autoconf source to make sure we don't violate this restriction.

> 3. On GNU/Linux the regexp "$", when used with older versions of expr,
>    matches newlines embedded in the match string:
>      bash-3.1$ baz='foo
>      > bar'
>      bash-3.1$ expr "X$baz" : 'X\(foo\)$' || echo baz
>      foo

I'm assuming this was from an older version of coreutils?  Can someone
determine 'expr --version' in the broken case, to see when it was fixed?

- --
Don't work too hard, make some time for fun as well!

Eric Blake             address@hidden
Version: GnuPG v1.4.9 (Cygwin)
Comment: Public key at
Comment: Using GnuPG with Mozilla -


reply via email to

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