This is the mail archive of the gdb-prs@sources.redhat.com mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

gdb/527: GDB 5.2 incompatibilities with GNU textutils 2.0.21 in POSIX mode



>Number:         527
>Category:       gdb
>Synopsis:       GDB 5.2 incompatibilities with GNU textutils 2.0.21 in POSIX mode
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sat May 04 00:58:01 PDT 2002
>Closed-Date:
>Last-Modified:
>Originator:     Paul Eggert
>Release:        5.2
>Organization:
>Environment:
GNU textutils 2.0.21
export _POSIX2_VERSION=200112
>Description:
In a few places, the GDB build procedure assumes behavior
specified by POSIX 1003.2-1992 that is no longer allowed
by POSIX 1003.1-2001 (dated December 2001).  This includes
the use of the following commands:

head -1
tail -1
sort +2

If you use GNU textutils 2.0.21 with
_POSIX2_VERSION=200112
in the environment, these commands will fail.
>How-To-Repeat:
Install GNU textutils 2.0.21 or later.
Set _POSIX2_VERSION=200112 in the environment.
Build GDB 5.2.
>Fix:
2002-05-04  Paul Eggert  <eggert@twinsun.com>

	Port to POSIX 1003.1-2001 environments, e.g.
	GNU textutils 2.0.21 with _POSIX2_VERSION=200112 in the environment.

	* Makefile.in (VER): Use 'sed q' rather than 'head -1'.
	* gdb/doc/Makefile.in (GDBvn.texi): Likewise.
	* ltcf-c.sh, ltcf-gcj.sh: Likewise.

	* configure: Use 'sed -n $p' rather than 'tail -1'.

	* gdb/gdbarch.sh (gdbarch_dump): Use 'sort -k 3', not 'sort +2'.
	* ltmain.sh: Likewise, except fall back on sort +2 on ancient
	hosts where sort -k 3 does not work.

