[Slackbuilds-users] template find/chmod RFC

Jim zsd+slackbuilds at jdvb.ca
Mon Aug 3 00:12:34 UTC 2026


On Sun, Aug  2, 2026 at 18:43 (-0400), B. Watson wrote:


> RFC for new find/chmod in the SBo templates
> ===========================================

> Please respond to this, if you have any opinion at all (for or
> against the proposed change).

> The existing template code:

> ----------------------------------------------------------------------
> find -L . \
>  \( -perm 777 -o -perm 775 -o -perm 750 -o -perm 711 -o -perm 555 \
>   -o -perm 511 \) -exec chmod 755 {} \; -o \
>  \( -perm 666 -o -perm 664 -o -perm 640 -o -perm 600 -o -perm 444 \
>   -o -perm 440 -o -perm 400 \) -exec chmod 644 {} \;
> ----------------------------------------------------------------------

I've long thought that code was a bit painful to read.  FWIW, I support
changing it.

> The proposed replacement code:

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

                                Jim



More information about the SlackBuilds-users mailing list