[Slackbuilds-users] template find/chmod RFC

Jim Diamond jim at jdvb.ca
Tue Aug 4 01:50:27 UTC 2026


ZOn Mon, Aug  3, 2026 at 11:38 (-0700), Jeremy Hansen wrote:

> On Mon, Aug 3, 2026, 8:47 AM Jim via SlackBuilds-users <
> slackbuilds-users at slackbuilds.org> wrote:

>> On Mon, Aug  3, 2026 at 14:31 (+0200), Franzen via SlackBuilds-users wrote:

>>>> chmod -R u+w,go-w,a+rX-st .

>>> Here is an explanation why my proposal might not be that good. It's 13
>> years
>>> old, maybe chmod has changed to the better:
>>> https://unix.stackexchange.com/a/79874

>> Since I already timed the other replacement options, here is that one as
>> well (again, on qt6-6.8.3-x86_64-2_SBo.tgz, where    find . | wc -l
>> outputs 18282, which is a lot of files and directories).

>> $ time 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 {} + \)
>> 0.03s user 0.06s system 99% cpu 0.086 total

>> $ time find .  ! -type l -a \( -perm /111 -a -exec chmod -f 755 {} + \) -o
>> \( ! -perm /111 -a -exec chmod -f 644 {} + \)
>> 0.07s user 0.22s system 99% cpu 0.285 total

>> $ time chmod -R u+w,go-w,a+rX-st .
>> 0.03s user 0.21s system 99% cpu 0.244 total

>> Certainly the one with ! -perm is the fastest.  Whether brevity is worth
>> two tenths of a second or not is probably a personal opinion.

> I'm not sure why you're seeing such a minimal amount of time with the
> original command.

Me neither (but see below).

> That's always been a bottleneck when compiling SlackBuilds between the
> visible extraction and the visible compilation. It just sits there on big
> builds while find does its thing silently.

I can't say I've noticed that, but often I let a SlackBuild chug away in
one window and look at something else.  The next time I build something
I'll have to see if thee is something weird about my tests today.

> I just tested my Kodi SlackBuild by adding time in front of the find
> command and that took:

> real    0m15.603s
> user    0m10.402s
> sys     0m5.215s

That seems very slow, especially in light of the machine you describe below.

Astonishing, in fact.  Given that the find comes right after untarring and
chowning, I would think that all of the directory structure should be
cached in pages lounging around in your 64 GB memory, unless you have a
bunch of VMs running which have been allocated 60 or 62 GB of your RAM.

> The chmod was incredibly fast:

> real    0m0.076s
> user    0m0.003s
> sys     0m0.073s

> As was the new find:

> real    0m0.079s
> user    0m0.016s
> sys     0m0.062s

Did you run the old stinky find again just to see how it went on second try?

> The amount of files in the Kodi source is around 33% smaller compared to
> your qt6 example:

> jbhansen at craven-moorhead:~/sbo-git/multimedia/kodi$ find
> /tmp/SBo/xbmc-21.3-Omega/ | wc -l
> 11697

> This is all done on a Ryzen 9 5950X with a 2TB Samsung 980 Pro NVMe and
> 64GB of RAM.

If I had a desktop I'd probably have major hardware jealousy at this point. :-)

                                Jim



More information about the SlackBuilds-users mailing list