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

Re: quoting bug



> >> setopt SH_WORD_SPLIT
> >
> >What does POSIX say?
> 
> POSIX requires the SH_WORD_SPLIT behaviour.  It also requires field
> splitting in normal words, as well as the result of expansions:
> 
> % setopt SH_WORD_SPLIT
> % IFS=x
> % echo fooxbar
> fooxbar

No.  POSIX does not allow field splitting here:

"IFS is used for performing field splitting on the results of parameter
 and command substitution; it is not used for splitting all fields.
 Previous versions of the shell used it for splitting all fields during
 field splitting, but this has severe problems because the shell can no
 longer parse its own script.  There are also important security
 implications caused by this behavior.  All useful applications of IFS use
 it for parsing input of the read utility and for splitting the results of
 parameter and command substitution.  New versions of the shell have fixed
 this bug, and POSIX.2 requires the corrected behavior."

> I think we should implement this behaviour -- when SH_WORD_SPLIT is
> set, of course.  It should be very easy.  I also think we should retain
> the current default, as it's much nicer behaviour.

Yes, it can be implemented easily by adding IBLANK type to IFS elements but
I still think that it is unnecessary.  And there may be hidden problems as
this change affects the parser.

Zoltan




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