zsh-workers
 help / color / mirror / code / Atom feed
* select problem
@ 2009-01-12 19:48 david sowerby
  2009-01-17  7:12 ` Andrey Borzenkov
  2009-01-17  9:25 ` Stephane Chazelas
  0 siblings, 2 replies; 8+ messages in thread
From: david sowerby @ 2009-01-12 19:48 UTC (permalink / raw)
  To: zsh-workers

I don't want to subscribe to the mailing lists so please cc
I wrote a shell script in bash (sorry) before I switched to zsh.
The script has no "bashisms" but when I changed #!/bin/bash to #!/bin/zsh it didn't work correctly -- zsh ver 4.3.6 on debian
It's just a simple script using select to print a list of music, choose a file and play it. 
select input in $(/bin/ls -A /home/david/music)
In bash this prints a screen and a half output - all the music files. Then the PS3 prompt
In zsh this is truncated - only the first screenfull is shown, then the PS3 prompt, cutting off the last part of the ls output.
"ls" acts as usual on the command line, everything else seems fine.
I ran the script with zsh -f and it's still the same. I checked /etc/zshenv and it just has the PATH 
feature or bug? thanks if you can help ----------------dave

-------------------------------------------------------------
power corrupts, absolute power corrupts absolutely,
god is all powerful
-------------------------------------------------------------




      


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

* Re: select problem
  2009-01-12 19:48 select problem david sowerby
@ 2009-01-17  7:12 ` Andrey Borzenkov
  2009-01-17  9:25 ` Stephane Chazelas
  1 sibling, 0 replies; 8+ messages in thread
From: Andrey Borzenkov @ 2009-01-17  7:12 UTC (permalink / raw)
  To: zsh-workers, d_sowerby

