other/10270: gccbug's echo displays '-n' instead of no-line-break

Hallvard B Furuseth h.b.furuseth@usit.uio.no
Sun Mar 30 17:45:00 GMT 2003


>Number:         10270
>Category:       other
>Synopsis:       gccbug's echo displays '-n' instead of no-line-break
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    unassigned
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sun Mar 30 12:16:00 UTC 2003
>Closed-Date:
>Last-Modified:
>Originator:     Hallvard B Furuseth
>Release:        3.2.2
>Organization:
>Environment:
System: SunOS bombur.uio.no 5.8 Generic_108528-13 sun4u sparc SUNW,Ultra-5_10
Architecture: sun4

	
host: sparc-sun-solaris2.8
build: sparc-sun-solaris2.8
target: sparc-sun-solaris2.8
configured with: ../gcc-3.2.2/configure --enable-languages=c,c++,f77 --prefix=/usit/bombur/hbf --enable-version-specific-runtime-libs --enable-threads
>Description:
	gccbug asks '-n a)bort, e)dit or s)end?' when /bin/echo
	is the first echo in $PATH.
>How-To-Repeat:
	PATH="/bin:$PATH" gccbug
>Fix:
Don't hard-code ECHON=bsd in gccbug, instead check for bsd vs. sysv echo
at run-time:

--- gccbug~	Sun Mar 30 01:15:28 2003
+++ gccbug	Sun Mar 30 13:55:33 2003
@@ -56,16 +56,13 @@
 PASSWD="cat /etc/passwd"
 
-ECHON=bsd
-
-if [ $ECHON = bsd ] ; then
-  ECHON1="echo -n"
-  ECHON2=
-elif [ $ECHON = sysv ] ; then
-  ECHON1=echo
-  ECHON2='\c'
-else
-  ECHON1=echo
-  ECHON2=
-fi
+ECHON1="echo -n"
+ECHON2='\c'
+case `$ECHON1 "foo $ECHON2"` in
+  -n*c)	ECHON1=echo
+	ECHON2=
+	;;
+  -n*)	ECHON1=echo ;;
+  *)	ECHON2= ;;
+esac
 
 #
>Release-Note:
>Audit-Trail:
>Unformatted:



More information about the Gcc-bugs mailing list