[Slackbuilds-users] template find/chmod RFC

Jeremy Hansen jebrhansen+SBo at gmail.com
Mon Aug 3 18:38:36 UTC 2026


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. 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 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

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

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.

Jeremy

>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.slackbuilds.org/pipermail/slackbuilds-users/attachments/20260803/018c44e1/attachment-0001.htm>


More information about the SlackBuilds-users mailing list