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

Re: Literal `~` directory created?




> On May 18, 2023, at 13:59, Phil Pennock <zsh-workers+phil.pennock@xxxxxxxxxxxx> wrote:
> 
> On 2023-05-18 at 13:50 -0400, Tom Vaughan wrote:
>> Thanks, Phil. Based on this it seems like the problem is due to:
>> 
>>    mkdir -m 0700 -p "$_cache_dir"
> 
>> Tilde is not expanded when quoted, right? _cache_dir is set a little higher up at https://github.com/zsh-users/zsh/blob/master/Completion/Base/Utility/_store_cache#L10:
>> 
>>    $ echo $_cache_dir
>> 
>>    $ zstyle -s ":completion:${curcontext}:" cache-path _cache_dir
>> 
>>    $ echo $_cache_dir
>>    ~/.cache/zsh/compcache
>> 
>> Perhaps this tilde should be expanded? Running the mkdir command above creates a literal '~' directory in the current working directory.
> 
> It should have been expanded _when you set the style_.
> 
> So don't quote a parameter when invoking zstyle to set it, because then
> you're setting the style's value to hold the literal string.
> 
> You should have things like:
> 
>    zstyle ':completion:*' urls ~/.urls
>    zstyle ':completion:*' cache-path ~/.cache/zsh/${HOST%%.*}

Sorry, I'm a bit confused. The previous link is to the zsh source code mirror on GitHub, specifically the definition for _store_cache which is what calls zstyle and mkdir. 

Do you mean that, in this particular case, radian should include these two zstyle commands above in its setup? But if zsh provides a fallback, is this really a requirement?

FYI - I left out that I traced brew, which calls _store_cache at  https://github.com/Homebrew/brew/blob/16b2a14c9408140b04828462b660d30056421fdb/Library/Homebrew/completions/zsh.erb#L143

-Tom





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