zsh-workers
 help / color / mirror / code / Atom feed
From: Phil Pennock <zsh-workers+phil.pennock@spodhuis.org>
To: Tom Vaughan <thomas.david.vaughan@gmail.com>
Cc: zsh-workers@zsh.org
Subject: Re: Literal `~` directory created?
Date: Thu, 18 May 2023 17:37:51 -0400	[thread overview]
Message-ID: <ZGaar4NEo5SV77Kh@fullerene.field.pennock-tech.net> (raw)
In-Reply-To: <74770309-94CB-4C2B-8FC4-C89A8064B293@gmail.com>

On 2023-05-18 at 14:48 -0400, Tom Vaughan wrote:
> > On May 18, 2023, at 13:59, Phil Pennock <zsh-workers+phil.pennock@spodhuis.org> wrote:
> > 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. 

zstyle is used in two ways:

 1. To set a style
 2. To query a style

The _store_cache function queries the style:

    zstyle -s ":completion:${curcontext}:" cache-path _cache_dir
    : ${_cache_dir:=${ZDOTDIR:-$HOME}/.zcompcache}

This is a lookup, for a string (-s); see zshmodules(1) for the
documentation.  Then it supplies a default to use if that resulted in an
empty string (`:`/`true` command, invoked for side-effect of argv
evaluations, and ${param:=default} assignment to populate the variable).

So this does not put a '~' into the cache-path.  Something else has put
that tilde in there.

The _setting_ of the zstyle is done either with nothing between the
`zstyle` and the pattern, or a `-e` for deferred evaluation.  Or a '-'
or '--', pedantically.  The doc entry is:

    zstyle [ - | -- | -e ] pattern style string ...

Somewhere, something in startup files or otherwise is populating some
style settings with a literal tilde in there.

Run:

    zstyle -L | grep '~'

for a first approximation (might include other tildes) of which entries
might have issues.

Try this, to find likely candidates:

    grep "zstyle.*'~" ${ZDOTDIR:-$HOME}/.z*

Now, should zsh have more guards against common misuse like this?
Perhaps, but it's likely to be a quixotic quest.


  reply	other threads:[~2023-05-18 21:53 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-05-18 13:59 thomas.david.vaughan
2023-05-18 16:52 ` Phil Pennock
2023-05-18 17:50   ` Tom Vaughan
2023-05-18 17:59     ` Phil Pennock
2023-05-18 18:48       ` Tom Vaughan
2023-05-18 21:37         ` Phil Pennock [this message]
2023-05-18 22:25           ` Tom Vaughan

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ZGaar4NEo5SV77Kh@fullerene.field.pennock-tech.net \
    --to=zsh-workers+phil.pennock@spodhuis.org \
    --cc=thomas.david.vaughan@gmail.com \
    --cc=zsh-workers@zsh.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).