summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--app-shells/dash/dash-0.5.9-r1.ebuild5
-rw-r--r--app-shells/dash/dash-99999999.ebuild5
-rw-r--r--app-shells/dash/files/dumb-echo.patch103
-rw-r--r--app-shells/dash/metadata.xml7
-rw-r--r--profiles/use.local.desc1
5 files changed, 117 insertions, 4 deletions
diff --git a/app-shells/dash/dash-0.5.9-r1.ebuild b/app-shells/dash/dash-0.5.9-r1.ebuild
index 24104c5f..2ae757ec 100644
--- a/app-shells/dash/dash-0.5.9-r1.ebuild
+++ b/app-shells/dash/dash-0.5.9-r1.ebuild
@@ -31,12 +31,12 @@ fi
inherit eutils flag-o-matic toolchain-funcs
-DESCRIPTION="Descendant of the NetBSD ash. Vanilla, without the gentoo XSI cripple patches"
+DESCRIPTION="Descendant of the NetBSD ash. POSIX compliant except for multibyte characters"
HOMEPAGE="http://gondor.apana.org.au/~herbert/dash/"
LICENSE="BSD"
SLOT="0"
-IUSE="libedit static"
+IUSE="cripple libedit static"
RDEPEND="!static? ( libedit? ( dev-libs/libedit ) )"
DEPEND="${RDEPEND}
@@ -46,6 +46,7 @@ DEPEND="${RDEPEND}
src_prepare() {
local c
default
+ ! use cripple || eapply "${FILESDIR}"/dumb-echo.patch
if [ -n "${DEB_PATCH}" ]
then eapply "${WORKDIR}"/${DEB_PF}.diff
eapply */debian/diff/*
diff --git a/app-shells/dash/dash-99999999.ebuild b/app-shells/dash/dash-99999999.ebuild
index 24104c5f..5327b792 100644
--- a/app-shells/dash/dash-99999999.ebuild
+++ b/app-shells/dash/dash-99999999.ebuild
@@ -31,12 +31,12 @@ fi
inherit eutils flag-o-matic toolchain-funcs
-DESCRIPTION="Descendant of the NetBSD ash. Vanilla, without the gentoo XSI cripple patches"
+DESCRIPTION="Descendant of the NetBSD ash. POSIX compliant except for multibyte characters"
HOMEPAGE="http://gondor.apana.org.au/~herbert/dash/"
LICENSE="BSD"
SLOT="0"
-IUSE="libedit static"
+IUSE="cripple libedit static"
RDEPEND="!static? ( libedit? ( dev-libs/libedit ) )"
DEPEND="${RDEPEND}
@@ -46,6 +46,7 @@ DEPEND="${RDEPEND}
src_prepare() {
local c
default
+ ! use cripple || eapply "${FILESDIR}"/dumb-echo
if [ -n "${DEB_PATCH}" ]
then eapply "${WORKDIR}"/${DEB_PF}.diff
eapply */debian/diff/*
diff --git a/app-shells/dash/files/dumb-echo.patch b/app-shells/dash/files/dumb-echo.patch
new file mode 100644
index 00000000..89d51096
--- /dev/null
+++ b/app-shells/dash/files/dumb-echo.patch
@@ -0,0 +1,103 @@
+http://bugs.gentoo.org/337329
+http://bugs.gentoo.org/527848
+http://bugs.gentoo.org/590696
+
+There's no requirement for `echo` to support escape sequences on systems
+which are not XSI compliant (like embedded systems) according to POSIX:
+http://pubs.opengroup.org/onlinepubs/9699919799/utilities/echo.html
+
+This behavior breaks historical scripts, espcially if also the (not required
+by POSIX) `echo -n` and `echo -e` are unsupported, in particular all scripts
+generated by autoconf-2.13 will break.
+
+Modern scripts better should avoid all these pitfalls and should always prefer
+`printf` when they want anything like `echo -n` or interpretation of escape
+sequences. So it might be useful to intentionally break scripts which rely on
+these features. Note that this patch makes `echo` in dash behave differently
+from any other existing shell.
+
+--- a/src/bltin/printf.c
++++ b/src/bltin/printf.c
+@@ -442,21 +442,12 @@
+ int
+ echocmd(int argc, char **argv)
+ {
+- int nonl;
+-
+- nonl = *++argv ? equal(*argv, "-n") : 0;
+- argv += nonl;
+-
+- do {
+- int c;
+-
+- if (likely(*argv))
+- nonl += print_escape_str("%s", NULL, NULL, *argv++);
+- if (nonl > 0)
+- break;
+-
+- c = *argv ? ' ' : '\n';
+- out1c(c);
+- } while (*argv);
++ int i;
++ for (i = 1; i < argc; ++i) {
++ outstr(argv[i], out1);
++ if (i < argc - 1)
++ outc(' ', out1);
++ }
++ outc('\n', out1);
+ return 0;
+ }
+--- a/src/dash.1
++++ b/src/dash.1
+@@ -1182,43 +1182,18 @@
+ option turns off the effect of any preceding
+ .Fl P
+ options.
+-.It Xo echo Op Fl n
++.It Xo echo
+ .Ar args...
+ .Xc
+ Print the arguments on the standard output, separated by spaces.
+-Unless the
+-.Fl n
+-option is present, a newline is output following the arguments.
+-.Pp
+-If any of the following sequences of characters is encountered during
+-output, the sequence is not output. Instead, the specified action is
+-performed:
+-.Bl -tag -width indent
+-.It Li \eb
+-A backspace character is output.
+-.It Li \ec
+-Subsequent output is suppressed. This is normally used at the end of the
+-last argument to suppress the trailing newline that
+-.Ic echo
+-would otherwise output.
+-.It Li \ef
+-Output a form feed.
+-.It Li \en
+-Output a newline character.
+-.It Li \er
+-Output a carriage return.
+-.It Li \et
+-Output a (horizontal) tab character.
+-.It Li \ev
+-Output a vertical tab.
+-.It Li \e0 Ns Ar digits
+-Output the character whose value is given by zero to three octal digits.
+-If there are zero digits, a nul character is output.
+-.It Li \e\e
+-Output a backslash.
+-.El
+ .Pp
+-All other backslash sequences elicit undefined behaviour.
++In this crippled version of dash no backslash sequences are supported.
++They will be printed out exactly as passed in.
++Also the option -n is not supported in this crippled version of dash.
++.Pp
++Moderns scripts might want to replace `echo -n ...` with the `printf %s ...`
++construct, and similarly use `printf` to for escape sequences. This is POSIX
++compliant though not compatible since some historical systems lack `printf`.
+ .It eval Ar string ...
+ Concatenate all the arguments with spaces.
+ Then re-parse and execute the command.
diff --git a/app-shells/dash/metadata.xml b/app-shells/dash/metadata.xml
index fbb0e9c7..792e7bd0 100644
--- a/app-shells/dash/metadata.xml
+++ b/app-shells/dash/metadata.xml
@@ -13,4 +13,11 @@
<upstream>
<remote-id type="cpe">cpe:/a:dash:dash</remote-id>
</upstream>
+ <longdescription>DASH is a direct descendant of the NetBSD version of ash (the Almquist SHell).
+It is almost POSIX compliant; the most notable exception is the lack of
+multicharacter support. It has some optional POSIX extensions like e.g.:
+local variables, support for test -nt/-ot, echo -n</longdescription>
+ <use>
+ <flag name="cripple">Cripple XSI compliance of echo and simultaneously remove echo -n as forced by the ebuild in the main gentoo repository, see bug 590696. This differs from all other shells and breaks expectations of historical scripts like those generated by autoconf-2.13 but can perhaps be useful to check for POSIX-embedded-minimal usage</flag>
+ </use>
</pkgmetadata>
diff --git a/profiles/use.local.desc b/profiles/use.local.desc
index 1cf00c22..cf664f32 100644
--- a/profiles/use.local.desc
+++ b/profiles/use.local.desc
@@ -15,6 +15,7 @@ app-portage/eix:strong-security - Add many checks to prevent exploits if eix cod
app-portage/eix:swap-remote - Swap role of remote addresses in eix-remote, making the data from gpo.zugaina.org the first choice.
app-portage/eix:tools - Create separate binary for script helper tools; useful if they are called extremely often
app-shells/auto-fu-zsh:compile - Byte-compile to speed up. Do not use this if you are cross-compiling
+app-shells/dash:cripple - Cripple XSI compliance of echo and simultaneously remove echo -n as forced by the ebuild in the main gentoo repository, see bug 590696. This differs from all other shells and breaks expectations of historical scripts like those generated by autoconf-2.13 but can perhaps be useful to check for POSIX-embedded-minimal usage
app-shells/schily-tools:renameschily_calc - Rename calc to scalc for compatibility with sci-mathematics/calc
app-shells/schily-tools:renameschily_compare - Rename compare to scompare for compatibility with imagemagick
app-shells/schily-tools:renameschily_count - Rename count to scount for compatibility with sys-devel/llvm