zsh-users
 help / color / mirror / code / Atom feed
* Backticks In zshenv
@ 1998-10-20 14:35 Daniel Rigal
  1998-10-20 16:55 ` Bart Schaefer
  0 siblings, 1 reply; 6+ messages in thread
From: Daniel Rigal @ 1998-10-20 14:35 UTC (permalink / raw)
  To: zsh-users

Hi Z-Shell users,

I am having a problem which is driving me up the wall! 
Basically, Z-Shell seems to randomly decline to run commands
in backticks in the zshenv (both the central one or the 
user's own zshenv show this effect). The problem only seems 
to occur under some circumstances. The actual thing I am 
trying to do in my zshenv is not important. I can reduce the 
problem to a very trivial example. Allow me to demonstrate...

I put the following lines in my .zshenv:

string="teststring"
echo "string=`echo $string`"
echo "string=`echo $string`"
... [repeating that last line a total of 100 times]

and then I experiment with starting a new shell. Starting
a new shell on the console, or from inside an existing shell, 
is fine. Starting a new Xterm is fine too. However firing up 
a Cmdtool, Shelltool, or DTterm produces random blank lines 
where the command result is not echoed, e.g.:

string=teststring
string=
string=teststring
string=teststring
string=
string=teststring
string=teststring
string=teststring
[and so on]

The error is most likely to happen in the first 5 lines of
output and I have never seen it occur after the first 20
lines so the probability of error seems to fall off with time.

Random behaviour? Clearly we are not in Kansas anymore! 

Has anybody seen anything even remotely like this or know
what to do about it? It is driving me and my colleagues to
distraction! We are running Z-Shell 3.0.5, Solaris 2.6 and
Openwindows 3.6, if that helps.

Any help at all will be gratefully received.

Regards,

Daniel.


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Backticks In zshenv
  1998-10-20 14:35 Backticks In zshenv Daniel Rigal
@ 1998-10-20 16:55 ` Bart Schaefer
  1998-10-20 19:30   ` Phil Pennock
                     ` (3 more replies)
  0 siblings, 4 replies; 6+ messages in thread
From: Bart Schaefer @ 1998-10-20 16:55 UTC (permalink / raw)
  To: Daniel Rigal, zsh-users

On Oct 20,  3:35pm, Daniel Rigal wrote:
} Subject: Backticks In zshenv
}
} I am having a problem which is driving me up the wall! 
} Basically, Z-Shell seems to randomly decline to run commands
} in backticks in the zshenv (both the central one or the 
} user's own zshenv show this effect).

I've just seen the same problem, on a newly-installed RedHat 5.1 Linux
system with the zsh-3.0.5-2 RPM.  The /etc/zshenv file contains

	if [[ `id -u` -eq 0 ]]
	then
	    ...
	fi

and zsh randomly fails to capture the output of `id -u`.  It seems to
occur only when I rapidly exit and immediately log back in; if I wait
any longer than it takes to retype my login and password as fast as I
can, the problem disappears or becomes much more sporadic.

I ended up replacing `id -u` with $EUID and haven't seen any further
problems.  I'd assumed it was something about the "id" program.

I suspect zsh is getting some kind of a signal -- perhaps SIGWINCH? --
which is interrupting the read on the command substitution.

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


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Backticks In zshenv
  1998-10-20 16:55 ` Bart Schaefer
@ 1998-10-20 19:30   ` Phil Pennock
  1998-10-20 19:54   ` PATCH: " Bart Schaefer
                     ` (2 subsequent siblings)
  3 siblings, 0 replies; 6+ messages in thread
From: Phil Pennock @ 1998-10-20 19:30 UTC (permalink / raw)
  To: Bart Schaefer; +Cc: zsh-users

Typing away merrily, Bart Schaefer produced the immortal words:
> I ended up replacing `id -u` with $EUID and haven't seen any further
> problems.  I'd assumed it was something about the "id" program.
> 
> I suspect zsh is getting some kind of a signal -- perhaps SIGWINCH? --
> which is interrupting the read on the command substitution.

This makes sense.  When using zsh on Solaris, with a hack to start it
from /bin/sh, I found that resizing xterms during logon would sometimes
fail to set COLUMNS and LINES; I put this down to the weird setup and
just made sure I didn't resize.

I think it would have been: eval $(resize)

