Bug 433190 - colorls.sh optimizations
colorls.sh optimizations
Product: Fedora
Classification: Fedora
Component: coreutils (Show other bugs)
All Linux
low Severity low
: ---
: ---
Assigned To: Ondrej Vasik
Fedora Extras Quality Assurance
: Patch
Depends On:
  Show dependency treegraph
Reported: 2008-02-17 05:26 EST by Ville Skyttä
Modified: 2008-02-18 12:20 EST (History)
1 user (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2008-02-18 11:31:43 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)
Optimize noninteractive shell case, reduce amount of stat calls (1.90 KB, patch)
2008-02-17 05:26 EST, Ville Skyttä
no flags Details | Diff

  None (edit)
Description Ville Skyttä 2008-02-17 05:26:26 EST
Attached is a patch containing two optimizations for colorls.sh:

1) Don't do anything but set the "ll" and "l." aliases for noninteractive shells.
2) Avoid a bunch of stat calls whose results would just be thrown away.

The csh variant could seemingly use similar optimizations, but I'm not a csh
hacker so I'll leave it to someone else.
Comment 1 Ville Skyttä 2008-02-17 05:26:26 EST
Created attachment 295095 [details]
Optimize noninteractive shell case, reduce amount of stat calls
Comment 2 Ondrej Vasik 2008-02-18 11:31:43 EST
Thanks for optimizations. I used your patch with one change - aliases for
non-colored ls are kept inside the [ -z "$LS_COLORS" ] - doesn't make sense to
set them to non-colored and immediately to colored when LS_COLORS are set before
colorls.sh run. Will keep .csh script as it is, as is used much less than .sh
script. Built as coreutils-6.10-8.fc9 , closing RAWHIDE.
Comment 3 Ville Skyttä 2008-02-18 12:20:22 EST
Yep, your change looks good.  When making the patch, in some of my intermediate
versions of it there was a chance that the "ll" and "l." aliases wouldn't be set
at all which is why I moved them to the top level, but that's clearly no longer
needed.  Thanks!

Note You need to log in before you can comment on or make changes to this bug.