[-- Attachment #1: Type: text/plain, Size: 872 bytes --]

On Понедельник 12 января 2009 22:48:25 david sowerby wrote:
> I don't want to subscribe to the mailing lists so please cc
> I wrote a shell script in bash (sorry) before I switched to zsh.
> The script has no "bashisms" but when I changed #!/bin/bash to
> #!/bin/zsh it didn't work correctly -- zsh ver 4.3.6 on debian It's
> just a simple script using select to print a list of music, choose a
> file and play it. select input in $(/bin/ls -A /home/david/music)
> In bash this prints a screen and a half output - all the music files.
> Then the PS3 prompt In zsh this is truncated - only the first
> screenfull is shown, then the PS3 prompt, cutting off the last part
> of the ls output.

If you just hit RETURN (empty line) it will display next part of list. I 
agree that it is somewhat confusing and in any case undocumented.

-andrey

[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 197 bytes --]

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

* Re: select problem
  2009-01-12 19:48 select problem david sowerby
  2009-01-17  7:12 ` Andrey Borzenkov
@ 2009-01-17  9:25 ` Stephane Chazelas
  2009-01-17 11:21   ` Richard Hartmann
  1 sibling, 1 reply; 8+ messages in thread
From: Stephane Chazelas @ 2009-01-17  9:25 UTC (permalink / raw)
  To: david sowerby; +Cc: zsh-workers

On Mon, Jan 12, 2009 at 11:48:25AM -0800, david sowerby wrote:
> I don't want to subscribe to the mailing lists so please cc
> I wrote a shell script in bash (sorry) before I switched to zsh.
> The script has no "bashisms" but when I changed #!/bin/bash to
> #!/bin/zsh it didn't work correctly -- zsh ver 4.3.6 on debian
> It's just a simple script using select to print a list of
> music, choose a file and play it. 
> select input in $(/bin/ls -A /home/david/music)
[...]

Sorry, I'm not answering you question, but just a note:

There's no such thing as a bashism as all (except for a few
little ones) bash features come either from ksh, zsh or (t)csh.

"select" is not standard (that is not in the POSIX sh, which
is the only standard you can expect both bash and zsh to conform
to (when called as "sh")) and is a kshism. It's also rather
useless as one can do the same thing easily without.

-- 
Stéphane


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

* Re: select problem
  2009-01-17  9:25 ` Stephane Chazelas
@ 2009-01-17 11:21   ` Richard Hartmann
  2009-01-18 14:39     ` Stephane Chazelas
  0 siblings, 1 reply; 8+ messages in thread
From: Richard Hartmann @ 2009-01-17 11:21 UTC (permalink / raw)
  To: david sowerby, zsh-workers

On Sat, Jan 17, 2009 at 10:25, Stephane Chazelas
<Stephane_Chazelas@yahoo.fr> wrote:

> "select" is not standard (that is not in the POSIX sh, which
> is the only standard you can expect both bash and zsh to conform
> to (when called as "sh")) and is a kshism. It's also rather
> useless as one can do the same thing easily without.

zsh is not fully POSIX compliant and afaik, there are no plans to
ever make it that way, either. While zsh and POSIX agree most
of the time, using zsh as your sh _will_ get you strange effects.

I don't have time to dig up more, but look at [1] and [2] for some
examples.


Richard

[1] http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=329288
[2] http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=340058


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

* Re: select problem
  2009-01-17 11:21   ` Richard Hartmann
@ 2009-01-18 14:39     ` Stephane Chazelas
  2009-01-18 15:45       ` Richard Hartmann
  0 siblings, 1 reply; 8+ messages in thread
From: Stephane Chazelas @ 2009-01-18 14:39 UTC (permalink / raw)
  To: Richard Hartmann; +Cc: david sowerby, zsh-workers

On Sat, Jan 17, 2009 at 12:21:31PM +0100, Richard Hartmann wrote:
> On Sat, Jan 17, 2009 at 10:25, Stephane Chazelas
> <Stephane_Chazelas@yahoo.fr> wrote:
> 
> > "select" is not standard (that is not in the POSIX sh, which
> > is the only standard you can expect both bash and zsh to conform
> > to (when called as "sh")) and is a kshism. It's also rather
> > useless as one can do the same thing easily without.
> 
> zsh is not fully POSIX compliant and afaik, there are no plans to
> ever make it that way, either. While zsh and POSIX agree most
> of the time, using zsh as your sh _will_ get you strange effects.
> 
> I don't have time to dig up more, but look at [1] and [2] for some
> examples.
[...]

None of the so called POSIX shells are fully conformant. AFAIK,
only AT&T ksh claims to be fully conformant. bash follows the
GNU or LSB standards when they conflict with POSIX (see for
instance echo -e that doesn't output -e). ash derivatives still
have some way to go. But all try to be as conformant as
reasonable (so long as their design choices allow and as long as
implementing a POSIX feature wouln't break backward
compatibility).

For instance, I've never come accross a shell implementation
that implements that (rather stupid IMO) POSIX feature that says
that: "PATH=; echo test" should output "echo: command not
found" (that is a built-in should only be invoked if a command
by that name is found in $PATH).

Still, I can't think of how a script could be reasonably made to
rely on that behavior, which is why it's not a problem that all
shells break POSIX conformance there, in a same way that running
a POSIX script with zsh (in sh emulation) generally isn't a
problem because it's only in corner cases that zsh is not
conformant. When a POSIX conformance issue is found by someone,
it is generally raised on this mailing list and most of the time
fixed (at least in sh emulation).

Having said that, I agree there's no much point of having zsh as
your POSIX sh.

-- 
Stéphane


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

* Re: select problem
  2009-01-18 14:39     ` Stephane Chazelas
@ 2009-01-18 15:45       ` Richard Hartmann
  2009-01-20 19:42         ` Peter Stephenson
  0 siblings, 1 reply; 8+ messages in thread
From: Richard Hartmann @ 2009-01-18 15:45 UTC (permalink / raw)
  To: Richard Hartmann, david sowerby, zsh-workers

On Sun, Jan 18, 2009 at 15:39, Stephane Chazelas
<Stephane_Chazelas@yahoo.fr> wrote:

> Still, I can't think of how a script could be reasonably made to
> rely on that behavior, which is why it's not a problem that all
> shells break POSIX conformance there, in a same way that running
> a POSIX script with zsh (in sh emulation) generally isn't a
> problem because it's only in corner cases that zsh is not
> conformant.

Having symlinked zsh to /bin/sh for some time on my system,
I have to say it's a quick way to make your Debian system
stop working. Grml had a similar experience which is why
they went back to Bash.


> When a POSIX conformance issue is found by someone,
> it is generally raised on this mailing list and most of the time
> fixed (at least in sh emulation).

Afaik, there are several issues open. If there is any interest,
I can try to round them up so they can be shot.


> Having said that, I agree there's no much point of having zsh as
> your POSIX sh.

AFAIK, that is the official stance.


Richard


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

* Re: select problem
  2009-01-18 15:45       ` Richard Hartmann
@ 2009-01-20 19:42         ` Peter Stephenson
  2009-01-20 21:30           ` Richard Hartmann
  0 siblings, 1 reply; 8+ messages in thread
From: Peter Stephenson @ 2009-01-20 19:42 UTC (permalink / raw)
  To: Zsh Hackers' List

On Sun, 18 Jan 2009 16:45:42 +0100
Richard Hartmann <richih.mailinglist@gmail.com> wrote:
> On Sun, Jan 18, 2009 at 15:39, Stephane Chazelas
> > When a POSIX conformance issue is found by someone,
> > it is generally raised on this mailing list and most of the time
> > fixed (at least in sh emulation).
> 
> Afaik, there are several issues open. If there is any interest,
> I can try to round them up so they can be shot.

It would probably be useful to have them collected in any case.

-- 
Peter Stephenson <p.w.stephenson@ntlworld.com>
Web page now at http://homepage.ntlworld.com/p.w.stephenson/


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

* Re: select problem
  2009-01-20 19:42         ` Peter Stephenson
@ 2009-01-20 21:30           ` Richard Hartmann
  0 siblings, 0 replies; 8+ messages in thread
From: Richard Hartmann @ 2009-01-20 21:30 UTC (permalink / raw)
  To: Peter Stephenson; +Cc: Zsh Hackers' List

On Tue, Jan 20, 2009 at 20:42, Peter Stephenson
<p.w.stephenson@ntlworld.com> wrote:

> It would probably be useful to have them collected in any case.

K. Will take some time, but I won't forget. I'll open a page on the
Wiki then.


Richard


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

end of thread, other threads:[~2009-01-20 21:30 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-01-12 19:48 select problem david sowerby
2009-01-17  7:12 ` Andrey Borzenkov
2009-01-17  9:25 ` Stephane Chazelas
2009-01-17 11:21   ` Richard Hartmann
2009-01-18 14:39     ` Stephane Chazelas
2009-01-18 15:45       ` Richard Hartmann
2009-01-20 19:42         ` Peter Stephenson
2009-01-20 21:30           ` Richard Hartmann

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