zsh-workers
 help / color / mirror / code / Atom feed
* zsh weird behaviour (possibly bug?)
@ 2007-07-02  3:32 Janos Barbero
  2007-07-02  9:29 ` Peter Stephenson
  0 siblings, 1 reply; 4+ messages in thread
From: Janos Barbero @ 2007-07-02  3:32 UTC (permalink / raw)
  To: zsh-workers

Hi,

I often notice that complex shell commands (usually with 5-10 pipes
and plenty of awk/sed) produce no output in zsh, but work fine in
bash. I found a really simple one today.
   ls | sed 's/\<\(.\)\([^ ]*\)/\u\1\L\2/g'
This produces no output in zsh, but does in any bash version. Further
investigation revealed this to be due to my precmd's/postcmd's. So
some more data:
1: precmd () {     print -Pn "\ek%n@%m %~$ \e\\"           }
2: preexec() {     print -Pn "\ek%n@%m %~$ $1\e\\"         }
3: precmd () {     print -Pn "\ek%~\e\\"                   }
4: preexec() {     print -Pn "\ek%~ $1\e\\"                }

If I have only line 4, command doesn't return (I have to manually kill
the window), but plain ls works. If I leave lines 3 and 4, no output.
Leaving either or both lines 1 and 2, it works fine. (I tried these
with nothing else in my .zshrc.)

Is the problem with my precmd/postcmd 3 and 4, or is this a zsh bug?
Sorry if this is sent out to the wrong list, I understood this is
where to file zsh bugs.

Thanks,
~Janos


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

* Re: zsh weird behaviour (possibly bug?)
  2007-07-02  3:32 zsh weird behaviour (possibly bug?) Janos Barbero
@ 2007-07-02  9:29 ` Peter Stephenson
       [not found]   ` <77d935a0707020917o244fc086k72a679839d4f256b@mail.gmail.com>
  0 siblings, 1 reply; 4+ messages in thread
From: Peter Stephenson @ 2007-07-02  9:29 UTC (permalink / raw)
  To: zsh-workers, Janos Barbero

"Janos Barbero" wrote:
> I often notice that complex shell commands (usually with 5-10 pipes
> and plenty of awk/sed) produce no output in zsh, but work fine in
> bash. I found a really simple one today.
>    ls | sed 's/\<\(.\)\([^ ]*\)/\u\1\L\2/g'
> This produces no output in zsh, but does in any bash version. Further
> investigation revealed this to be due to my precmd's/postcmd's. So
> some more data:
> 1: precmd () {     print -Pn "\ek%n@%m %~$ \e\\"           }
> 2: preexec() {     print -Pn "\ek%n@%m %~$ $1\e\\"         }
> 3: precmd () {     print -Pn "\ek%~\e\\"                   }
> 4: preexec() {     print -Pn "\ek%~ $1\e\\"                }
> 
> If I have only line 4, command doesn't return (I have to manually kill
> the window), but plain ls works. If I leave lines 3 and 4, no output.
> Leaving either or both lines 1 and 2, it works fine. (I tried these
> with nothing else in my .zshrc.)
> 
> Is the problem with my precmd/postcmd 3 and 4, or is this a zsh bug?

It's hard to tell, but we can certainly say it's got *something* to do
with the way your terminal behaves.  I don't recognise those escape
sequences, but the fact that changing them makes a difference suggests
the terminal is doing something weird with the output.

You didn't say what system you're on: if it's a MAC, somebody reported a
similar problem recently.  See the thread at
 http://www.zsh.org/cgi-bin/mla/redirect?WORKERNUMBER=23429

-- 
Peter Stephenson <pws@csr.com>                  Software Engineer
CSR PLC, Churchill House, Cambridge Business Park, Cowley Road
Cambridge, CB4 0WZ, UK                          Tel: +44 (0)1223 692070


To access the latest news from CSR copy this link into a web browser:  http://www.csr.com/email_sig.php

To get further information regarding CSR, please visit our Investor Relations page at http://ir.csr.com/csr/about/overview


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

* Re: zsh weird behaviour (possibly bug?)
       [not found]   ` <77d935a0707020917o244fc086k72a679839d4f256b@mail.gmail.com>
@ 2007-07-02 16:40     ` Peter Stephenson
  2007-07-02 16:50       ` Peter Stephenson
  0 siblings, 1 reply; 4+ messages in thread
From: Peter Stephenson @ 2007-07-02 16:40 UTC (permalink / raw)
  To: Janos Barbero, Zsh hackers list

"Janos Barbero" wrote:
> Sorry, I run zsh in screen on Linux. zsh 4.2.6 (i686-pc-linux-gnu) on
> Linux 2.6. The terminal I use screen within is xterm or PuTTY
> (remotely), but if I understand screen correctly, that shouldn't
> matter.

In that case it might be worth trying to run screen or zsh under strace and
seeing if anything funny is happening with I/O.  You'll get lots of
useless output, but (if the strings are recognizable enough) it should
be possible to work out what's going where.

-- 
Peter Stephenson <pws@csr.com>                  Software Engineer
CSR PLC, Churchill House, Cambridge Business Park, Cowley Road
Cambridge, CB4 0WZ, UK                          Tel: +44 (0)1223 692070


To access the latest news from CSR copy this link into a web browser:  http://www.csr.com/email_sig.php

To get further information regarding CSR, please visit our Investor Relations page at http://ir.csr.com/csr/about/overview


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

* Re: zsh weird behaviour (possibly bug?)
  2007-07-02 16:40     ` Peter Stephenson
@ 2007-07-02 16:50       ` Peter Stephenson
  0 siblings, 0 replies; 4+ messages in thread
From: Peter Stephenson @ 2007-07-02 16:50 UTC (permalink / raw)
  Cc: Janos Barbero, Zsh hackers list

Peter Stephenson wrote:
> In that case it might be worth trying to run screen or zsh under strace and
> seeing if anything funny is happening with I/O.  You'll get lots of
> useless output, but (if the strings are recognizable enough) it should
> be possible to work out what's going where.

Come to think of it, it's not clear that looking at I/O from the shell
is going to tell you much: opens and ioctls might, but the command
that's not showing output,

   ls | sed 's/\<\(.\)\([^ ]*\)/\u\1\L\2/g'

doesn't have output going through the shell.  The shell forks, set's up
the pipe, and forks again; one of the forked shells execs ls, the other
sed.  The output goes straight from ls to sed to the terminal.

-- 
Peter Stephenson <pws@csr.com>                  Software Engineer
CSR PLC, Churchill House, Cambridge Business Park, Cowley Road
Cambridge, CB4 0WZ, UK                          Tel: +44 (0)1223 692070


To access the latest news from CSR copy this link into a web browser:  http://www.csr.com/email_sig.php

To get further information regarding CSR, please visit our Investor Relations page at http://ir.csr.com/csr/about/overview


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

end of thread, other threads:[~2007-07-02 16:51 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-07-02  3:32 zsh weird behaviour (possibly bug?) Janos Barbero
2007-07-02  9:29 ` Peter Stephenson
     [not found]   ` <77d935a0707020917o244fc086k72a679839d4f256b@mail.gmail.com>
2007-07-02 16:40     ` Peter Stephenson
2007-07-02 16:50       ` Peter Stephenson

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).