Skip to content

Loading…

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

Open
peti opened this Issue · 9 comments

8 participants

@peti
Official Nix/Nixpkgs/NixOS member

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 (determined by for n in $(grep -Rl /bin/sh pkgs); do echo "- [ ] $n"; done):

  • pkgs/test/mkOption/test.sh
  • pkgs/misc/seafile-shared/default.nix
  • pkgs/misc/drivers/foomatic-filters/default.nix
  • pkgs/misc/freestyle/default.nix
  • pkgs/misc/my-env/loadenv.sh
  • pkgs/misc/emulators/wine/builder-wow.sh
  • pkgs/misc/vim-plugins/vim-utils.nix
  • pkgs/desktops/plasma-5.3/dependencies.sh
  • pkgs/desktops/plasma-5.3/manifest.sh
  • pkgs/desktops/plasma-5.3/plasma-workspace/0001-startkde-NixOS-patches.patch
  • pkgs/desktops/kde-4.14/kde-package/kde-manifest.sh
  • pkgs/desktops/kde-4.14/l10n/l10n-manifest.sh
  • pkgs/shells/dash/default.nix
  • pkgs/shells/bash/cygwin-bash-4.3.33-1.src.patch
  • pkgs/shells/bash/update-patch-set.sh
  • pkgs/shells/bash/default.nix
  • pkgs/tools/misc/debootstrap/default.nix
  • pkgs/tools/misc/qjoypad/default.nix
  • pkgs/tools/misc/grub/2.0x.nix
  • pkgs/tools/misc/fileschanged/unused-variables.debian.patch
  • pkgs/tools/compression/gzip/default.nix
  • pkgs/tools/security/ecryptfs/default.nix
  • pkgs/tools/security/gnupg/socket-activate-2.1.1.patch
  • pkgs/tools/security/eid-mw/eid-nssdb.in
  • pkgs/tools/typesetting/lout/builder.sh
  • pkgs/tools/backup/store-backup/default.nix
  • pkgs/tools/graphics/povray/default.nix
  • pkgs/tools/graphics/zxing/zxing-cmdline-encoder.sh
  • pkgs/tools/graphics/zxing/java-zxing.sh
  • pkgs/tools/graphics/zxing/zxing.sh
  • pkgs/tools/graphics/zxing/zxing-cmdline-runner.sh
  • pkgs/tools/graphics/briss/default.nix
  • pkgs/tools/networking/ccnet/default.nix
  • pkgs/tools/networking/badvpn/default.nix
  • pkgs/tools/filesystems/bcache-tools/bcache-udev-modern.patch
  • pkgs/tools/X11/xnee/default.nix
  • pkgs/tools/package-management/checkinstall/glibc-check.patch
  • pkgs/tools/archivers/cromfs/default.nix
  • pkgs/tools/archivers/rpmextract/rpmextract.sh
  • pkgs/tools/archivers/sharutils/default.nix
  • pkgs/tools/text/patchutils/drop-comments.patch
  • pkgs/tools/text/gnugrep/default.nix
  • pkgs/data/misc/geolite-legacy/builder.sh
  • pkgs/development/misc/avr8-burn-omat/default.nix
  • pkgs/development/perl-modules/expression-generator/requirements.sh
  • pkgs/development/perl-modules/expression-generator/write-nix-expression.sh
  • pkgs/development/perl-modules/expression-generator/filtered-requirements.sh
  • pkgs/development/perl-modules/expression-generator/retrieve-modulepage.sh
  • pkgs/development/perl-modules/expression-generator/grab-url.sh
  • pkgs/development/perl-modules/expression-generator/full-requirements.sh
  • pkgs/development/perl-modules/expression-generator/retrieve-file-link.sh
  • pkgs/development/perl-modules/expression-generator/make-clean-dir.sh
  • pkgs/development/perl-modules/expression-generator/source-download-link.sh
  • pkgs/development/perl-modules/expression-generator/retrieve-meta-yaml.sh
  • pkgs/development/tools/misc/libtool/libtool2.nix
  • pkgs/development/tools/misc/libtool/default.nix
  • pkgs/development/tools/misc/ccache/default.nix
  • pkgs/development/tools/misc/automake/automake-1.13.x.nix
  • pkgs/development/tools/misc/automake/automake-1.11.x.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.15.x.nix
  • pkgs/development/tools/misc/automake/automake-1.14.x.nix
  • pkgs/development/tools/misc/distcc/default.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/selenium/remote-control/default.nix
  • pkgs/development/tools/haskell/ihaskell/wrapper.nix
  • pkgs/development/tools/java/jclasslib/builder.sh
  • pkgs/development/tools/tradcpp/tradcpp-configure.patch
  • pkgs/development/ocaml-modules/gmetadom/gcc-4.3.dpatch
  • pkgs/development/haskell-modules/gcc-clang-wrapper.sh
  • pkgs/development/web/iojs/update-iojs
  • pkgs/development/lisp-modules/from-quicklisp/asdf-description.sh
  • pkgs/development/lisp-modules/from-quicklisp/quicklisp-dependencies.sh
  • pkgs/development/lisp-modules/from-quicklisp/barebones-quicklisp-expression.sh
  • pkgs/development/lisp-modules/from-quicklisp/quicklisp-beta-env.sh
  • pkgs/development/lisp-modules/define-package.nix
  • pkgs/development/lisp-modules/clwrapper/common-lisp.sh
  • pkgs/development/lisp-modules/clwrapper/cl-wrapper.sh
  • pkgs/development/lisp-modules/clwrapper/build-with-lisp.sh
  • pkgs/development/libraries/cloog-ppl/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/qt-5/5.4/manifest.sh
  • pkgs/development/libraries/kde-frameworks-5.10/dependencies.sh
  • pkgs/development/libraries/kde-frameworks-5.10/manifest.sh
  • pkgs/development/libraries/icu/default.nix
  • pkgs/development/libraries/pango/default.nix
  • pkgs/development/libraries/ccnx/default.nix
  • pkgs/development/libraries/libgpg-error/default.nix
  • pkgs/development/libraries/nss/nss-3.17-gentoo-fixups.patch
  • pkgs/development/libraries/nss/default.nix
  • pkgs/development/libraries/cloog/0.18.0.nix
  • pkgs/development/libraries/cloog/default.nix
  • pkgs/development/libraries/glibc/common.nix
  • pkgs/development/mobile/titaniumenv/examples/kitchensink/generatekeystore.sh
  • pkgs/development/mobile/androidenv/generate-sysimages.sh
  • pkgs/development/mobile/androidenv/fetch.sh
  • pkgs/development/mobile/androidenv/generate-platforms.sh
  • pkgs/development/mobile/androidenv/generate-addons.sh
  • pkgs/development/r-modules/default.nix
  • pkgs/development/compilers/fsharp/default.nix
  • pkgs/development/compilers/gcc/4.5/update-gcc.sh
  • pkgs/development/compilers/gcc/4.6/update-gcc.sh
  • pkgs/development/compilers/gcc/4.4/update-gcc.sh
  • pkgs/development/compilers/ccl/default.nix
  • pkgs/development/compilers/openjdk/openjdk8.nix
  • pkgs/development/compilers/ocaml/configure-3.08.0
  • pkgs/development/compilers/adobe-flex-sdk/default.nix
  • pkgs/development/interpreters/dart/default.nix
  • pkgs/development/interpreters/guile/default.nix
  • pkgs/development/interpreters/ruby/patches.nix
  • pkgs/stdenv/cygwin/wrap-exes-to-find-dlls.sh
  • pkgs/stdenv/nix/default.nix
  • pkgs/stdenv/linux/scripts/unpack-bootstrap-tools-arm.sh
  • pkgs/stdenv/linux/scripts/unpack-bootstrap-tools.sh
  • pkgs/stdenv/linux/default.nix
  • pkgs/stdenv/darwin/make-bootstrap-tools.nix
  • pkgs/stdenv/darwin/unpack-bootstrap-tools.sh
  • pkgs/stdenv/darwin/trivial-bootstrap.sh
  • pkgs/stdenv/darwin/default.nix
  • pkgs/servers/xmpp/pyIRCt/default.nix
  • pkgs/servers/xmpp/pyMAILt/default.nix
  • pkgs/servers/asterisk/runtime-vardirs.patch
  • pkgs/servers/x11/xquartz/xinitrc
  • pkgs/servers/x11/xquartz/startx
  • pkgs/servers/x11/xquartz/privileged
  • pkgs/servers/x11/xorg/unichrome/default.nix
  • pkgs/servers/x11/xorg/darwin/bundle_main.patch
  • pkgs/servers/nosql/eventstore/default.nix
  • pkgs/applications/science/misc/simgrid/default.nix
  • pkgs/applications/science/geometry/drgeo/struct.patch
  • pkgs/applications/science/logic/iprover/default.nix
  • pkgs/applications/science/logic/hol_light/default.nix
  • pkgs/applications/science/logic/leo2/default.nix
  • pkgs/applications/science/logic/coq/configure.8.3.patch
  • pkgs/applications/version-management/cvsps/02_dynamicbufferalloc.dpatch
  • pkgs/applications/version-management/cvsps/03_diffoptstypo.dpatch
  • pkgs/applications/version-management/cvsps/01_ignoretrunk.dpatch
  • pkgs/applications/misc/thinking-rock/default.nix
  • pkgs/applications/misc/freemind/default.nix
  • pkgs/applications/misc/googleearth/default.nix
  • pkgs/applications/misc/zathura/builder.sh
  • pkgs/applications/misc/jbidwatcher/default.nix
  • pkgs/applications/misc/openjump/default.nix
  • pkgs/applications/misc/grass/default.nix
  • pkgs/applications/graphics/wings/default.nix
  • pkgs/applications/graphics/zgrviewer/default.nix
  • pkgs/applications/graphics/pinta/default.nix
  • pkgs/applications/graphics/shotwell/default.nix
  • pkgs/applications/graphics/jbrout/default.nix
  • pkgs/applications/graphics/alchemy/default.nix
  • pkgs/applications/networking/browsers/w3m/cygwin.patch
  • pkgs/applications/networking/browsers/chromium/update.sh
  • pkgs/applications/networking/cluster/mesos/default.nix
  • pkgs/applications/networking/remote/teamviewer/8.nix
  • pkgs/applications/networking/remote/teamviewer/9.nix
  • pkgs/applications/networking/remote/teamviewer/10.nix
  • pkgs/applications/networking/instant-messengers/telepathy/kde/update.sh
  • pkgs/applications/kde-apps-15.04/dependencies.sh
  • pkgs/applications/kde-apps-15.04/manifest.sh
  • pkgs/applications/display-managers/lightdm/fix-paths.patch
  • pkgs/applications/editors/music/tuxguitar/default.nix
  • pkgs/applications/video/zdfmediathk/default.nix
  • pkgs/applications/video/shotcut/default.nix
  • pkgs/applications/video/handbrake/default.nix
  • pkgs/applications/audio/abcde/default.nix
  • pkgs/applications/virtualization/xen/generic.nix
  • pkgs/build-support/fetchcvs/nix-prefetch-cvs
  • pkgs/build-support/upstream-updater/attrset-to-dir.sh
  • pkgs/build-support/upstream-updater/create-src-info.sh
  • pkgs/build-support/upstream-updater/urls-from-page.sh
  • pkgs/build-support/upstream-updater/create-src-info-git.sh
  • pkgs/build-support/upstream-updater/update-upstream-data.sh
  • pkgs/build-support/upstream-updater/update-walker.sh
  • pkgs/build-support/setup-hooks/patch-shebangs.sh
  • pkgs/build-support/fetchzip/nix-prefetch-zip
  • pkgs/build-support/native-darwin-cctools-wrapper/builder.sh
  • pkgs/build-support/fetchgit/nix-prefetch-git
  • pkgs/build-support/kdewrapper/default.nix
  • pkgs/build-support/release/ant-build.nix
  • pkgs/build-support/builder-defs/builder-defs.nix
  • pkgs/build-support/fetchhg/nix-prefetch-hg
  • pkgs/build-support/vm/windows/default.nix
  • pkgs/build-support/vm/default.nix
  • pkgs/build-support/fetchsvn/nix-prefetch-svn
  • pkgs/build-support/rust/fetch-cargo-deps
  • pkgs/build-support/fetchbzr/nix-prefetch-bzr
  • pkgs/os-specific/linux/alsa-plugins/wrapper.nix
  • pkgs/os-specific/linux/autofs/create-patches-v5.sh
  • pkgs/os-specific/linux/rfkill/rfkill-hook.sh
  • pkgs/os-specific/linux/rfkill/udev.nix
  • pkgs/os-specific/linux/util-linux/default.nix
  • pkgs/os-specific/linux/bbswitch/default.nix
  • pkgs/os-specific/linux/tp_smapi/default.nix
  • pkgs/os-specific/linux/systemd/fixes.patch
  • pkgs/os-specific/linux/nfs-utils/default.nix
  • pkgs/os-specific/darwin/apple-source-releases/CoreOSMakefiles/default.nix
  • pkgs/os-specific/gnu/mig/default.nix
  • pkgs/games/eduke32/default.nix
  • pkgs/games/sauerbraten/default.nix
  • pkgs/games/tremulous/default.nix
  • pkgs/games/stepmania/default.nix
  • pkgs/games/scorched3d/default.nix
  • pkgs/games/vessel/default.nix
  • pkgs/games/orbit/default.nix
  • pkgs/games/minecraft-server/default.nix
  • pkgs/games/gsb/default.nix
  • pkgs/games/worldofgoo/default.nix
  • pkgs/games/oilrush/default.nix
  • pkgs/games/andyetitmoves/default.nix
  • pkgs/games/zangband/default.nix
  • pkgs/games/thePenguinMachine/default.nix
  • pkgs/games/teeworlds/default.nix
  • pkgs/games/mars/default.nix
