- Fix a crash when reading scripts with multibyte characters (#183267)

- Block SIGINT while waiting for children (#177366)
This commit is contained in:
Miloslav Trmac 2006-03-18 03:19:31 +00:00
parent 8d6eb0008a
commit 5533df3a65
3 changed files with 96 additions and 1 deletions

60
tcsh-6.14.00-sigint.patch Normal file
View File

@ -0,0 +1,60 @@
--- tcsh-6.14.00/sh.proc.c.sigint 2006-02-19 05:07:32.000000000 +0100
+++ tcsh-6.14.00/sh.proc.c 2006-02-19 05:29:52.000000000 +0100
@@ -543,9 +543,7 @@
{
struct process *fp;
int jobflags, reason;
-#ifdef BSDSIGS
- sigmask_t omask;
-#endif /* BSDSIGS */
+ sigset_t omask, pause_mask;
#ifdef UNRELSIGS
signalfun_t inthandler;
#endif /* UNRELSIGS */
@@ -562,17 +560,16 @@
* target process, or any of its friends, are running
*/
fp = pp;
-#ifdef BSDSIGS
- omask = sigblock(sigmask(SIGCHLD));
-#endif /* BSDSIGS */
+ sigprocmask(SIG_BLOCK, NULL, &omask);
+ sighold(SIGINT);
+ sigprocmask(SIG_BLOCK, NULL, &pause_mask);
+ sighold(SIGCHLD);
+ sigdelset(&pause_mask, SIGCHLD);
#ifdef UNRELSIGS
if (setintr)
inthandler = signal(SIGINT, SIG_IGN);
#endif /* UNRELSIGS */
for (;;) {
-#ifndef BSDSIGS
- (void) sighold(SIGCHLD);
-#endif /* !BSDSIGS */
jobflags = 0;
do
jobflags |= fp->p_flags;
@@ -583,21 +580,12 @@
xprintf("%d starting to sigpause for SIGCHLD on %d\n",
getpid(), fp->p_procid);
#endif /* JOBDEBUG */
-#ifdef BSDSIGS
- /* (void) sigpause(sigblock((sigmask_t) 0) &~ sigmask(SIGCHLD)); */
- (void) sigpause(omask & ~sigmask(SIGCHLD));
-#else /* !BSDSIGS */
- (void) sigpause(SIGCHLD);
-#endif /* !BSDSIGS */
+ sigsuspend(&pause_mask);
}
#ifdef JOBDEBUG
xprintf("%d returned from sigpause loop\n", getpid());
#endif /* JOBDEBUG */
-#ifdef BSDSIGS
- (void) sigsetmask(omask);
-#else /* !BSDSIGS */
- (void) sigrelse(SIGCHLD);
-#endif /* !BSDSIGS */
+ sigprocmask(SIG_SETMASK, &omask, NULL);
#ifdef UNRELSIGS
if (setintr)
(void) signal(SIGINT, inthandler);

View File

@ -0,0 +1,27 @@
--- tcsh-6.14.00/sh.lex.c.wide-crash 2006-02-28 03:34:58.000000000 +0100
+++ tcsh-6.14.00/sh.lex.c 2006-02-28 03:35:31.000000000 +0100
@@ -1710,13 +1710,13 @@
break;
partial += r;
i = 0;
- while (i < partial) {
+ while (i < partial && nchars != 0) {
int len;
len = normal_mbtowc(buf + res, cbuf + i, partial - i);
if (len == -1) {
reset_mbtowc();
- if (partial < MB_LEN_MAX && r > 0)
+ if (partial - i < MB_LEN_MAX && r > 0)
/* Maybe a partial character and there is still a chance
to read more */
break;
@@ -1735,7 +1735,7 @@
if (i != partial)
memmove(cbuf, cbuf + i, partial - i);
partial -= i;
- } while (partial != 0);
+ } while (partial != 0 && nchars != 0);
/* Throwing away possible partial multibyte characters on error */
return res != 0 ? res : r;
}

View File

@ -3,7 +3,7 @@
Summary: An enhanced version of csh, the C shell.
Name: tcsh
Version: 6.14
Release: 5.2.1
Release: 7
License: distributable
Group: System Environment/Shells
Source: ftp://ftp.astron.com/pub/tcsh/tcsh-%{version}.00.tar.gz
@ -13,6 +13,8 @@ Patch2: tcsh-6.14.00-iconv.patch
Patch3: tcsh-6.14.00-lsF.patch
Patch4: tcsh-6.14.00-dashn.patch
Patch5: tcsh-6.14.00-read.patch
Patch6: tcsh-6.14.00-sigint.patch
Patch7: tcsh-6.14.00-wide-crash.patch
Provides: csh = %{version}
Prereq: fileutils, grep
URL: http://www.tcsh.org/
@ -35,6 +37,8 @@ like syntax.
%patch3 -p1 -b .lsF
%patch4 -p1 -b .dashn
%patch5 -p1 -b .read
%patch6 -p1 -b .sigint
%patch7 -p1 -b .wide-crash
nroff -me eight-bit.me > eight-bit.txt
@ -102,6 +106,10 @@ fi
%{_mandir}/*/*
%changelog
* Sat Mar 18 2006 Miloslav Trmac <mitr@redhat.com> - 6.14-7
- Fix a crash when reading scripts with multibyte characters (#183267)
- Block SIGINT while waiting for children (#177366)
* Fri Feb 10 2006 Jesse Keating <jkeating@redhat.com> - 6.14-5.2.1
- bump again for double-long bug on ppc(64)