bug-gnu-utils
[Top][All Lists]
Advanced

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

sharutils-4.3.60 incompatibilities with POSIX 1003.1-2001


From: Paul Eggert
Subject: sharutils-4.3.60 incompatibilities with POSIX 1003.1-2001
Date: Sun, 30 Jun 2002 23:02:40 -0700 (PDT)

sharutils 4.3.60 generate shell scripts that do not conform to
basic POSIX 1003.1-2001, for two reasons:

* The shell scripts use "head -1", but the standard doesn't allow
  portable scripts to use "head -1".

* The shell scripts use the "-a" option of the "test" command, but
  the standard doesn't allow portable scripts to use "-a".

Here is a patch.

2002-06-30  Paul Eggert  <address@hidden>

        * src/shar.c (generate_configure): Do not use "head -1" or
        "test ... -a ..."; they are not standardized by basic POSIX
        1003.1-2001 and have portability problems in practice.

diff -pru sharutils-4.3.60/src/shar.c sharutils-4.3.60-fix/src/shar.c
--- sharutils-4.3.60/src/shar.c 2002-06-30 09:39:55.000000000 -0700
+++ sharutils-4.3.60-fix/src/shar.c     2002-06-30 22:30:44.440535000 -0700
@@ -479,7 +479,7 @@ do\n\
   if test \"$gettext_dir\" = FAILED && test -f $dir/gettext \\\n\
      && ($dir/gettext --version >/dev/null 2>&1)\n\
   then\n\
-    case `$dir/gettext --version 2>&1 | head -1` in\n\
+    case `$dir/gettext --version 2>&1 | sed 1q` in\n\
       *GNU*) gettext_dir=$dir ;;\n\
     esac\n\
   fi\n\
@@ -558,11 +558,11 @@ fi\n",
         Otherwise, set shar_touch to `:' and issue a warning.  */
 
       fprintf (output, "\
-if touch -am -t %s %s >/dev/null 2>&1 && test ! -f %s -a -f %s; then\n\
+if touch -am -t %s %s >/dev/null 2>&1 && test ! -f %s && test -f %s; then\n\
   shar_touch='touch -am -t $1$2$3$4$5$6.$7 \"$8\"'\n\
-elif touch -am %s %s >/dev/null 2>&1 && test ! -f %s -a ! -f %s -a -f %s; 
then\n\
+elif touch -am %s %s >/dev/null 2>&1 && test ! -f %s && test ! -f %s && test 
-f %s; then\n\
   shar_touch='touch -am $3$4$5$6$1$2.$7 \"$8\"'\n\
-elif touch -am %s %s >/dev/null 2>&1 && test ! -f %s -a -f %s; then\n\
+elif touch -am %s %s >/dev/null 2>&1 && test ! -f %s && test -f %s; then\n\
   shar_touch='touch -am $3$4$5$6$2 \"$8\"'\n\
 else\n\
   shar_touch=:\n\



reply via email to

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