[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Coreutils enhancement: ls: add colorization of mountpoints

From: Rob Landley
Subject: Re: Coreutils enhancement: ls: add colorization of mountpoints
Date: Tue, 17 Oct 2023 04:34:43 -0500
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.10.0

On 10/16/23 16:50, Parke wrote:
> Hello,,
> I am contemplating extending ls so that mountpoints can be colorized
> (via LS_COLORS).

But not -F ?

> I'm hoping that a mountpoint can be detected by comparing the st_dev
> fields returned by calling stat() on a directory and on that
> directory's parent.

--bind mounts exist, following symlinks with -L could get weird...

> There are some related choices:  Should non-directory mounts also be
> colorable?

You can --bind mount over a file. You can also do read only bind mounts, which
are semi-invisible:

$ sudo mount --bind -o,ro usb.ids usb.ids
$ ls -l usb.ids
-rw-r--r-- 1 landley landley 716614 May 20  2022 usb.ids
$ echo >> usb.ids
bash: usb.ids: Read-only file system

Once upon a time you could chattr +i on ext2 to nail a file in place too (which
was the only way I could get dhclient to stop replacing /etc/resolv.conf and fun
things like that back in the day), and there's almost certainly other ways with
selinux nonsense and similar.

Nobody ever said ls showed the full story, and trying to get it to do so is both
a can of worms and "now the simple posix tool exhibits complex non-obvious
behavior when we ask simple questions"...


reply via email to

[Prev in Thread] Current Thread [Next in Thread]