--- Begin Message ---
Subject: |
autoconf-doc: Portability problems of "Usual Tools" not described in manual |
Date: |
Fri, 22 Feb 2008 11:05:35 +0100 |
User-agent: |
Gnus/5.1007 (Gnus v5.10.7) Emacs/21.4 (gnu/linux) |
Package: autoconf-doc
Version: 2.59-2
Severity: minor
While working on a larger shell script that has portability requirements,
I came across the following portability issues not described in the
Autoconf manual:
1. sed behaves entirely unpredictable on lines that are not newline-terminated.
Some implementations pass the line through unchanged, some append a newline,
some do not print the line at all:
On GNU/Linux:
bash-3.1$ echo -n foo | sed -n p
foobash-3.1$
On SUN Solaris 2.10:
bash-3.1$ echo -n foo | sed -n p
bash-3.1$
On AIX 6.1:
bash-3.1$ echo -n foo | sed -n p
foo
bash-3.1$
This does not only hold for the "p" command, but also for (seemingly) all
others.
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.
On most other OSs the result is as expected:
bash-3.1$ expr 'Xfoo' : 'X\(f\(oo\)*\)$'
foo
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
On most other OSs and on recent versions of GNU expr the result is as
expected:
bash-3.1$ expr "X$baz" : 'X\(foo\)$' || echo baz
baz
-- System Information:
Debian Release: 3.1
Architecture: i386 (i686)
Kernel: Linux 2.6.11-5
Locale: LANG=C, LC_CTYPE=C (charmap=ANSI_X3.4-1968)
-- no debconf information
--- End Message ---