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

Bug#207391: glibc: csu/Makefile patch



On Mon, Sep 15, 2003 at 11:02:54PM +0100, Colin Watson wrote:
> retitle 207391 glibc: fails to build if /bin/sh != bash
> thanks
> 
> On Mon, Sep 15, 2003 at 01:58:18PM -0700, Eric Wong wrote:
> > Package: glibc
> > Version: 2.3.7-2; reported 2003-09-15
> > Followup-For: Bug #207391
> > 
> > I've gotten this newline issue in version-info.h both while building from
> > non-modified sources for i386 and my own modified sources for i686. 
> > 
> > I'm not sure if it's a bug in make in the way it passes the argument, a bug in
> > echo in coreutils or a shell bug.
> > 
> > The \\n\" sequence used in this section of the Makefile causes the newline
> > character to be interpreted, instead of the double backslash being interpreted
> > as a one.  The below patch works around the problem.  I'm using the latest
> > versions of all the build-dependencies from unstable.
> > 
> > Below is a patch that works around the buggy \\n\" handling.  Should be a
> > harmless fix even on systems that don't have the bug.
> 
> This points straight at differences in the echo builtin between shells.
> POSIX notes: "It is not possible to use echo portably across all POSIX
> systems unless both -n (as the first argument) and escape sequences are
> omitted." I bet your /bin/sh isn't bash: for instance, dash's echo
> interprets its arguments in the way you describe. Zed, is the same true
> for you?

Yes, this is one of the big differences between dash and bash.  Note
that autoconf falls afoul of this also, so I hope you don't need to
pass a backslash to any of 'configure's arguments if /bin/sh's echo
interprets backslashes.

> If you need any escape sequences in a portable shell script, then the
> only real option is to avoid echo altogether and use printf instead. I'd
> suggest the following modifications in place of yours:

That sounds like a good idea...

> 
> > --- glibc-2.3.2.o/glibc-2.3.2/csu/Makefile	2003-09-15 13:35:41.000000000 -0700
> > +++ glibc-2.3.2/glibc-2.3.2/csu/Makefile	2003-09-15 13:34:21.000000000 -0700
> > @@ -231,13 +231,15 @@
> >  		   if [ -z "$$os" ]; then \
> >  		     os=Linux; \
> >  		   fi; \
> > -		   echo "\"Compiled on a $$os $$version system" \
> > -			"on `date +%Y-%m-%d`.\\n\"" ;; \
> > +		   echo -n "\"Compiled on a $$os $$version system" \
> > +			"on `date +%Y-%m-%d`.\\" ; \
> > +		   echo "n\"";; \
> 
> +		   printf '"Compiled on a %s %s system on %s.\\n"\n' \
> +			"$os" "$version" "`date +%Y-%m-%d`" ;; \
> 
> >  	   *) ;; \
> >  	 esac; \
> >  	 files="$(all-Banner-files)";				\
> >  	 if test -n "$$files"; then				\
> > -	   echo "\"Available extensions:\\n\"";			\
> > +	   echo -n "\"Available extensions:\\";			\
> > +	   echo "n\"";						\
> 
> +	   printf '"Available extensions:\\n"\n';		\
> 
> (Sorry I haven't had time to construct a proper patch, but this should
> get the gist across.)
> 
> Cheers,
> 
> -- 
> Colin Watson                                  [cjwatson@flatline.org.uk]
> 
> 
> -- 
> To UNSUBSCRIBE, email to debian-glibc-request@lists.debian.org
> with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
> 
> 

-- 
Daniel Jacobowitz
MontaVista Software                         Debian GNU/Linux Developer



Reply to: