zsh-workers
 help / color / mirror / code / Atom feed
* read broken in beta21
@ 1996-06-21 17:16 Zefram
  1996-06-24 11:57 ` Zoltan Hidvegi
  0 siblings, 1 reply; 4+ messages in thread
From: Zefram @ 1996-06-21 17:16 UTC (permalink / raw)
  To: Z Shell workers mailing list

It appears that the changes to bin_read in beta21 have introduced a
bug.  Trailing non-whitespace IFS characters on the input line are
appended to the last parameter being set, instead of removed.  This
change has broken a script of mine.  Or does POSIX require this?  sh
matches zsh's previous behaviour.

-zefram



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

* Re: read broken in beta21
  1996-06-21 17:16 read broken in beta21 Zefram
@ 1996-06-24 11:57 ` Zoltan Hidvegi
  1996-06-24 17:20   ` Zefram
  0 siblings, 1 reply; 4+ messages in thread
From: Zoltan Hidvegi @ 1996-06-24 11:57 UTC (permalink / raw)
  To: Zefram; +Cc: zsh-workers

> It appears that the changes to bin_read in beta21 have introduced a
> bug.  Trailing non-whitespace IFS characters on the input line are
> appended to the last parameter being set, instead of removed.  This
> change has broken a script of mine.  Or does POSIX require this?  sh
> matches zsh's previous behaviour.

What is sh?  On Linux, sh is bash which matches zsh's new behaviour.  Other
sh's.  Here is what POSIX says:

 The line shall be split into fields (see the definition in 3.1.3) as in
 the shell (see 3.6.5); the first field shall be assigned to the first
 variable var, the second field to the second variable var, etc.  If there
 are fewer var operands specified than there are fields, the leftover
 fields and their intervening separators shall be assigned to the last
 var. If there are fewer fields than vars, the remaining vars shall be set
 to empty strings.

So it is clear that the `intervening separators' should be assigned to the
last parameter.  A non-whitespace IFS character is always a separator so it
should not be removed.  bash and pdksh behaves as zsh while ksh93 removes
training non-whitespace IFS characters (which is wrong if I interpret POSIX
correctly).  This also means that trailing IFS-whitespaces should be
removed as these are not and intervening separarators.

Zoltan



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

* Re: read broken in beta21
  1996-06-24 11:57 ` Zoltan Hidvegi
@ 1996-06-24 17:20   ` Zefram
  1996-06-24 17:38     ` Zoltan Hidvegi
  0 siblings, 1 reply; 4+ messages in thread
From: Zefram @ 1996-06-24 17:20 UTC (permalink / raw)
  To: Zoltan Hidvegi; +Cc: A.Main, zsh-workers

>What is sh?

I was referring to the Bourne shell.

> The line shall be split into fields (see the definition in 3.1.3) as in
> the shell (see 3.6.5); the first field shall be assigned to the first
> variable var, the second field to the second variable var, etc.  If there
> are fewer var operands specified than there are fields, the leftover
> fields and their intervening separators shall be assigned to the last
                   ^^^^^^^^^^^
> var. If there are fewer fields than vars, the remaining vars shall be set
> to empty strings.

It sounds to me like trailing IFS characters are not *intervening*
separators, and should therefore be removed.

-zefram



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

* Re: read broken in beta21
  1996-06-24 17:20   ` Zefram
@ 1996-06-24 17:38     ` Zoltan Hidvegi
  0 siblings, 0 replies; 4+ messages in thread
From: Zoltan Hidvegi @ 1996-06-24 17:38 UTC (permalink / raw)
  To: Zefram; +Cc: A.Main, zsh-workers

> >What is sh?
> 
> I was referring to the Bourne shell.
> 
> > The line shall be split into fields (see the definition in 3.1.3) as in
> > the shell (see 3.6.5); the first field shall be assigned to the first
> > variable var, the second field to the second variable var, etc.  If there
> > are fewer var operands specified than there are fields, the leftover
> > fields and their intervening separators shall be assigned to the last
>                    ^^^^^^^^^^^
> > var. If there are fewer fields than vars, the remaining vars shall be set
> > to empty strings.
> 
> It sounds to me like trailing IFS characters are not *intervening*
> separators, and should therefore be removed.

non-whitespace IFS characters (NWICs) always separate fields.  A trailing
NWIC separate a trailing empty field from the other fields.  E.g.

% IFS=/ ; set -- $IFS ; echo $#
2

So the trailing NWICs are intervening separators between empty fields.

Zoltan



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

end of thread, other threads:[~1996-06-24 18:03 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1996-06-21 17:16 read broken in beta21 Zefram
1996-06-24 11:57 ` Zoltan Hidvegi
1996-06-24 17:20   ` Zefram
1996-06-24 17:38     ` Zoltan Hidvegi

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