dash: add some patches from debian for random bugfixes.

This commit is contained in:
Juan RP 2013-11-07 16:15:47 +01:00
parent f3072d1d3b
commit 54e11238c6
5 changed files with 166 additions and 2 deletions

View File

@ -0,0 +1,38 @@
From a27b4523bd003b37e9a5a2b5a1b3cedee4f701c7 Mon Sep 17 00:00:00 2001
From: Gerrit Pape <pape@smarden.org>
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 <pape@smarden.org>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
---
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

View File

@ -0,0 +1,37 @@
From 1ed728ca0ea91cac348e1baf070399df5d575115 Mon Sep 17 00:00:00 2001
From: Jilles Tjoelker <jilles@stack.nl>
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 <jrnieder@gmail.com>
---
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

View File

@ -0,0 +1,60 @@
From 7df60e06e6a176e2ee177df015d5e7ecc80ed229 Mon Sep 17 00:00:00 2001
From: Jonathan Nieder <jrnieder@gmail.com>
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 <path>" 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 <christoph@debian.org>
Analysis-by: Petr Salinger <Petr.Salinger@seznam.cz>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
---
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

View File

@ -0,0 +1,29 @@
From dd3282f27eadb2f3de1c6910895c3834163a958c Mon Sep 17 00:00:00 2001
From: Jonathan Nieder <jrnieder@gmail.com>
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 <jrnieder@gmail.com>
---
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

View File

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