GNOME Bugzilla – Bug 738835
gtk+ does not compile with dash
Last modified: 2015-02-22 00:23:13 UTC
After shellshock there was a movement of using simpler shells as /bin/sh (bash is great shell but it has been designed to make the user life easier, not dealing with malicious inputs from dhcp/cgi/...). This caused problem during building gtk+ as it uses -e switch which is bash extension - resulting in each line in gtk.gresource.xml being prefixed by -e and resulting in built failure.
I don't see any need to fix this, really.
Shouldn't it call directly /bin/bash instead of /bin/sh then?
Created attachment 289325 [details] [review] Improve portability of ECHO
POSIX itself says do not use `echo -e`. `printf` instead is the correct answer.
@Matthias, You may have never seen the need to fix because dash is not purposefully compatible with Autoconf's definition of a POSIX shell. So running ./configure with dash as /bin/sh just triggers autoconf's detection mechanism and silently re-runs ./configure with bash. The missing piece (LINENO support) was actually added to dash a few years ago. And promptly reverted by Debian when build failures started coming in. We (Gentoo) hit this issue a few weeks ago when upgrading dash, but we started tracking these bugs instead of just reverting LINENO support. In the case of Gnome, the issues we've found were due to "echo -e" and parameter expansion, both are bashisms that are easily rewritten. Let me point out that Gtk+ is not an isolated case [1] in not being fully POSIX-compliant, as recommended by the Autoconf manual [2]. If you want to reproduce the breakage locally, you have to run ./configure with CONFIG_SHELL=/bin/dash to prevent the bash fallback. Our goal here is not to rid the world of bash (after all, Gentoo ebuilds are 100% bash scripts), but just to enable simpler (and hopefully safer) shells wherever possible. I hope this better explains where we're coming from and that you'll reconsider the patch Alexander posted in attachment #289325 [details], as it implements a safe and portable alternative to echo [3]. Thanks 1: https://bugs.gentoo.org/showdependencytree.cgi?id=526268&hide_resolved=0 2: https://www.gnu.org/software/automake/faq/autoconf.html#Portable-Shell 3: https://www.gnu.org/software/automake/faq/autoconf.html#echo
@Mathias, could this then be reconsidered please? (as explained in previous comments)
Created attachment 297538 [details] [review] gtk/Makefile.am: Remove bashisms Updated patch for 3.14.8 since 420d7414 added a call to the bash-specific "shopt".
Created attachment 297539 [details] [review] gtk/Makefile.am: Remove bashisms