On Tue, Sep 17, 2024 at 10:40:23AM +0100, Zé Loff wrote:
> On Tue, Sep 17, 2024 at 10:56:27AM +0200, Denis Bodor wrote:
> > On Tue, Sep 17, 2024 at 09:43:27AM +0200, tomas.rippl@tutanota.com wrote:
> > > I would expect that without the 'x' bit, the directory is not searchable
> > > and I won't be able to list its contents. But in fact I can, unless I
> > > use a long format (-l, -g or -n).
> > >
> > > Can someone please explain the above behaviour? Thank you. Tom
> >
> > Very roughly...
> > The list of files in a directory is information about the directory.
> > If you chmod -r my-test-dir, this information will no longer be available,
> > for example.
> > The file size is information about the files themselves; to read it, you
> > need to be in the directory. But as you can't, it's unreadable.
> >
> > --
> > Denis
> >
>
> It's a bit more complicated than that AFAICT. Although I can reproduce
> this inside /tmp, the behaviour is not consistent. If I try to ls the
> folder on a different shell -- e.g. a different terminal, or after
> exiting script(1) -- the files aren't shown. Also, if I rm -rf the
> folder and recreate it (i.e. reuse the name) the files also aren't shown
> the second time around.
>
> --
>
>
Please take great care when testing this, it is easy to fool yourself.
For example, often ls is aliased to add some flags. I have
alias ls='ls -F'
which fails because it needs to look inside the dir.
For proper testing, use \ls i.e. the non-aliased version.
-Otto
No comments:
Post a Comment