From 14e7d1b39e68a665fa3f0820447c8d691cf250318eefaef87f0986977398a2e5 Mon Sep 17 00:00:00 2001 From: OBS User autobuild Date: Thu, 18 Feb 2010 13:38:26 +0000 Subject: [PATCH] Accepting request 32541 from shells Copy from shells/dash based on submit request 32541 from user gberh OBS-URL: https://build.opensuse.org/request/show/32541 OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/dash?expand=0&rev=1 --- .gitattributes | 23 +++++ .gitignore | 1 + ...rect-manpage-description-and-history.patch | 64 +++++++++++++ ...se-stderr-when-dev-tty-fails-to-open.patch | 29 ++++++ ....5.1-fix-incorrect-savefd-conversion.patch | 96 +++++++++++++++++++ dash-0.5.5.1-fix-parameter-expansion.patch | 77 +++++++++++++++ dash-0.5.5.1.tar.gz | 3 + dash.changes | 10 ++ dash.spec | 75 +++++++++++++++ ready | 0 10 files changed, 378 insertions(+) create mode 100644 .gitattributes create mode 100644 .gitignore create mode 100644 dash-0.5.5.1-correct-manpage-description-and-history.patch create mode 100644 dash-0.5.5.1-do-not-close-stderr-when-dev-tty-fails-to-open.patch create mode 100644 dash-0.5.5.1-fix-incorrect-savefd-conversion.patch create mode 100644 dash-0.5.5.1-fix-parameter-expansion.patch create mode 100644 dash-0.5.5.1.tar.gz create mode 100644 dash.changes create mode 100644 dash.spec create mode 100644 ready diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..9b03811 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,23 @@ +## Default LFS +*.7z filter=lfs diff=lfs merge=lfs -text +*.bsp filter=lfs diff=lfs merge=lfs -text +*.bz2 filter=lfs diff=lfs merge=lfs -text +*.gem filter=lfs diff=lfs merge=lfs -text +*.gz filter=lfs diff=lfs merge=lfs -text +*.jar filter=lfs diff=lfs merge=lfs -text +*.lz filter=lfs diff=lfs merge=lfs -text +*.lzma filter=lfs diff=lfs merge=lfs -text +*.obscpio filter=lfs diff=lfs merge=lfs -text +*.oxt filter=lfs diff=lfs merge=lfs -text +*.pdf filter=lfs diff=lfs merge=lfs -text +*.png filter=lfs diff=lfs merge=lfs -text +*.rpm filter=lfs diff=lfs merge=lfs -text +*.tbz filter=lfs diff=lfs merge=lfs -text +*.tbz2 filter=lfs diff=lfs merge=lfs -text +*.tgz filter=lfs diff=lfs merge=lfs -text +*.ttf filter=lfs diff=lfs merge=lfs -text +*.txz filter=lfs diff=lfs merge=lfs -text +*.whl filter=lfs diff=lfs merge=lfs -text +*.xz filter=lfs diff=lfs merge=lfs -text +*.zip filter=lfs diff=lfs merge=lfs -text +*.zst filter=lfs diff=lfs merge=lfs -text diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..57affb6 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +.osc diff --git a/dash-0.5.5.1-correct-manpage-description-and-history.patch b/dash-0.5.5.1-correct-manpage-description-and-history.patch new file mode 100644 index 0000000..7a74344 --- /dev/null +++ b/dash-0.5.5.1-correct-manpage-description-and-history.patch @@ -0,0 +1,64 @@ +From: Gerrit Pape +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 +Signed-off-by: Herbert Xu +--- + +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. diff --git a/dash-0.5.5.1-do-not-close-stderr-when-dev-tty-fails-to-open.patch b/dash-0.5.5.1-do-not-close-stderr-when-dev-tty-fails-to-open.patch new file mode 100644 index 0000000..a3a26d7 --- /dev/null +++ b/dash-0.5.5.1-do-not-close-stderr-when-dev-tty-fails-to-open.patch @@ -0,0 +1,29 @@ +From: Herbert Xu +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 +--- + +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 */ diff --git a/dash-0.5.5.1-fix-incorrect-savefd-conversion.patch b/dash-0.5.5.1-fix-incorrect-savefd-conversion.patch new file mode 100644 index 0000000..5223a21 --- /dev/null +++ b/dash-0.5.5.1-fix-incorrect-savefd-conversion.patch @@ -0,0 +1,96 @@ +From: Herbert Xu +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 +--- + +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); + diff --git a/dash-0.5.5.1-fix-parameter-expansion.patch b/dash-0.5.5.1-fix-parameter-expansion.patch new file mode 100644 index 0000000..01d1b3e --- /dev/null +++ b/dash-0.5.5.1-fix-parameter-expansion.patch @@ -0,0 +1,77 @@ +From: Herbert Xu +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 +--- + +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); diff --git a/dash-0.5.5.1.tar.gz b/dash-0.5.5.1.tar.gz new file mode 100644 index 0000000..2ea7e20 --- /dev/null +++ b/dash-0.5.5.1.tar.gz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:1c6717a1014c73aa16bc78a4767f1e00b40ff2a01a6c2cf2cce9a5335c24493f +size 208094 diff --git a/dash.changes b/dash.changes new file mode 100644 index 0000000..5fb9fdd --- /dev/null +++ b/dash.changes @@ -0,0 +1,10 @@ +------------------------------------------------------------------- +Sat Feb 13 12:00:22 UTC 2010 - guido+opensuse.org@berhoerster.name + +- do not provide ash + +------------------------------------------------------------------- +Sat Feb 13 11:06:54 UTC 2010 - guido+opensuse.org@berhoerster.name + +- initial packaging of dash + diff --git a/dash.spec b/dash.spec new file mode 100644 index 0000000..0adf7d6 --- /dev/null +++ b/dash.spec @@ -0,0 +1,75 @@ +# +# spec file for package dash (Version 0.5.5.1) +# +# Copyright (c) 2010 SUSE LINUX Products GmbH, Nuernberg, Germany. +# +# All modifications and additions to the file contributed by third parties +# remain the property of their copyright owners, unless otherwise agreed +# upon. The license for this file, and modifications and additions to the +# file, is the same license as for the pristine package itself (unless the +# license for the pristine package is not an Open Source License, in which +# case the license is the MIT License). An "Open Source License" is a +# license that conforms to the Open Source Definition (Version 1.9) +# published by the Open Source Initiative. + +# Please submit bugfixes or comments via http://bugs.opensuse.org/ +# + + + +Name: dash +Summary: POSIX-compliant Implementation of /bin/sh +Version: 0.5.5.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 +Url: http://gondor.apana.org.au/~herbert/dash/ +BuildRoot: %{_tmppath}/%{name}-%{version}-build + +%description +DASH is a POSIX-compliant implementation of /bin/sh that aims to be as small as +possible without sacrificing speed where possible. + + +Authors: +-------- + The Regents of the University of California + Christos Zoulas + Herbert Xu + + +%prep +%setup -q +%patch0 -p1 +%patch1 -p1 +%patch2 -p1 +%patch3 -p1 + +%build +%configure --prefix=%{_prefix} --mandir=%{_mandir} +make + +%install +make DESTDIR=$RPM_BUILD_ROOT install +# move to /bin and symlink to /usr/bin +%__mkdir_p $RPM_BUILD_ROOT/bin +%__mv $RPM_BUILD_ROOT/usr/bin/dash $RPM_BUILD_ROOT/bin +%__ln_s ../../bin/dash $RPM_BUILD_ROOT/usr/bin/dash + +%clean +rm -rf $RPM_BUILD_ROOT + +%files +%defattr(-,root,root,-) +%doc ChangeLog +%doc %{_mandir}/man1/dash.1* +/usr/bin/dash +/bin/dash + +%changelog diff --git a/ready b/ready new file mode 100644 index 0000000..473a0f4