===================================================================
RCS file: Makefile.in,v
retrieving revision 5.2
retrieving revision 5.2.0.1
diff -pu -r5.2 -r5.2.0.1
--- Makefile.in	2002/04/27 01:07:25	5.2
+++ Makefile.in	2002/05/04 06:35:06	5.2.0.1
@@ -1892,7 +1892,7 @@ VER = `	if grep 'AM_INIT_AUTOMAKE.*BFD_V
 	elif grep AM_INIT_AUTOMAKE $(TOOL)/configure.in >/dev/null 2>&1; then \
 	  sed < $(TOOL)/configure.in -n 's/AM_INIT_AUTOMAKE[^,]*, *\([^)]*\))/\1/p'; \
 	elif test -f $(TOOL)/version.in; then \
-	  head -1 $(TOOL)/version.in; \
+	  sed q $(TOOL)/version.in; \
 	elif grep VERSION $(TOOL)/Makefile.in > /dev/null 2>&1; then \
 	  sed < $(TOOL)/Makefile.in -n 's/^VERSION *= *//p'; \
 	else \
===================================================================
RCS file: configure,v
retrieving revision 5.2
retrieving revision 5.2.0.1
diff -pu -r5.2 -r5.2.0.1
--- configure	2001/11/28 19:55:01	5.2
+++ configure	2002/05/04 07:15:50	5.2.0.1
@@ -811,7 +811,7 @@ if [ -z "${CC}" ] && [ -r Makefile ]; th
 s/\\\n//g
 t loop
 /^CC[ 	]*=/ s/CC[ 	]*=[ 	]*\(.*\)/\1/p' < Makefile > Makefile.cc
-  CC=`tail -1 Makefile.cc`
+  CC=`sed -n '$p' Makefile.cc`
   rm -f Makefile.cc
 fi
 
@@ -821,7 +821,7 @@ if [ -z "${CFLAGS}" ] && [ -r Makefile ]
 s/\\\n//g
 t loop
 /^CFLAGS[ 	]*=/ s/CFLAGS[ 	]*=[ 	]*\(.*\)/\1/p' < Makefile > Makefile.cc
-  CFLAGS=`tail -1 Makefile.cc`
+  CFLAGS=`sed -n '$p' Makefile.cc`
   rm -f Makefile.cc
 fi
 
@@ -831,7 +831,7 @@ if [ -z "${CXX}" ] && [ -r Makefile ]; t
 s/\\\n//g
 t loop
 /^CXX[ 	]*=/ s/CXX[ 	]*=[ 	]*\(.*\)/\1/p' < Makefile > Makefile.cc
-  CXX=`tail -1 Makefile.cc`
+  CXX=`sed -n '$p' Makefile.cc`
   rm -f Makefile.cc
 fi
 
@@ -841,7 +841,7 @@ if [ -z "${CXXFLAGS}" ] && [ -r Makefile
 s/\\\n//g
 t loop
 /^CXXFLAGS[ 	]*=/ s/CXXFLAGS[ 	]*=[ 	]*\(.*\)/\1/p' < Makefile > Makefile.cc
-  CXXFLAGS=`tail -1 Makefile.cc`
+  CXXFLAGS=`sed -n '$p' Makefile.cc`
   rm -f Makefile.cc
 fi
 
@@ -922,7 +922,7 @@ s/\\\n//g
 t loop
 /^'"${var}"'[ 	]*=/ s/'"${var}"'[ 	]*=[ 	]*\(.*\)/\1/p' \
 	< Makefile > Makefile.v
-      t=`tail -1 Makefile.v`
+      t=`sed -n '$p' Makefile.v`
       if [ -n "${t}" ]; then
 	eval "${var}=\${t}"
       fi
===================================================================
RCS file: gdb/doc/Makefile.in,v
retrieving revision 5.2
retrieving revision 5.2.0.1
diff -pu -r5.2 -r5.2.0.1
--- gdb/doc/Makefile.in	2002/02/25 04:32:58	5.2
+++ gdb/doc/Makefile.in	2002/05/04 05:36:04	5.2.0.1
@@ -215,7 +215,7 @@ refcard.ps : refcard.dvi
 
 # File to record current GDB version number (copied from main dir version.in)
 GDBvn.texi : ${gdbdir}/version.in
-	echo "@set GDBVN `head -1 $(srcdir)/../version.in`" > ./GDBvn.new
+	echo "@set GDBVN `sed q $(srcdir)/../version.in`" > ./GDBvn.new
 	mv GDBvn.new GDBvn.texi
 
 # Updated atomically
===================================================================
RCS file: gdb/gdbarch.sh,v
retrieving revision 5.2
retrieving revision 5.2.0.1
diff -pu -r5.2 -r5.2.0.1
--- gdb/gdbarch.sh	2002/02/18 15:59:14	5.2
+++ gdb/gdbarch.sh	2002/05/04 05:46:34	5.2.0.1
@@ -1507,7 +1507,7 @@ gdbarch_dump (struct gdbarch *gdbarch, s
                       "gdbarch_dump: GDB_MULTI_ARCH = %d\\n",
                       GDB_MULTI_ARCH);
 EOF
-function_list | sort -t: +2 | while do_read
+function_list | sort -t: -k 3 | while do_read
 do
     # multiarch functions don't have macros.
     if class_is_multiarch_p
===================================================================
RCS file: ltcf-c.sh,v
retrieving revision 5.2
retrieving revision 5.2.0.1
diff -pu -r5.2 -r5.2.0.1
--- ltcf-c.sh	2002/01/28 04:59:30	5.2
+++ ltcf-c.sh	2002/05/04 06:35:06	5.2.0.1
@@ -153,7 +153,7 @@ EOF
     # If the export-symbols file already is a .def file (1st line
     # is EXPORTS), use it as is.
     # If DATA tags from a recent dlltool are present, honour them!
-    archive_expsym_cmds='if test "x`head -1 $export_symbols`" = xEXPORTS; then
+    archive_expsym_cmds='if test "x`sed 1q $export_symbols`" = xEXPORTS; then
         cp $export_symbols $output_objdir/$soname-def;
       else
         echo EXPORTS > $output_objdir/$soname-def;
===================================================================
RCS file: ltcf-gcj.sh,v
retrieving revision 5.2
retrieving revision 5.2.0.1
diff -pu -r5.2 -r5.2.0.1
--- ltcf-gcj.sh	2001/11/14 06:24:41	5.2
+++ ltcf-gcj.sh	2002/05/04 06:35:06	5.2.0.1
@@ -156,7 +156,7 @@ EOF
     # If the export-symbols file already is a .def file (1st line
     # is EXPORTS), use it as is.
     # If DATA tags from a recent dlltool are present, honour them!
-    archive_expsym_cmds='if test "x`head -1 $export_symbols`" = xEXPORTS; then
+    archive_expsym_cmds='if test "x`sed 1q $export_symbols`" = xEXPORTS; then
         cp $export_symbols $output_objdir/$soname-def;
       else
         echo EXPORTS > $output_objdir/$soname-def;
===================================================================
RCS file: ltmain.sh,v
retrieving revision 5.2
retrieving revision 5.2.0.1
diff -pu -r5.2 -r5.2.0.1
--- ltmain.sh	2001/11/14 06:24:41	5.2
+++ ltmain.sh	2002/05/04 06:35:06	5.2.0.1
@@ -3713,7 +3713,13 @@ extern \"C\" {
 	    fi
 
 	    # Try sorting and uniquifying the output.
-	    if grep -v "^: " < "$nlist" | sort +2 | uniq > "$nlist"S; then
+	    if grep -v "^: " < "$nlist" |
+	       if sort -k 3 </dev/null >/dev/null 2>&1; then
+		 sort -k 3
+	       else
+		 sort +2
+	       fi |
+	       uniq > "$nlist"S; then
 	      :
 	    else
 	      grep -v "^: " < "$nlist" > "$nlist"S
>Release-Note:
>Audit-Trail:
>Unformatted:


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]