bug-libtool
[Top][All Lists]
Advanced

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

ltmain.sh porting problem on POSIX 1003.1-2001 hosts


From: Paul Eggert
Subject: ltmain.sh porting problem on POSIX 1003.1-2001 hosts
Date: Sun, 10 Feb 2002 00:00:13 -0800 (PST)

The new version of POSIX is now an official IEEE standard (POSIX
1003.1-2001; see <http://www.UNIX-systems.org/version3/online.html>),
and it prohibits some utilities from supporting obsolete options.  I'm
using a test version of GNU textutils that implements the new standard
and I noticed one place where libtool is not portable.  The new
standard says that "sort +2" means sort a file named "+2", instead of
the obsolete usage that meant the same thing as "sort -k 3".

The simplest fix is to replace "sort +2" with "sort -k 3".

However, I looked at the code, and for the life of me I couldn't see
what the "+2" was needed for anyway; the rest of the code doesn't seem
to care about the sort order.  Nor could I see the need for the
surrounding "if", since the "uniq" will always succeed.  Or for using
"uniq" at all, rather than "sort -u".

So here is a proposed patch to clean up all three problems.


2002-02-09  Paul Eggert  <address@hidden>

        * ltmain.sh: Avoid the need for "sort +2", which is
        not portable to POSIX 1003.1-2001 hosts.  Use "sort -u"
        rather than "uniq".

--- ltmain.sh   Thu Feb  7 11:54:36 2002
+++ ltmain.sh-new       Sat Feb  9 23:56:06 2002
@@ -3805,12 +3805,8 @@ extern \"C\" {
              $mv "$nlist"T "$nlist"
            fi
 
-           # Try sorting and uniquifying the output.
-           if grep -v "^: " < "$nlist" | sort +2 | uniq > "$nlist"S; then
-             :
-           else
-             grep -v "^: " < "$nlist" > "$nlist"S
-           fi
+           # Sort and uniquify the output.
+           grep -v "^: " < "$nlist" | sort -u > "$nlist"S
 
            if test -f "$nlist"S; then
              eval "$global_symbol_to_cdecl"' < "$nlist"S >> 
"$output_objdir/$dlsyms"'



reply via email to

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