libtool-patches
[Top][All Lists]
Advanced

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

FYI: workaround pdksh bug


From: Ralf Wildenhues
Subject: FYI: workaround pdksh bug
Date: Wed, 26 Jan 2005 12:31:42 +0100
User-agent: Mutt/1.4.1i

The script below reveals a nice bug present in pdksh.
I checked the workaround below in HEAD (and reported
the issue upstream).

Regards,
Ralf

#! /usr/bin/ksh

set a b a/b
one=$1
two=$2
three=$3

echo ${three#"$one"}
echo ${three#"$1"}
echo ${3#"$one"}
echo ${3#"$1"}          # empty
echo ${three#$one}
echo ${three#$1}
echo ${3#$one}
echo ${3#$1}            # empty

echo ${three%"$two"}
echo ${three%"$2"}
echo ${3%"$two"}
echo ${3%"$2"}          # empty
echo ${three%$two}
echo ${three%$2}
echo ${3%$two}
echo ${3%$2}            # empty


        * m4/libtool.m4 (_LT_PROG_XSI_SHELLFNS): Work around pdksh
        positional parameter expansion bug.

Index: m4/libtool.m4
===================================================================
RCS file: /cvsroot/libtool/libtool/m4/libtool.m4,v
retrieving revision 1.157
diff -u -r1.157 libtool.m4
--- m4/libtool.m4       24 Jan 2005 13:28:47 -0000      1.157
+++ m4/libtool.m4       26 Jan 2005 10:22:53 -0000
@@ -6068,7 +6078,10 @@
 # dot (in which case that matches only a dot).
 func_stripname ()
 {
-  func_stripname_result=${3#"${1}"}
+  # pdksh 5.2.14 does not do ${X%$Y} correctly if both X and Y are
+  # positional parameters, so assign one to ordinary parameter first.
+  func_stripname_result=${3}
+  func_stripname_result=${func_stripname_result#"${1}"}
   func_stripname_result=${func_stripname_result%"${2}"}
 }
 _LT_EOF




reply via email to

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