Difference between revisions of "Dash as /bin/sh"

From ArchWiki
Jump to: navigation, search
(add instructions for identifying bashisms)
 
(Redirect to a page with a proper name)
 
(20 intermediate revisions by 11 users not shown)
Line 1: Line 1:
{{stub}}
+
#REDIRECT [[Dash]]
{{expansion}}
+
 
+
This article is for those who want to help [[dash]] become the new {{filename|/bin/sh}}.
+
 
+
From http://article.gmane.org/gmane.linux.arch.devel/11418:
+
*http://mailman.archlinux.org/pipermail/arch-dev-public/2007-November/003053.html
+
*https://launchpad.net/ubuntu/+spec/dash-as-bin-sh
+
*https://wiki.ubuntu.com/DashAsBinSh
+
*All install scripts must be sh-compatible (or we need a way of executing non-sh scripts, there is a bug open for that)
+
*Any daemon/init script is probably written for /bin/bash as our rc.conf and other initscripts files use bash arrays, so those need to be pointed correctly
+
 
+
==Identifying bashisms==
+
 
+
Install {{package AUR|checkbashisms}} with an [[AUR helper]].
+
 
+
===Common places to check===
+
 
+
*Installed scripts with a {{codeline|#!/bin/sh}} shebang:
+
$ find {,usr}/bin -type f \
+
    -exec grep -l -- '^#!/bin/sh' {} \; \
+
    -exec checkbashisms -f -p {} +
+
 
+
*Package install scripts:
+
$ find /var/lib/pacman/local -mindepth 2 -type f -name install \
+
    -exec checkbashisms -f -p {} + 2>&1 |\
+
    grep -v -e '^you may get strange results' \
+
            -e 'does not appear to have a #! interpreter line;$'
+
 
+
*Initscripts and daemons:
+
$ find \
+
    /etc/rc.{conf,d,local{,.shutdown},multi,shutdown,single,sysinit} -type -f \
+
    -exec checkbashisms -f -p {} + 2>&1 |\
+
    grep -v -e '^you may get strange results' \
+
            -e 'does not appear to have a #! interpreter line;$'
+
 
+
==Initscript status==
+
 
+
* The FD checks with {{codeline|test -t}} in {{filename|/etc/rc.d/functions}} do not work correctly with dash, breaking colored output as a result. See http://bugs.archlinux.org/task/19551?project=1&order=id&sort=desc (the patch does not address this issue in particular).
+
:* Try using {{codeline|test(1)}} instead of the dash builtin?
+

Latest revision as of 17:03, 24 October 2013

Redirect to: