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

Re: Bug#517008: alias not expanded with zsh -c



On Wed, 25 Mar 2009 17:14:31 -0700
Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx> wrote:
> On Mar 25,  6:20pm, Peter Stephenson wrote:
> }
> } But yes, I share your feeling that this isn't a particularly vital
> } addition, it just looked easy to do like other shells in compatability
> } mode, which is the point of that.
> 
> It just seems to me that we're potentially penalizing a script that does
> not use aliases in the can't-open-tempfile case in order to support a
> script that does not use aliases.
> 
> Given potential security problems with using tempfiles and the likelyhood
> of a script using an alias vs. the likelyhood of file creation failing,
> which case ought we be catering too?

From what I've heard, it doesn't sound like it's worth more than a
warning.

Index: Doc/Zsh/options.yo
===================================================================
RCS file: /cvsroot/zsh/zsh/Doc/Zsh/options.yo,v
retrieving revision 1.78
diff -u -r1.78 options.yo
--- Doc/Zsh/options.yo	3 Mar 2009 17:35:29 -0000	1.78
+++ Doc/Zsh/options.yo	26 Mar 2009 09:49:05 -0000
@@ -1721,7 +1721,12 @@
 
 Alias expansion takes place while text is being read; hence when this
 option is set it does not take effect until the end of any function or
-other piece of shell code evaluated as one unit.
+other piece of shell code evaluated as one unit.  Note this may
+cause differences from other shells even when the option is in
+effect.  For example, when running a command with `tt(zsh -c)' the
+entire command argument is parsed in one go, so aliases defined within
+the argument are not available even in later lines.  If in doubt, avoid use
+of aliases in non-interactive code.
 )
 pindex(POSIX_BUILTINS)
 pindex(NO_POSIX_BUILTINS)


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



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