[Slackbuilds-users] template find/chmod RFC
Jim
zsd+slackbuilds at jdvb.ca
Mon Aug 3 15:25:42 UTC 2026
On Sun, Aug 2, 2026 at 21:53 (-0400), B. Watson wrote:
> On Sun, 2 Aug 2026, Jim via SlackBuilds-users wrote:
>>> ----------------------------------------------------------------------
>>> find . ! -type l -a \
>>> \( -perm /111 -a ! -perm 755 -a -exec chmod -f 755 {} + \) -o \
>>> \( ! -perm /111 -a ! -perm 644 -a -exec chmod -f 644 {} + \)
>>> ----------------------------------------------------------------------
>> I know it is redundant to chmod a file to the perms it already has, but at
>> the cost of a few redundant chmod operations, would the clarity gained by
>> removing the " -a ! -perm 644 " clause (and the 755 one) be worth those
>> extra few chmods?
> It's not necessily a "few". If you have 10,000 files with correct
> permissions and only a few (or only one, or none at all) that need
> changing, your chmod commands will take 10,000 times as long as they
> need to.
That's a big package. Of the 512 (huh!) SBos I have on my system, the
average number of lines in /var/log/packages/<pkg> is 384.xxx. (And that
includes the blurb at the top.)
> Part of my goal in changing the template is to avoid the long delay
> caused by the old find/chmod code.
My biggest SBo is qt6-6.8.3 (wc of /var/log/packages/qt6-6.8.3-x86_64-2_SBo
gives 18299).
After untarring it into a scratch directory, I ran
time find . ! -type l -a \( -perm /111 -a -exec chmod -f 755 {} + \) -o \( ! -perm /111 -a -exec chmod -f 644 {} + \)
which reported
.06s user 0.23s system 99% cpu 0.285 total
This is on a 6 year old laptop (with a Ryzen 4700U CPU).
I don't really think that amount of time is significant (especially in
light of the fact that compiling Qt6 took hours), but YMMV.
Anyway, you asked for "any opinion at all", and so I gave it. If you want
to keep the optimizing test, that's fine. But I don't think it is much of
a time saver.
Cheers.
Jim
More information about the SlackBuilds-users
mailing list