zsh-workers
 help / color / mirror / code / Atom feed
From: Mikael Magnusson <mikachu@gmail.com>
To: Devin Hussey <husseydevin@gmail.com>
Cc: zsh-workers@zsh.org
Subject: Re: Issue with permissions and case-insensitive globbing
Date: Tue, 12 Jan 2021 22:38:11 +0100	[thread overview]
Message-ID: <CAHYJk3SXsL6S4KX35mJr+ewM-UES024Ev96Ppi8yQemcc1z7vA@mail.gmail.com> (raw)
In-Reply-To: <CAEtFKsse+KE7ZQeUtHEX8gMSrdHRas0LPDUVnK2_T30ZTxSOiQ@mail.gmail.com>

On 1/12/21, Devin Hussey <husseydevin@gmail.com> wrote:
> Case insensitive globbing will not work at all if any of the parent
> directories of the target folder are inaccessible.
>
> This bug makes zsh very unstable on Termux (a Linux environment for
> Android), as scripts which use "~/..." will immediately show no
> results.
>
> Android's directory structure makes it so apps can only access their
> /data/data subfolder, blocking access to /data/data itself (it will
> return EACCES).
>
> Termux's $HOME is /data/data/com.termux/files/home.
>
> The simplified folder setup is this:
>
> root    root    0700 /
> root    root    0700 /data
> root    root    0700 /data/data
> termux termux 0700 /data/data/com.termux
>
> A (possible) fix for this issue would be to start in the "base"
> directory before any opendir() calls instead of starting from the root
> directory, and checking for errno.
>
> See:
>
>  - https://github.com/sorin-ionescu/prezto/issues/1560
> - https://github.com/termux/termux-packages/issues/1894

I can only reproduce this with absolute paths, which will obviously
not work (there's no way it ever could, as the kernel will not let you
open the directory). It seems to be completely independent of case
sensitivity as well. Using a relative path should work fine.

To expound a bit,
% mkdir inaccessible; cd inaccessible
% mkdir a; cd a
% chmod 000 .. # make inaccessible inaccessible
% touch a b c; echo *
a b c
% echo $PWD/*
zsh: no matches found: /tmp/inaccessible/a/*

(you will get the same result in any other shell (some may echo the
path with the * unexpanded)).

-- 
Mikael Magnusson


  reply	other threads:[~2021-01-12 21:38 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-12 18:54 Devin Hussey
2021-01-12 21:38 ` Mikael Magnusson [this message]
2021-01-12 22:22   ` Devin Hussey

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=CAHYJk3SXsL6S4KX35mJr+ewM-UES024Ev96Ppi8yQemcc1z7vA@mail.gmail.com \
    --to=mikachu@gmail.com \
    --cc=husseydevin@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).