Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

PATCH: Re: Backticks In zshenv



On Oct 20,  9:55am, Bart Schaefer wrote:
} Subject: Re: Backticks In zshenv
}
} I suspect zsh is getting some kind of a signal -- perhaps SIGWINCH? --
} which is interrupting the read on the command substitution.

The /etc/zshenv on the RH5.1 machine now looks (in part) like this:

##
for i in {23..31}; do trap "echo caught signal $i" $i; done

if [ `id -u` -eq 0 ]; then
  path=(/sbin /usr/sbin)
fi

# ... some other stuff ...

trap - {23..31}
##

(BTW, DON'T try this without the "trap -", or zsh can go into an infinite
loop; I haven't tracked *that* down, but it seems to be SIGWINCH-related
as well.)

When I rlogin to that machine, I see:

caught signal 28
/etc/zshenv: parse error: condition expected: -eq [14]

I'm now 99% certain that the SIGWINCH is causing read() to fail with EINTR
during the fgetc() in readoutput() in exec.c.

I'm unable to adequately test the following patch at the moment, as it's
inconvenient to muck with the shells on the RH5.1 machine, but it doesn't
break anything obvious on my RH4.2 machine at home.  If anyone has time to
try this out, please tell the list whether it works.

Index: Src/exec.c
===================================================================
RCS file: /extra/cvsroot/zsh/zsh-3.0/Src/exec.c,v
retrieving revision 1.4
diff -c -r1.4 exec.c
*** exec.c	1997/06/27 19:57:19	1.4
--- exec.c	1998/10/20 19:46:11
***************
*** 2104,2110 ****
      fin = fdopen(in, "r");
      ret = newlinklist();
      ptr = buf = (char *) ncalloc(bsiz = 64);
!     while ((c = fgetc(fin)) != EOF) {
  	if (imeta(c)) {
  	    *ptr++ = Meta;
  	    c ^= 32;
--- 2104,2115 ----
      fin = fdopen(in, "r");
      ret = newlinklist();
      ptr = buf = (char *) ncalloc(bsiz = 64);
!     while ((c = fgetc(fin)) != EOF || errno == EINTR) {
! 	if (c == EOF) {
! 	    errno = 0;
! 	    clearerr(fin);
! 	    continue;
! 	}
  	if (imeta(c)) {
  	    *ptr++ = Meta;
  	    c ^= 32;


-- 
Bart Schaefer                                 Brass Lantern Enterprises
http://www.well.com/user/barts              http://www.brasslantern.com



Messages sorted by: Reverse Date, Date, Thread, Author