Skip to content
This repository

Builders should use ${stdenv.shell} instead of /bin/sh #183

Open
peti opened this Issue November 09, 2012 · 8 comments

7 participants

Peter Simons Shea Levy viric Eelco Dolstra Vladimír Čunát Evgeny Egorochkin Domen Kožar
Peter Simons
Collaborator

Any Nix expression that refers to /bin/sh should be fixed to use ${stdenv.shell} (which can be assumed to be Bash).

Potential offenders are:

$ grep -Rl /bin/sh ~/.nix-defexpr/pkgs/
pkgs/os-specific/gnu/mig/default.nix
pkgs/os-specific/linux/tp_smapi/default.nix
pkgs/os-specific/linux/autofs/create-patches-v5.sh
pkgs/os-specific/linux/bbswitch/default.nix
pkgs/os-specific/linux/rfkill/udev.nix
pkgs/os-specific/linux/rfkill/rfkill-hook.sh
pkgs/os-specific/linux/qemu-kvm/default.nix
pkgs/os-specific/linux/kernel/manual-config.nix
pkgs/os-specific/linux/kernel/builder.sh
pkgs/os-specific/linux/nfs-utils/default.nix
pkgs/os-specific/linux/dmtcp/default.nix
pkgs/os-specific/linux/pwdutils/default.nix
pkgs/os-specific/linux/alsa-plugins/wrapper.nix
pkgs/misc/my-env/loadenv.sh
pkgs/misc/drivers/foomatic-filters/default.nix
pkgs/misc/freestyle/default.nix
pkgs/stdenv/nix/default.nix
pkgs/stdenv/linux/bootstrap/loongson2f/sh
pkgs/stdenv/linux/bootstrap/i686/sh
pkgs/stdenv/linux/bootstrap/armv5tel/sh
pkgs/stdenv/linux/bootstrap/powerpc/bash
pkgs/stdenv/linux/scripts/unpack-bootstrap-tools.sh
pkgs/stdenv/linux/scripts/unpack-bootstrap-tools-arm.sh
pkgs/stdenv/linux/default.nix
pkgs/stdenv/generic/setup.sh
pkgs/stdenv/mingw/setup.sh
pkgs/stdenv/mingw/default.nix
pkgs/desktops/kde-4.8/kde-package/kde-manifest.sh
pkgs/desktops/kde-4.8/l10n/l10n-manifest.sh
pkgs/desktops/kde-4.7/kde-package/kde-manifest.sh
pkgs/desktops/kde-4.7/l10n/l10n-manifest.sh
pkgs/tools/graphics/briss/default.nix
pkgs/tools/package-management/checkinstall/glibc-check.patch
pkgs/tools/misc/qjoypad/default.nix
pkgs/tools/misc/w3c-css-validator/default.nix
pkgs/tools/misc/fileschanged/unused-variables.debian.patch
pkgs/tools/misc/shebangfix/shebangfix.pl
pkgs/tools/misc/shebangfix/default.nix
pkgs/tools/misc/debootstrap/default.nix
pkgs/tools/misc/grub/2.0x.nix
pkgs/tools/X11/xnee/default.nix
pkgs/tools/networking/wicd/default.nix
pkgs/tools/networking/tcng/default.nix
pkgs/tools/typesetting/lout/builder.sh
pkgs/tools/archivers/cromfs/default.nix
pkgs/tools/archivers/sharutils/default.nix
pkgs/data/misc/xkeyboard-config/default.nix
pkgs/applications/graphics/zgrviewer/default.nix
pkgs/applications/graphics/wings/default.nix
pkgs/applications/graphics/jbrout/default.nix
pkgs/applications/graphics/pinta/default.nix
pkgs/applications/misc/googleearth/default.nix
pkgs/applications/misc/thinking-rock/default.nix
pkgs/applications/misc/cdrtools/default.nix
pkgs/applications/misc/openjump/default.nix
pkgs/applications/misc/jbidwatcher/default.nix
pkgs/applications/misc/qcad/default.nix
pkgs/applications/misc/zathura/builder.sh
pkgs/applications/misc/freemind/default.nix
pkgs/applications/misc/grass/default.nix
pkgs/applications/science/logic/coq/configure.8.3.patch
pkgs/applications/science/logic/isabelle/default.nix
pkgs/applications/science/logic/hol_light/default.nix
pkgs/applications/science/logic/leo2/default.nix
pkgs/applications/science/logic/iprover/default.nix
pkgs/applications/science/biology/arb/default.nix
pkgs/applications/science/misc/simgrid/default.nix
pkgs/applications/science/geometry/drgeo/struct.patch
pkgs/applications/office/openoffice/oo.patch
pkgs/applications/version-management/cvsps/03_diffoptstypo.dpatch
pkgs/applications/version-management/cvsps/02_dynamicbufferalloc.dpatch
pkgs/applications/version-management/cvsps/01_ignoretrunk.dpatch
pkgs/applications/version-management/git-and-tools/git/default.nix
pkgs/applications/version-management/monotone-viz/graphviz.patch
pkgs/applications/networking/instant-messengers/telepathy/kde/update.sh
pkgs/applications/networking/browsers/firefox/15.0.nix
pkgs/applications/networking/browsers/firefox/16.0.nix
pkgs/applications/networking/browsers/chromium/update.sh
pkgs/applications/editors/jedit/wrapper.nix
pkgs/applications/audio/abcde/default.nix
pkgs/development/perl-modules/expression-generator/retrieve-meta-yaml.sh
pkgs/development/perl-modules/expression-generator/grab-url.sh
pkgs/development/perl-modules/expression-generator/make-clean-dir.sh
pkgs/development/perl-modules/expression-generator/write-nix-expression.sh
pkgs/development/perl-modules/expression-generator/retrieve-file-link.sh
pkgs/development/perl-modules/expression-generator/requirements.sh
pkgs/development/perl-modules/expression-generator/retrieve-modulepage.sh
pkgs/development/perl-modules/expression-generator/filtered-requirements.sh
pkgs/development/perl-modules/expression-generator/source-download-link.sh
pkgs/development/perl-modules/expression-generator/full-requirements.sh
pkgs/development/androidenv/generate-sysimages.sh
pkgs/development/androidenv/generate-platforms.sh
pkgs/development/androidenv/generate-addons.sh
pkgs/development/androidenv/emulate-app.nix
pkgs/development/ocaml-modules/gmetadom/gcc-4.3.dpatch
pkgs/development/libraries/cloog/default.nix
pkgs/development/libraries/postgis/pg_db_postgis_fix_or_load_sql_dump.sh
pkgs/development/libraries/postgis/pg_db_postgis_enable.sh
pkgs/development/libraries/cloog-ppl/default.nix
pkgs/development/libraries/nss/nss-3.12.5-gentoo-fixups.diff
pkgs/development/libraries/nss/default.nix
pkgs/development/libraries/glibc/2.9/builder.sh
pkgs/development/libraries/glibc/2.9/headersbuilder.sh
pkgs/development/libraries/glibc/2.9/localesbuilder.sh
pkgs/development/libraries/glibc/2.13/common.nix
pkgs/development/libraries/glibc/2.14/common.nix
pkgs/development/libraries/libgpg-error/default.nix
pkgs/development/libraries/eglibc/builder.sh
pkgs/development/misc/avr8-burn-omat/default.nix
pkgs/development/tools/misc/libtool/libtool2.nix
pkgs/development/tools/misc/libtool/default.nix
pkgs/development/tools/misc/swig/default.nix
pkgs/development/tools/misc/automake/automake-1.12.x.nix
pkgs/development/tools/misc/automake/automake-1.10.x.nix
pkgs/development/tools/misc/automake/automake-1.11.x.nix
pkgs/development/tools/misc/ctags/wrapped.nix
pkgs/development/tools/misc/autoconf/2.13.nix
pkgs/development/tools/misc/autoconf/default.nix
pkgs/development/tools/misc/ccache/default.nix
pkgs/development/tools/build-managers/apache-ant/from-source.nix
pkgs/development/tools/build-managers/apache-ant/builder.sh
pkgs/development/tools/build-managers/apache-ant/core-builder.sh
pkgs/development/tools/build-managers/simple-build-tool/default.nix
pkgs/development/tools/selenium/remote-control/default.nix
pkgs/development/tools/java/jclasslib/builder.sh
pkgs/development/tools/analysis/spin/default.nix
pkgs/development/interpreters/clojure/wrapper.nix
pkgs/development/interpreters/clojure/clooj-wrapper.nix
pkgs/development/interpreters/ruby/patches.nix
pkgs/development/interpreters/python/pythonhome-wrapper.nix
pkgs/development/compilers/adobe-flex-sdk/default.nix
pkgs/development/compilers/ccl/default.nix
pkgs/development/compilers/ghc/7.4.2-binary.nix
pkgs/development/compilers/ghc/6.10.1-binary.nix
pkgs/development/compilers/ghc/6.10.2-binary.nix
pkgs/development/compilers/ghc/7.0.4-binary.nix
pkgs/development/compilers/ghc/6.12.1-binary.nix
pkgs/development/compilers/ghc/ghc-get-packages.sh
pkgs/development/compilers/ocaml/configure-3.08.0
pkgs/development/compilers/gcc/4.4/update-gcc.sh
pkgs/development/compilers/gcc/4.5/update-gcc.sh
pkgs/development/compilers/gcc/4.6/update-gcc.sh
pkgs/development/compilers/gwt/builder.sh
pkgs/development/eclipse/ecj/default.nix
pkgs/servers/x11/xorg/unichrome/default.nix
pkgs/servers/xmpp/pyMAILt/default.nix
pkgs/servers/xmpp/pyIRCt/default.nix
pkgs/servers/http/joseki/default.nix
pkgs/build-support/native-darwin-cctools-wrapper/builder.sh
pkgs/build-support/vm/default.nix
pkgs/build-support/fetchsvn/nix-prefetch-svn
pkgs/build-support/fetchhg/nix-prefetch-hg
pkgs/build-support/fetchbzr/nix-prefetch-bzr
pkgs/build-support/builder-defs/builder-defs.nix
pkgs/build-support/fetchgit/nix-prefetch-git
pkgs/build-support/release/ant-build.nix
pkgs/build-support/fetchcvs/nix-prefetch-cvs
pkgs/build-support/upstream-updater/urls-from-page.sh
pkgs/build-support/upstream-updater/attrset-to-dir.sh
pkgs/build-support/upstream-updater/update-walker.sh
pkgs/build-support/upstream-updater/update-upstream-data.sh
pkgs/build-support/upstream-updater/create-src-info.sh
pkgs/build-support/upstream-updater/create-src-info-git.sh
pkgs/games/scorched3d/default.nix
pkgs/games/andyetitmoves/default.nix
pkgs/games/the-butterfly-effect/default.nix
pkgs/games/eduke32/default.nix
pkgs/games/oilrush/default.nix
pkgs/games/sauerbraten/default.nix
pkgs/games/teeworlds/default.nix
pkgs/games/mars/default.nix
pkgs/games/urbanterror/default.nix
pkgs/games/fsg/default.nix
pkgs/games/tremulous/default.nix
pkgs/games/spring/default.nix
pkgs/games/orbit/default.nix
pkgs/games/zangband/default.nix
pkgs/games/thePenguinMachine/default.nix
pkgs/lib/strings-with-deps.nix
pkgs/shells/dash/default.nix
pkgs/shells/bash/update-patch-set.sh
pkgs/shells/bash/default.nix
pkgs/test/mkOption/test.sh
viric
Collaborator

I think that there are requirements in other places that /bin/sh has to be bash, currently. Some builds fail if not so.

Eelco Dolstra
Owner

Agree with @peti, it's good to get rid of /bin/sh references.

Vladimír Čunát
Collaborator

There might be much more offenders. Some build-scripts just have hard-coded paths in them (like /usr/bin/perl). Is there any preConfigure script which fixes these automatically? If not, I think we should create one, it's the problem of many packages.

Eelco Dolstra
Owner

I have a patch somewhere that runs patchShebangs on the source tree before configurePhase (as suggested by @civodul a while back). I'll add it after the next stdenv merge.

Vladimír Čunát
Collaborator

I didn't only mean sheBangs, also insides of the scripts... but maybe that would be better reported upstream, I don't know.

Evgeny Egorochkin
Collaborator

@edolstra you seem to have forgottten to commit your patch

Domen Kožar
Collaborator

+1 for the patch

Shea Levy
Collaborator

@edolstra Do you still have the patchShebangs patch around? Would be good to have.

As for this issue... Should we keep this open or just try to fix this incrementally and document that it's the proper best practice?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.