Re: coreutils-5.1.3 released: bug-fix-only, candidate for stable 5.2.0

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

 



Jim Meyering <jim@xxxxxxxxxxxx> writes:

> I've never heard of a shell performing the // -> / substitution
> indiscriminately.

Me neither.

Autoconf is littered with code like this:

  ac_script='s/\$U\././;s/\.o$//;s/\.obj$//'
  ac_i=`echo "$ac_i" | sed "$ac_script"`

This passes an argument with two trailing slashes to 'sed'.
Does it misbehave too, under OSF/Tru64 5.1?

Does any Tru64 expert know whether this bug has been fixed in later
versions, (e.g., Tru64 5.1A) and/or whether it was present in earlier
versions (e.g., Tru64 5.0A or 4.0G)?  Is a patch available for Tru64
5.1?

The bug seems to be pretty fundamental; I'm not sure it's worth coding
around.  But if it is, then here's a proposed patch to the autoconf
manual.

--- autoconf.texi.~1.801.~	Mon Feb  9 10:31:16 2004
+++ autoconf.texi	Wed Feb 11 12:30:19 2004
@@ -9207,6 +9207,7 @@ There are other sources of documentation
 * Shell Substitutions::         Variable and command expansions
 * Assignments::                 Varying side effects of assignments
 * Parentheses::                 Parentheses in shell scripts
+* Slashes::                     Slashes in shell scripts
 * Special Shell Variables::     Variables you should not change
 * Limitations of Builtins::     Portable use of not so portable /bin/sh
 * Limitations of Usual Tools::  Portable use of portable tools
@@ -9974,6 +9975,26 @@ esac
 @noindent
 but the @code{(} in this example is not portable to many older Bourne
 shell implementations.  It can be omitted safely.
+
+@node Slashes
+@section Slashes in Shell Scripts
+@cindex Shell slashes
+
+Beware of command-line arguments containing two or more trailing
+slashes, as Tru64 5.1 @command{sh} omits the last slash in that case:
+
+@example
+$ echo / // /// //// .// //.
+/ / // /// ./ //.
+$ x=//
+$ eval "echo \$x"
+/
+$ set -x
+$ echo abc | tr -t ab //
++ echo abc
++ tr -t ab /
+/bc
+@end example
 
 @node Special Shell Variables
 @section Special Shell Variables



[Index of Archives]     [GCC Help]     [Kernel Discussion]     [RPM Discussion]     [Red Hat Development]     [Yosemite News]     [Linux USB]     [Samba]

  Powered by Linux