@viric
Official Nix/Nixpkgs/NixOS member

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

@edolstra
Official Nix/Nixpkgs/NixOS member

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

@vcunat
Official Nix/Nixpkgs/NixOS member

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.

@edolstra
Official Nix/Nixpkgs/NixOS member

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.

@vcunat
Official Nix/Nixpkgs/NixOS member

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

@Phreedom
Official Nix/Nixpkgs/NixOS member

@edolstra you seem to have forgottten to commit your patch

@domenkozar
Official Nix/Nixpkgs/NixOS member

+1 for the patch

@shlevy
Official Nix/Nixpkgs/NixOS member

@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?

@shlevy shlevy added the enhancement label
@domenkozar domenkozar added this to the 15.04 milestone
@matthiasbeyer

After doing #8881 it seems that the following are false positives in the list above:

pkgs/shells/dash/default.nix
pkgs/tools/misc/qjoypad/default.nix
pkgs/tools/compression/gzip/default.nix
pkgs/development/tools/misc/libtool/libtool2.nix
development/tools/misc/libtool/default.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/automake/automake-1.12.x.nix
pkgs/development/tools/misc/automake/automake-1.13.x.nix
pkgs/development/tools/misc/automake/automake-1.14.x.nix
pkgs/development/tools/misc/automake/automake-1.15.x.nix
pkgs/development/tools/misc/autoconf/2.13.nix
pkgs/development/tools/misc/autoconf/default.nix
pkgs/development/libraries/cloog-ppl/default.nix
pkgs/development/libraries/pango/default.nix
pkgs/development/libraries/libgpg-error/default.nix
pkgs/development/libraries/nss/default.nix
pkgs/development/libraries/cloog/0.18.0.nix
pkgs/development/libraries/cloog/default.nix
pkgs/development/libraries/glibc/common.nix
pkgs/development/r-modules/default.nix
pkgs/stdenv/nix/default.nix
pkgs/stdenv/linux/default.nix
pkgs/applications/graphics/shotwell/default.nix
pkgs/applications/networking/cluster/mesos/default.nix
pkgs/applications/editors/music/tuxguitar/default.nix
pkgs/applications/video/shotcut/default.nix
pkgs/build-support/builder-defs/builder-defs.nix

and the following are done:

development/libraries/icu/default.nix
@peti peti modified the milestone: 15.10, 15.07
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.