rpms/mksh/devel mksh-39c-dblalias.patch, NONE, 1.1 mksh-39c-fixsetx.patch, NONE, 1.1 mksh.spec, 1.29, 1.30
Michal Hlavinka
mhlavink at fedoraproject.org
Wed Jul 21 13:04:16 UTC 2010
Author: mhlavink
Update of /cvs/pkgs/rpms/mksh/devel
In directory cvs01.phx2.fedoraproject.org:/tmp/cvs-serv2721
Modified Files:
mksh.spec
Added Files:
mksh-39c-dblalias.patch mksh-39c-fixsetx.patch
Log Message:
* Wed Jul 21 2010 Michal Hlavinka <mhlavink at redhat.com> 39c-3
- fix crash when alias contains alias
- fix crash when xtrace is enabled
mksh-39c-dblalias.patch:
check.t | 11 +++++++++++
lex.c | 2 +-
2 files changed, 12 insertions(+), 1 deletion(-)
--- NEW FILE mksh-39c-dblalias.patch ---
--- a/check.t 2010/07/19 22:41:01 1.383
+++ b/check.t 2010/07/21 11:31:13 1.384
@@ -184,6 +184,17 @@ stdin:
expected-stdout:
tf
tf
+---
+name: alias-10
+description:
+ Check that recursion is detected/avoided in aliases.
+ Regression, introduced during an old bugfix.
+stdin:
+ alias foo='print hello '
+ alias bar='foo world'
+ echo $(bar)
+expected-stdout:
+ hello world
---
name: arith-lazy-1
description:
--- a/lex.c 2010/07/17 22:09:36 1.116
+++ b/lex.c 2010/07/21 11:31:15 1.117
@@ -1110,7 +1110,7 @@ yylex(int cf)
else {
Source *s = source;
- while (s->flags & SF_HASALIAS)
+ while (s && (s->flags & SF_HASALIAS))
if (s->u.tblp == p)
return (LWORD);
else
mksh-39c-fixsetx.patch:
shf.c | 55 ++++++++++++++++++++++++++++++++++---------------------
1 file changed, 34 insertions(+), 21 deletions(-)
--- NEW FILE mksh-39c-fixsetx.patch ---
--- old/shf.c 2009/11/28 14:28:03 1.35
+++ new/shf.c 2010/07/19 22:41:04 1.36
@@ -636,32 +636,45 @@ shf_write(const char *buf, int nbytes, s
shf->wnleft -= ncopy;
}
if (nbytes > 0) {
- /* Flush deals with strings and sticky errors */
- if (shf_emptybuf(shf, EB_GROW) == EOF)
- return (EOF);
- if (nbytes > shf->wbsize) {
- ncopy = nbytes;
- if (shf->wbsize)
- ncopy -= nbytes % shf->wbsize;
- nbytes -= ncopy;
- while (ncopy > 0) {
- n = write(shf->fd, buf, ncopy);
- if (n < 0) {
- if (errno == EINTR &&
- !(shf->flags & SHF_INTERRUPT))
- continue;
- shf->flags |= SHF_ERROR;
- shf->errno_ = errno;
- shf->wnleft = 0;
- /* Note: fwrite(3S) returns 0 for
- * errors - this doesn't */
+ if (shf->flags & SHF_STRING) {
+ /* resize buffer until there's enough space left */
+ while (nbytes > shf->wnleft)
+ if (shf_emptybuf(shf, EB_GROW) == EOF)
return (EOF);
+ /* then write everything into the buffer */
+ } else {
+ /* flush deals with sticky errors */
+ if (shf_emptybuf(shf, EB_GROW) == EOF)
+ return (EOF);
+ /* write chunks larger than window size directly */
+ if (nbytes > shf->wbsize) {
+ ncopy = nbytes;
+ if (shf->wbsize)
+ ncopy -= nbytes % shf->wbsize;
+ nbytes -= ncopy;
+ while (ncopy > 0) {
+ n = write(shf->fd, buf, ncopy);
+ if (n < 0) {
+ if (errno == EINTR &&
+ !(shf->flags & SHF_INTERRUPT))
+ continue;
+ shf->flags |= SHF_ERROR;
+ shf->errno_ = errno;
+ shf->wnleft = 0;
+ /*
+ * Note: fwrite(3) returns 0
+ * for errors - this doesn't
+ */
+ return (EOF);
+ }
+ buf += n;
+ ncopy -= n;
}
- buf += n;
- ncopy -= n;
}
+ /* ... and buffer the rest */
}
if (nbytes > 0) {
+ /* write remaining bytes to buffer */
memcpy(shf->wp, buf, nbytes);
shf->wp += nbytes;
shf->wnleft -= nbytes;
Index: mksh.spec
===================================================================
RCS file: /cvs/pkgs/rpms/mksh/devel/mksh.spec,v
retrieving revision 1.29
retrieving revision 1.30
diff -u -p -r1.29 -r1.30
--- mksh.spec 11 Jul 2010 18:57:31 -0000 1.29
+++ mksh.spec 21 Jul 2010 13:04:16 -0000 1.30
@@ -3,13 +3,15 @@
Summary: MirBSD enhanced version of the Korn Shell
Name: mksh
Version: 39c
-Release: 2%{?dist}
+Release: 3%{?dist}
# BSD (setmode.c), ISC (strlcpy.c), MirOS (the rest)
License: MirOS and ISC and BSD
Group: System Environment/Shells
URL: http://www.mirbsd.de/%{name}.htm
Source0: http://www.mirbsd.org/MirOS/dist/mir/%{name}/%{name}-R%{version}.cpio.gz
Source1: dot-mkshrc
+Patch1: mksh-39c-fixsetx.patch
+Patch2: mksh-39c-dblalias.patch
Requires(post): grep
Requires(postun): sed
BuildRequires: util-linux, ed
@@ -29,6 +31,12 @@ bourne shell replacement, pdksh successo
gzip -dc %{SOURCE0} | cpio -imd
mv %{name}/* . && rm -rf %{name}
+# from upstream cvs, for mksh < "R39 2010/07/19", rhbz#616771
+%patch1 -p1 -b .fixsetx
+
+# from upstream cvs, for mksh < "R39 2010/07/21", rhbz#616777
+%patch2 -p1 -b .dblalias
+
%build
CFLAGS="$RPM_OPT_FLAGS" sh Build.sh -r -combine
@@ -70,6 +78,10 @@ rm -rf $RPM_BUILD_ROOT
%{_mandir}/man1/%{name}.1*
%changelog
+* Wed Jul 21 2010 Michal Hlavinka <mhlavink at redhat.com> 39c-3
+- fix crash when alias contains alias
+- fix crash when xtrace is enabled
+
* Sun Jul 11 2010 Robert Scheck <robert at fedoraproject.org> 39c-2
- Added default configuration /etc/mkshrc & /etc/skel/.mkshrc
as default skel (like at bash; thanks to Michal Hlavinka)
More information about the scm-commits
mailing list