Subject: Re: bug#12020: ls should show when extended system attributes are set

From: Jim Meyering <[email-masked]>
Date: Sun, 22 Jul 2012 14:40:46 +0200

Luk Claes wrote:
...
> But it apparently does not show when capabilites are active, could that
> be added (or was that added in the meantime in a subsequent version)?
>
> $ setcap cap_chown+ep foo
>
> $ ls -l foo
> -rw-r--r-- 1 luk luk 5 Jul 22 00:37 foo
>
> $ sudo getcap foo
> foo = cap_chown+ep

That's right: capabilities are currently not taken into account when
printing ls -l's "optional alternate access method" flag.  However,
with --color, we already do test for the existence of capabilities,
and if found, highlight each affected file differently.

A comment says that the capabilities existence test adds 30% to the cost
of ls --color (it's probably even more, now), so I would not impose it on
ls -l without due consideration.  We know from recent performance-related
improvements that checks like this can have a big impact when operating
on remote file systems.

When already using --color, we do get each test result for free, so it
is tempting to take it into account in that case.  However, that would
make the use of --color change more than just highlighting, but the
actual information displayed, which I would not want to do.