Bug#207391: glibc: csu/Makefile patch
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?
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:
> --- 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]
Reply to: