]> git.ipfire.org Git - thirdparty/coreutils.git/commit
ls: avoid expensive capability lookup by default
authorPádraig Brady <P@draigBrady.com>
Sun, 3 Apr 2022 20:42:42 +0000 (21:42 +0100)
committerPádraig Brady <P@draigBrady.com>
Sun, 3 Apr 2022 21:10:35 +0000 (22:10 +0100)
commit6b5134770d35b045e5a9219bf4a216324e0113d3
tree7bf04114d614c9a9e738909b23e4ef6108954b00
parent52aeae2c3d967ce27e18ec32edd17eeaaf2ef357
ls: avoid expensive capability lookup by default

Lookup of file-based capabilities adds 30% overhead to the common
case of ls --color usage.  Since the use of file capabilities is
very rare, it doesn't make sense to pay this cost in the common
case.  It's better to use getcap to inspect capabilities, and the
following run shows only 8 files using capabilities on my fedora
35 distro (14 years after the feature was introduced to the linux
kernel).

  $ getcap -r /
  /usr/bin/arping = cap_net_raw+p
  /usr/bin/clockdiff = cap_net_raw+p
  /usr/bin/gnome-keyring-daemon = cap_ipc_lock+ep
  /usr/bin/gnome-shell = cap_sys_nice+ep
  /usr/bin/newgidmap = cap_setgid+ep
  /usr/bin/newuidmap = cap_setuid+ep
  /usr/sbin/mtr-packet = cap_net_raw+ep
  /usr/sbin/suexec = cap_setgid,cap_setuid+ep

* src/dircolors.hin: Set "CAPABILITY" to "00", to indicate unused.
* src/ls.c: Set the default C_CAP color to not colored.
* NEWS: Mention the change in behavior.
NEWS
src/dircolors.hin
src/ls.c