All of lore.kernel.org
 help / color / mirror / Atom feed
From: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be>
To: buildroot@busybox.net
Subject: [Buildroot] [PATCH] gzip: force shell shebang to /bin/sh
Date: Sat, 15 Oct 2016 23:14:11 +0200	[thread overview]
Message-ID: <20161015211411.810-1-arnout@mind.be> (raw)

gzip's configure uses $SHELL to find a POSIX-compliant shell to put in
the shebang of its shell scripts (zcat, gzexe, ...). However, we set
$SHELL to /bin/bash in the Makefile, which may not be present on the
target. We do make sure that /bin/sh always points to a valid shell on
the target so we can use that.

The configure discovery is completely broken for cross-compilation. The
same $SHELL is used during the build (it is used by make to run the
commands in rules) and on the target. Also, the checks for a valid
shell use the host shell, not the target shell.

We could try to patch gzip to fix that, but the checks can anyway not
be run for the target shell, so we'll have to override it with a cache
value anyway. So we can just as well do exactly that, without patching.

Signed-off-by: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be>
Reported-by: Pascal Speck <kernel@iktek.de>
---
 package/gzip/gzip.mk | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/package/gzip/gzip.mk b/package/gzip/gzip.mk
index 6dc910e..c4e91b0 100644
--- a/package/gzip/gzip.mk
+++ b/package/gzip/gzip.mk
@@ -14,5 +14,12 @@ GZIP_DEPENDENCIES = $(if $(BR2_PACKAGE_BUSYBOX),busybox)
 GZIP_LICENSE = GPLv3+
 GZIP_LICENSE_FILES = COPYING
 GZIP_CONF_ENV += gl_cv_func_fflush_stdin=yes
+# configure substitutes $(SHELL) for the shell shebang in scripts like
+# gzexe. Unfortunately, the same $(SHELL) variable will also be used by
+# make to run its commands. Fortunately, /bin/sh is always a POSIX shell
+# on both the target and host systems that we support. Even with this,
+# the configure check is slightly broken and prints a bogus warning:
+#  "using /bin/sh, even though it may have file descriptor bugs"
+GZIP_CONF_ENV += ac_cv_path_shell=/bin/sh
 
 $(eval $(autotools-package))
-- 
2.9.3

             reply	other threads:[~2016-10-15 21:14 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-10-15 21:14 Arnout Vandecappelle [this message]
2016-10-16 11:13 ` [Buildroot] [PATCH] gzip: force shell shebang to /bin/sh Thomas Petazzoni

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20161015211411.810-1-arnout@mind.be \
    --to=arnout@mind.be \
    --cc=buildroot@busybox.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.