Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: bug with chpwd/allexport (plus expansion/substitution remarks)
- X-seq: zsh-workers 4249
- From: "Bart Schaefer" <schaefer@xxxxxxxxxxxxxxxx>
- To: Dominik Vogt <dominik_vogt@xxxxxx>, zsh-workers@xxxxxxxxxxxxxxx
- Subject: Re: bug with chpwd/allexport (plus expansion/substitution remarks)
- Date: Thu, 23 Jul 1998 13:30:29 -0700
- In-reply-to: <35AF512B.2905@xxxxxx>
- In-reply-to: <199807171342.OAA09593@xxxxxxxxxxxxxxxx>
- In-reply-to: <35AF5FB5.25F5@xxxxxx>
- In-reply-to: <199807171454.PAA10393@xxxxxxxxxxxxxxxx>
- In-reply-to: <35AF70DA.D64A4FEC@xxxxxx>
- References: <H0000bb106ed95d2@MHS> <35AF512B.2905@xxxxxx> <199807171342.OAA09593@xxxxxxxxxxxxxxxx> <H0000bb106ef5312@MHS> <35AF5FB5.25F5@xxxxxx> <199807171454.PAA10393@xxxxxxxxxxxxxxxx> <H0000bb106effa42@MHS> <35AF70DA.D64A4FEC@xxxxxx>
On Jul 17, 3:27pm, Dominik Vogt wrote:
} Subject: Re: bug with chpwd/allexport
}
} > > The problem is, that is you have the ALLEXPORT and the
} > >AUTONAMEDIRS option set and use a variable in your chpwd function
} > >(e.g. to build a string to print it on the windows title bar),
} > >the variable is immediately put into the hashtable for named
} > >directories.
} >
} > That's correct behaviour.
This doesn't actually have anything to do with ALLEXPORT, does it? As
soon as you set AUTONAMEDIRS, it behaves like this.
On Jul 17, 2:42pm, Zefram wrote:
} Subject: Re: bug with chpwd/allexport
}
} Dominik Vogt wrote:
} > BTW if the second workaround you suggest works,
} >then it is a bug. The manpage states clearly, that a local variable is
} >still exported if the ALLEXPORT option is set and the variable was
} >prviously unset.
}
} But with `local', the variable disappears at the end of the function,
That also doesn't affect whether the name is added to the named directory
hash table. Unsetting the variable doesn't unhash the name; making it a
local has no effect on this problem whatsoever.
On Jul 17, 5:42pm, Dominik Vogt wrote:
} Subject: Re: bug with chpwd/allexport
}
} > You seem to be confusing the concepts of `existing outside the shell
} > function' and `exported' (visible to programs invoked from the shell).
} > The two are mostly, though not entirely, independent of each other.
}
} No, I just wasn't reading the manpage carefully. Perhaps the manpage
} should be written in a way that a 'normal' user can understand
} implications like this after reading in once.
This would be ideal, but is nearly impossible to achieve. We can try to
catch obvious cases, and sometimes add doc for particular instances we
discover (like this one); but there are too many options and too many ways
they interact to describe all the possible combinations in the manual.
} There are some other
} 'mysteries' of zsh. For example the exact order in which quoting
} and substitution are done. For example the manpage doesn't state
} which substitutions/expansions recognize which kinds of quoting.
The info files do explain this, though you are again correct that there's
no single place that enumerates all the steps. The section on "Quoting"
should probably be moved to appear earlier in the "Shell Grammar" section,
or even outside it (perhaps a new section on "Lexical Conventions" should
be added, to explain how "words" and "tokens" are identified).
The short answer to "which substitutions/expansions recognize which kinds
of quoting" is that -none- of them recognize quoting. Quoting is a lexical
convention applied at the time the input is read; by the time expansions
occur, everything is already broken into words/tokens. Did you mean "what
quotings permit or prevent which substitutions/expansions?" The "Quoting"
section is deficient in failing to mention that history expansion occurs
inside double quotes but not inside single quotes, but is otherwise OK.
The "Expansion" section is potentially misleading, because it discusses
removal of the unquoted quotes from the input; in fact I can't think of a
case where it makes a difference when those quotes are removed, because
the quoting itself has already happened. E.g.:
print -l x{"a,b,c"}x
The quotes aren't removed until after brace expansion (according to the
info doc) but the commas are already quoted by the time brace expansion is
attempted. (I have no idea what effect SH_FILE_EXPANSION has on when the
quotes are removed, or whether it matters.)
Or perhaps you mean "what quotings are recognized in the replacement text
that results from which substitutions/expansions?" Again, the answer is
that none are. Expansions (except alias expansion, but including history,
now that the old lexical history options are gone) are already tokenized
when replaced [*] and substitutions are subject to word splitting at IFS
unless double-quoted.
[*] Is that the only thing that distinguishes expansion from substitution?
--
Bart Schaefer Brass Lantern Enterprises
http://www.well.com/user/barts http://www.brasslantern.com
Messages sorted by:
Reverse Date,
Date,
Thread,
Author