Accepting request 43876 from shells

Copy from shells/dash based on submit request 43876 from user gberh

OBS-URL: https://build.opensuse.org/request/show/43876
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/dash?expand=0&rev=6
This commit is contained in:
OBS User autobuild 2010-08-02 08:23:52 +00:00 committed by Git OBS Bridge
parent 8d38a4ed45
commit 5c7758eb7f
8 changed files with 13 additions and 281 deletions

View File

@ -1,64 +0,0 @@
From: Gerrit Pape <pape@smarden.org>
Date: Sat, 23 May 2009 02:05:15 +0000 (+0800)
Subject: [MAN] Update manual page to differentiate dash from ash
X-Git-Url: http://git.kernel.org/?p=utils%2Fdash%2Fdash.git;a=commitdiff_plain;h=956b4bd209a9d17613e419e2b50e0f533600497b
[MAN] Update manual page to differentiate dash from ash
Rename sh to dash in the header and synopsis; remove reference to the
4.4 BSD release in the description, and replace the history information
with a reference to NetBSD's ash.
Suggested by jaalto through
http://bugs.debian.org/499838
Signed-off-by: Gerrit Pape <pape@smarden.org>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
---
diff --git a/src/dash.1 b/src/dash.1
index 5a8e2fe..c7771d0 100644
--- a/src/dash.1
+++ b/src/dash.1
@@ -34,9 +34,9 @@
.\"
.Dd January 19, 2003
.Os
-.Dt SH 1
+.Dt DASH 1
.Sh NAME
-.Nm sh
+.Nm dash
.Nd command interpreter (shell)
.Sh SYNOPSIS
.Nm
@@ -93,9 +93,6 @@ but it is not a Korn shell clone (see
Only features designated by
.Tn POSIX ,
plus a few Berkeley extensions, are being incorporated into this shell.
-We expect
-.Tn POSIX
-conformance by the time 4.4 BSD is released.
This man page is not intended
to be a tutorial or a complete specification of the shell.
.Ss Overview
@@ -2333,11 +2330,15 @@ The process ID of the parent process of the shell.
.Xr environ 7 ,
.Xr sysctl 8
.Sh HISTORY
-A
.Nm
-command appeared in
-.At v1 .
-It was, however, unmaintainable so we wrote this one.
+is a POSIX-compliant implementation of /bin/sh that aims to be as small as
+possible.
+.Nm
+is a direct descendant of the NetBSD version of ash (the Almquist SHell),
+ported to Linux in early 1997.
+It was renamed to
+.Nm
+in 2002.
.Sh BUGS
Setuid shell scripts should be avoided at all costs, as they are a
significant security risk.

View File

@ -1,29 +0,0 @@
From: Herbert Xu <herbert@gondor.apana.org.au>
Date: Sun, 22 Feb 2009 11:29:48 +0000 (+0800)
Subject: [JOBS] Do not close stderr when /dev/tty fails to open
X-Git-Url: http://git.kernel.org/?p=utils%2Fdash%2Fdash.git;a=commitdiff_plain;h=fcc4134a7b76d82d39dea635c41ec593a41d6d19
[JOBS] Do not close stderr when /dev/tty fails to open
As it stands if we fail to open /dev/tty we end up closing stderr
after saving it at a higher fd.
Thanks to David van Gorkom for reporting this.
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
---
diff --git a/src/jobs.c b/src/jobs.c
index 69a84f7..b1ab7ab 100644
--- a/src/jobs.c
+++ b/src/jobs.c
@@ -195,6 +195,9 @@ setjobctl(int on)
while (!isatty(fd))
if (--fd < 0)
goto out;
+ fd = dup(fd);
+ if (fd < 0)
+ goto out;
}
fd = savefd(fd);
do { /* while we are in the background */

View File

@ -1,96 +0,0 @@
From: Herbert Xu <herbert@gondor.apana.org.au>
Date: Sat, 27 Jun 2009 12:38:23 +0000 (+0800)
Subject: [REDIR] Fix incorrect savefd conversions
X-Git-Url: http://git.kernel.org/?p=utils%2Fdash%2Fdash.git;a=commitdiff_plain;h=6c0398654015de53269a2ef32eae3c7b560875dd
[REDIR] Fix incorrect savefd conversions
When I added savefd we may end up closing stderr if that is how
we get to the tty. This patch fixes by adding a second argument
to indicate what fd should be closed which lets jobs.c get around
the problem.
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
---
diff --git a/src/input.c b/src/input.c
index 27c4fd1..1e198e9 100644
--- a/src/input.c
+++ b/src/input.c
@@ -410,7 +410,7 @@ setinputfile(const char *fname, int flags)
sh_error("Can't open %s", fname);
}
if (fd < 10)
- fd = savefd(fd);
+ fd = savefd(fd, fd);
setinputfd(fd, flags & INPUT_PUSH_FILE);
out:
INTON;
diff --git a/src/jobs.c b/src/jobs.c
index b1ab7ab..a4fada0 100644
--- a/src/jobs.c
+++ b/src/jobs.c
@@ -189,17 +189,15 @@ setjobctl(int on)
if (on == jobctl || rootshell == 0)
return;
if (on) {
- fd = open(_PATH_TTY, O_RDWR);
+ int ofd;
+ ofd = fd = open(_PATH_TTY, O_RDWR);
if (fd < 0) {
fd += 3;
while (!isatty(fd))
if (--fd < 0)
goto out;
- fd = dup(fd);
- if (fd < 0)
- goto out;
}
- fd = savefd(fd);
+ fd = savefd(fd, ofd);
do { /* while we are in the background */
if ((pgrp = tcgetpgrp(fd)) < 0) {
out:
diff --git a/src/redir.c b/src/redir.c
index ce34db0..b01237d 100644
--- a/src/redir.c
+++ b/src/redir.c
@@ -145,7 +145,7 @@ redirect(union node *redir, int flags)
if (likely(i == EMPTY)) {
i = CLOSED;
if (fd != newfd) {
- i = savefd(fd);
+ i = savefd(fd, fd);
fd = -1;
}
}
@@ -399,7 +399,7 @@ RESET {
*/
int
-savefd(int from)
+savefd(int from, int ofd)
{
int newfd;
int err;
@@ -407,7 +407,7 @@ savefd(int from)
newfd = fcntl(from, F_DUPFD, 10);
err = newfd < 0 ? errno : 0;
if (err != EBADF) {
- close(from);
+ close(ofd);
if (err)
sh_error("%d: %s", from, strerror(err));
else
diff --git a/src/redir.h b/src/redir.h
index a8e6630..d1d160e 100644
--- a/src/redir.h
+++ b/src/redir.h
@@ -45,6 +45,6 @@ union node;
void redirect(union node *, int);
void popredir(int);
void clearredir(void);
-int savefd(int);
+int savefd(int, int);
int redirectsafe(union node *, int);

View File

@ -1,77 +0,0 @@
From: Herbert Xu <herbert@gondor.apana.org.au>
Date: Sat, 27 Jun 2009 13:00:39 +0000 (+0800)
Subject: [EXPAND] Fix quoted pattern patch breakage
X-Git-Url: http://git.kernel.org/?p=utils%2Fdash%2Fdash.git;a=commitdiff_plain;h=0d7d66039b614b642c775432fd64aa8c11f9a64d
[EXPAND] Fix quoted pattern patch breakage
The change
[EXPAND] Do not quote back slashes in parameter expansions outside quotes
broke quote removal after parameter expansion. This is because
its effecte extended beyond that of quoted patterns.
This patch fixes this by limiting the change to just quoted
patterns.
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
---
diff --git a/src/expand.c b/src/expand.c
index e4c4c8b..7995d40 100644
--- a/src/expand.c
+++ b/src/expand.c
@@ -869,7 +869,9 @@ memtodest(const char *p, size_t len, const char *syntax, int quotes) {
int c = (signed char)*p++;
if (c) {
if ((quotes & QUOTES_ESC) &&
- (syntax[c] == CCTL || syntax[c] == CDBACK))
+ ((syntax[c] == CCTL) ||
+ (((quotes & EXP_FULL) || syntax != BASESYNTAX) &&
+ syntax[c] == CBACK)))
USTPUTC(CTLESC, q);
} else if (!(quotes & QUOTES_KEEPNUL))
continue;
diff --git a/src/mksyntax.c b/src/mksyntax.c
index 9ecbb45..7a8a9ae 100644
--- a/src/mksyntax.c
+++ b/src/mksyntax.c
@@ -53,7 +53,6 @@ struct synclass synclass[] = {
{ "CWORD", "character is nothing special" },
{ "CNL", "newline character" },
{ "CBACK", "a backslash character" },
- { "CDBACK", "a backslash character in double quotes" },
{ "CSQUOTE", "single quote" },
{ "CDQUOTE", "double quote" },
{ "CENDQUOTE", "a terminating quote" },
@@ -176,7 +175,7 @@ main(int argc, char **argv)
init();
fputs("\n/* syntax table used when in double quotes */\n", cfile);
add("\n", "CNL");
- add("\\", "CDBACK");
+ add("\\", "CBACK");
add("\"", "CENDQUOTE");
add("`", "CBQUOTE");
add("$", "CVAR");
@@ -194,7 +193,7 @@ main(int argc, char **argv)
init();
fputs("\n/* syntax table used when in arithmetic */\n", cfile);
add("\n", "CNL");
- add("\\", "CDBACK");
+ add("\\", "CBACK");
add("`", "CBQUOTE");
add("$", "CVAR");
add("}", "CENDVAR");
diff --git a/src/parser.c b/src/parser.c
index dad1037..28a46c0 100644
--- a/src/parser.c
+++ b/src/parser.c
@@ -901,7 +901,6 @@ readtoken1(int firstc, char const *syntax, char *eofmark, int striptabs)
break;
/* backslash */
case CBACK:
- case CDBACK:
c = pgetc2();
if (c == PEOF) {
USTPUTC(CTLESC, out);

View File

@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:1c6717a1014c73aa16bc78a4767f1e00b40ff2a01a6c2cf2cce9a5335c24493f
size 208094

3
dash-0.5.6.1.tar.bz2 Normal file
View File

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:8737ae474532742d44cfd9809add7719df897f3677a5753db46c174705dd9913
size 167245

View File

@ -1,3 +1,9 @@
-------------------------------------------------------------------
Mon Jul 19 10:57:38 UTC 2010 - guido+opensuse.org@berhoerster.name
- update to version 0.5.6.1
- bugfixes
-------------------------------------------------------------------
Fri Feb 19 11:47:33 UTC 2010 - guido+opensuse.org@berhoerster.name

View File

@ -1,5 +1,5 @@
#
# spec file for package dash (Version 0.5.5.1)
# spec file for package dash (Version 0.5.6.1)
#
# Copyright (c) 2010 SUSE LINUX Products GmbH, Nuernberg, Germany.
# Copyright (c) 2010 Guido Berhoerster.
@ -20,16 +20,12 @@
Name: dash
Summary: POSIX-compliant Implementation of /bin/sh
Version: 0.5.5.1
Release: 2
Version: 0.5.6.1
Release: 1
License: BSD3c
Group: System/Shells
AutoReqProv: on
Source: http://gondor.apana.org.au/~herbert/dash/files/dash-%{version}.tar.gz
Patch0: %{name}-0.5.5.1-do-not-close-stderr-when-dev-tty-fails-to-open.patch
Patch1: %{name}-0.5.5.1-correct-manpage-description-and-history.patch
Patch2: %{name}-0.5.5.1-fix-incorrect-savefd-conversion.patch
Patch3: %{name}-0.5.5.1-fix-parameter-expansion.patch
Source: dash-%{version}.tar.bz2
Url: http://gondor.apana.org.au/~herbert/dash/
BuildRoot: %{_tmppath}/%{name}-%{version}-build
@ -47,10 +43,6 @@ Authors:
%prep
%setup -q
%patch0 -p1
%patch1 -p1
%patch2 -p1
%patch3 -p1
%build
%configure