zsh-workers
 help / color / mirror / code / Atom feed
From: Tom Vaughan <thomas.david.vaughan@gmail.com>
To: Phil Pennock <zsh-workers+phil.pennock@spodhuis.org>
Cc: zsh-workers@zsh.org
Subject: Re: Literal `~` directory created?
Date: Thu, 18 May 2023 13:50:42 -0400	[thread overview]
Message-ID: <92F7C23E-37C1-4204-95E1-6B8050F9CAB0@gmail.com> (raw)
In-Reply-To: <ZGZX2nZ+6CLx+L64@fullerene.field.pennock-tech.net>



> On May 18, 2023, at 12:52, Phil Pennock <zsh-workers+phil.pennock@spodhuis.org> wrote:
> 
> On 2023-05-18 at 13:59 +0000, thomas.david.vaughan@gmail.com wrote:
>> I ran `brew bundle install` in a newly created directory which contained only
>> a Brewfile, and noticed that afterwards a directory named `~` had been
>> created:
> 
>> I have noticed this before perhaps as far back as three months ago, but I
>> never could narrow it down enough to understand what might be causing this. I
>> would see this after I ran some homemade scripts I wrote to maintain the
>> software installed on my laptop. These scripts always ran brew so maybe it's
>> the culprit?
> 
> The expansion of `~` is something which the shell does when invoking a
> command, but if the command is getting a value from a configuration file
> then it needs to be supported on a per-app basis, because then the shell
> isn't involved doing some of the work for it.
> 
> Similarly, if you have something which wants to use `~` as the default
> value for a flag, then that's going to be ... "iffy".
> 
> So grep for '~' in your config files and try replacing it with $HOME
> instead, see if the command does env-var expansion or if you end up with
> a directory named '$HOME' in your home-dir.  :^)
> 
> There's nothing zsh-specific or zsh-involved here: the problem is
> arising _because the shell is not being involved_.

Thanks, Phil. Based on this it seems like the problem is due to:

    mkdir -m 0700 -p "$_cache_dir"

at https://github.com/zsh-users/zsh/blob/master/Completion/Base/Utility/_store_cache#L19

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.

-Tom



  reply	other threads:[~2023-05-18 17:56 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 [this message]
2023-05-18 17:59     ` Phil Pennock
2023-05-18 18:48       ` Tom Vaughan
2023-05-18 21:37         ` Phil Pennock
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=92F7C23E-37C1-4204-95E1-6B8050F9CAB0@gmail.com \
    --to=thomas.david.vaughan@gmail.com \
    --cc=zsh-workers+phil.pennock@spodhuis.org \
    --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).