HTH
-- 
--> Phil Pennock ; GAT d- s+:+ a22 C++(++++) UL++++/I+++/S+++/H+ P++@ L+++
E-@ W(+) N>++ o !K w--- O>+ M V !PS PE Y+ PGP+ t-- 5++ X+ R !tv b++>+++ DI+ D+
G+ e+ h* !r y?


^ permalink raw reply	[flat|nested] 6+ messages in thread

* PATCH: Re: Backticks In zshenv
  1998-10-20 16:55 ` Bart Schaefer
  1998-10-20 19:30   ` Phil Pennock
@ 1998-10-20 19:54   ` Bart Schaefer
  1998-10-20 20:36   ` Sweth Chandramouli
  1998-10-21  7:33   ` Goran Larsson
  3 siblings, 0 replies; 6+ messages in thread
From: Bart Schaefer @ 1998-10-20 19:54 UTC (permalink / raw)
  To: Daniel Rigal, zsh-users

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


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Backticks In zshenv
  1998-10-20 16:55 ` Bart Schaefer
  1998-10-20 19:30   ` Phil Pennock
  1998-10-20 19:54   ` PATCH: " Bart Schaefer
@ 1998-10-20 20:36   ` Sweth Chandramouli
  1998-10-21  7:33   ` Goran Larsson
  3 siblings, 0 replies; 6+ messages in thread
From: Sweth Chandramouli @ 1998-10-20 20:36 UTC (permalink / raw)
  To: zsh-users

On Tue, Oct 20, 1998 at 09:55:42AM -0700, Bart Schaefer wrote:
> On Oct 20,  3:35pm, Daniel Rigal wrote:
> } Subject: Backticks In zshenv
> }
> } I am having a problem which is driving me up the wall! 
> } Basically, Z-Shell seems to randomly decline to run commands
> } in backticks in the zshenv (both the central one or the 
> } user's own zshenv show this effect).
> 
> I've just seen the same problem, on a newly-installed RedHat 5.1 Linux
> system with the zsh-3.0.5-2 RPM.  The /etc/zshenv file contains
> 
> 	if [[ `id -u` -eq 0 ]]
> 	then
> 	    ...
> 	fi

	similar problems for about a year in my .zshrc, which prints a welcome 
message parsing the output of `uname -n`; this is running 3.1.4 zsh on solaris 
2.5.1, and 3.0.5 on solaris 2.6.
	it seems like everyone is having problems only during the sourcing of 
startup files.  has anyone had this happen during an interactive shell, after 
startup?
	
	-- sweth.

-- 
Sweth Chandramouli
IS Coordinator, The George Washington University
<sweth@gwu.edu> / (202) 994 - 8521 (V) / (202) 994 - 0458 (F)
<a href="http://astaroth.nit.gwu.edu/~sweth/disc.html">*</a>


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Backticks In zshenv
  1998-10-20 16:55 ` Bart Schaefer
                     ` (2 preceding siblings ...)
  1998-10-20 20:36   ` Sweth Chandramouli
@ 1998-10-21  7:33   ` Goran Larsson
  3 siblings, 0 replies; 6+ messages in thread
From: Goran Larsson @ 1998-10-21  7:33 UTC (permalink / raw)
  To: zsh-users

On 20 Oct, Bart Schaefer wrote:

>  I've just seen the same problem, on a newly-installed RedHat 5.1 Linux
>  system with the zsh-3.0.5-2 RPM.  The /etc/zshenv file contains
>  
>  	if [[ `id -u` -eq 0 ]]
>  	then
>  	    ...
>  	fi

Some days ago this code (executed by zsh 3.1.4) failed, one time only,
with the error "zsh: parse error: condition expected: = ". 

	if [ `/usr/ucb/whoami` = root ]; then
		PATH_LAST=$PATH_LAST:/usr/etc
	fi

>  problems.  I'd assumed it was something about the "id" program.

and "whoami"  :-)

-- 
 Goran Larsson            hoh@approve.se
 I was an atheist,        http://home1.swipnet.se/%7Ew-12153/
 until I found out I was God.



^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~1998-10-21  7:44 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1998-10-20 14:35 Backticks In zshenv Daniel Rigal
1998-10-20 16:55 ` Bart Schaefer
1998-10-20 19:30   ` Phil Pennock
1998-10-20 19:54   ` PATCH: " Bart Schaefer
1998-10-20 20:36   ` Sweth Chandramouli
1998-10-21  7:33   ` Goran Larsson

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).