[Slackbuilds-users] template find/chmod RFC

Duncan Roe duncan_roe at optusnet.com.au
Mon Aug 3 01:52:37 UTC 2026


On Sun, Aug 02, 2026 at 09:12:34PM -0300, SlackBuilds wrote:
> 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
>
I think either way is a lot better than what we have now.

My preference is to avoid unnecessary writes to the file system, so I would
leave it as originally proposed.

Cheers ... Duncan.


More information about the SlackBuilds-users mailing list