From 54e11238c633592641b75d825ba1f37d131bf317 Mon Sep 17 00:00:00 2001 From: Juan RP Date: Thu, 7 Nov 2013 16:15:47 +0100 Subject: [PATCH] dash: add some patches from debian for random bugfixes. --- ...pon-EOF-CTRL-D-when-run-interactively.diff | 38 ++++++++++++ ...ckslash-before-in-double-quotes-in-va.diff | 37 ++++++++++++ ...-x-as-root-on-platforms-with-old-fash.diff | 60 +++++++++++++++++++ ...-c-command-sh-c-exec-command-optimiza.diff | 29 +++++++++ srcpkgs/dash/template | 4 +- 5 files changed, 166 insertions(+), 2 deletions(-) create mode 100644 srcpkgs/dash/patches/0001-SHELL-print-n-upon-EOF-CTRL-D-when-run-interactively.diff create mode 100644 srcpkgs/dash/patches/0002-PARSER-Remove-backslash-before-in-double-quotes-in-va.diff create mode 100644 srcpkgs/dash/patches/0004-BUILTIN-Fix-test-x-as-root-on-platforms-with-old-fash.diff create mode 100644 srcpkgs/dash/patches/0005-SHELL-Disable-sh-c-command-sh-c-exec-command-optimiza.diff diff --git a/srcpkgs/dash/patches/0001-SHELL-print-n-upon-EOF-CTRL-D-when-run-interactively.diff b/srcpkgs/dash/patches/0001-SHELL-print-n-upon-EOF-CTRL-D-when-run-interactively.diff new file mode 100644 index 00000000000..2b0d0f12f99 --- /dev/null +++ b/srcpkgs/dash/patches/0001-SHELL-print-n-upon-EOF-CTRL-D-when-run-interactively.diff @@ -0,0 +1,38 @@ +From a27b4523bd003b37e9a5a2b5a1b3cedee4f701c7 Mon Sep 17 00:00:00 2001 +From: Gerrit Pape +Date: Wed, 11 Feb 2009 01:38:49 +0000 +Subject: [SHELL] print \n upon EOF (CTRL-D) when run interactively + +Suggested by jidanni through + http://bugs.debian.org/476422 + +Signed-off-by: Gerrit Pape +Signed-off-by: Jonathan Nieder +--- + src/main.c | 9 ++++++++- + 1 files changed, 8 insertions(+), 1 deletions(-) + +diff --git a/src/main.c b/src/main.c +index af987c6c..65e236be 100644 +--- src/main.c ++++ src/main.c +@@ -227,8 +227,15 @@ cmdloop(int top) + if (!top || numeof >= 50) + break; + if (!stoppedjobs()) { +- if (!Iflag) ++ if (!Iflag) { ++ if (iflag) { ++ out2c('\n'); ++#ifdef FLUSHERR ++ flushout(out2); ++#endif ++ } + break; ++ } + out2str("\nUse \"exit\" to leave shell.\n"); + } + numeof++; +-- +1.7.6 + diff --git a/srcpkgs/dash/patches/0002-PARSER-Remove-backslash-before-in-double-quotes-in-va.diff b/srcpkgs/dash/patches/0002-PARSER-Remove-backslash-before-in-double-quotes-in-va.diff new file mode 100644 index 00000000000..8142914d71b --- /dev/null +++ b/srcpkgs/dash/patches/0002-PARSER-Remove-backslash-before-in-double-quotes-in-va.diff @@ -0,0 +1,37 @@ +From 1ed728ca0ea91cac348e1baf070399df5d575115 Mon Sep 17 00:00:00 2001 +From: Jilles Tjoelker +Date: Sun, 21 Nov 2010 14:42:22 +0100 +Subject: [PARSER] Remove backslash before } in double-quotes in variable + +The backslash prevents the closing brace from terminating the +substitution, therefore it should be removed. + +FreeBSD sh test expansion/plus-minus2.0 starts working, no other tests +are affected. + +Example: + printf "%s\n" ${$+\}} ${$+"\}"} "${$+\}}" +should print } three times, without backslashes. + +Signed-off-by: Jonathan Nieder +--- + src/parser.c | 3 +++ + 1 files changed, 3 insertions(+), 0 deletions(-) + +diff --git a/src/parser.c b/src/parser.c +index 6de27629..4fa8c6d4 100644 +--- src/parser.c ++++ src/parser.c +@@ -926,6 +926,9 @@ readtoken1(int firstc, char const *syntax, char *eofmark, int striptabs) + c != '$' && ( + c != '"' || + eofmark != NULL ++ ) && ( ++ c != '}' || ++ varnest == 0 + ) + ) { + USTPUTC('\\', out); +-- +1.7.6 + diff --git a/srcpkgs/dash/patches/0004-BUILTIN-Fix-test-x-as-root-on-platforms-with-old-fash.diff b/srcpkgs/dash/patches/0004-BUILTIN-Fix-test-x-as-root-on-platforms-with-old-fash.diff new file mode 100644 index 00000000000..d5d43d27483 --- /dev/null +++ b/srcpkgs/dash/patches/0004-BUILTIN-Fix-test-x-as-root-on-platforms-with-old-fash.diff @@ -0,0 +1,60 @@ +From 7df60e06e6a176e2ee177df015d5e7ecc80ed229 Mon Sep 17 00:00:00 2001 +From: Jonathan Nieder +Date: Mon, 26 Sep 2011 16:16:37 -0500 +Subject: [BUILTIN] Fix "test -x" as root on platforms with old-fashioned + faccessat() +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +When dash switched from its own emulation to the true faccessat in +v0.5.7~54 (2010-04-02), on some platforms (e.g., old versions of +glibc-bsd), "test -x " started returning true on all files when +run as root. This violates POSIX.1-2008 ยง4.4 "File Access +Permission", which says: + + If execute permission is requested, access shall be granted + if execute permission is granted to at least one user by the + file permission bits or by an alternate access control + mechanism; otherwise, access shall be denied. + +Unfortunately, for historical reasons, access() and faccessat() are +allowed by POSIX to return success for X_OK when the current process +is privileged even when the above condition is not fulfilled and +actual execution would fail. Work around this by checking the +permissions bits when mode == X_OK and geteuid() == 0. + +Reported-by: Christoph Egger +Analysis-by: Petr Salinger +Signed-off-by: Jonathan Nieder +--- + src/bltin/test.c | 11 +++++++++++ + 1 files changed, 11 insertions(+), 0 deletions(-) + +diff --git a/src/bltin/test.c b/src/bltin/test.c +index 90135e14..1093b59f 100644 +--- src/bltin/test.c ++++ src/bltin/test.c +@@ -485,8 +485,19 @@ equalf (const char *f1, const char *f2) + } + + #ifdef HAVE_FACCESSAT ++static int has_exec_bit_set(const char *path) ++{ ++ struct stat64 st; ++ ++ if (stat64(path, &st)) ++ return 0; ++ return st.st_mode & (S_IXUSR | S_IXGRP | S_IXOTH); ++} ++ + static int test_file_access(const char *path, int mode) + { ++ if (mode == X_OK && geteuid() == 0 && !has_exec_bit_set(path)) ++ return 0; + return !faccessat(AT_FDCWD, path, mode, AT_EACCESS); + } + #else /* HAVE_FACCESSAT */ +-- +1.7.7.rc1 + diff --git a/srcpkgs/dash/patches/0005-SHELL-Disable-sh-c-command-sh-c-exec-command-optimiza.diff b/srcpkgs/dash/patches/0005-SHELL-Disable-sh-c-command-sh-c-exec-command-optimiza.diff new file mode 100644 index 00000000000..d0522e0e968 --- /dev/null +++ b/srcpkgs/dash/patches/0005-SHELL-Disable-sh-c-command-sh-c-exec-command-optimiza.diff @@ -0,0 +1,29 @@ +From dd3282f27eadb2f3de1c6910895c3834163a958c Mon Sep 17 00:00:00 2001 +From: Jonathan Nieder +Date: Mon, 26 Sep 2011 16:30:15 -0500 +Subject: [SHELL] Disable sh -c "command" -> sh -c "exec command" optimization + +It is causing ocamlbuild and the darcs testsuite to fail. Back it +out until we understand the problem better. + +Signed-off-by: Jonathan Nieder +--- + src/main.c | 2 +- + 1 files changed, 1 insertions(+), 1 deletions(-) + +diff --git a/src/main.c b/src/main.c +index 65e236be..1614ffbb 100644 +--- src/main.c ++++ src/main.c +@@ -171,7 +171,7 @@ state2: + state3: + state = 4; + if (minusc) +- evalstring(minusc, sflag ? 0 : EV_EXIT); ++ evalstring(minusc, 0); + + if (sflag || minusc == NULL) { + state4: /* XXX ??? - why isn't this before the "if" statement */ +-- +1.7.7.rc1 + diff --git a/srcpkgs/dash/template b/srcpkgs/dash/template index 26443da3124..2d7b806782d 100644 --- a/srcpkgs/dash/template +++ b/srcpkgs/dash/template @@ -1,7 +1,7 @@ # Template file for 'dash' pkgname=dash version=0.5.7 -revision=6 +revision=7 build_style=gnu-configure hostmakedepends="bison coreutils" short_desc="POSIX-compliant Unix shell, much smaller than GNU bash" @@ -19,6 +19,6 @@ dash_package() { register_shell="/bin/sh" depends="coreutils" pkg_install() { - vmove usr + vmove all } }