[Slackbuilds-users] template idea: --no-same-owner
Christoph Willing
chris.willing at linux.com
Sun Aug 9 23:43:59 UTC 2026
On 10/8/26 07:28, B. Watson wrote:
>
> So the templates all do this:
>
> rm -rf $PRGNAM-$VERSION
> tar xvf $CWD/$PRGNAM-$VERSION.tar.gz
> cd $PRGNAM-$VERSION
> chown -R root:root .
>
> ...but looking at the tar man page, there's this:
>
> --no-same-owner
> Extract files as yourself (default for ordinary users).
>
> ...which would extract the tarball and set the ownership to root:root
> in one step. I don't know when this option got added to tar, but it
> seems like using it would simplify things (do the same job in less
> code).
>
> So the template would look something like:
>
> rm -rf $PRGNAM-$VERSION
> tar xvf $CWD/$PRGNAM-$VERSION.tar.gz --no-same-owner
> cd $PRGNAM-$VERSION
>
> There's also this:
>
> --no-same-permissions
> Apply the user's umask when extracting permissions from the
> archive (default for or‐
> dinary users).
>
> ...which might substitute for (or at least simplify) the find/chmod
> stuff.
>
> Thoughts?
Good idea.
I tried the --no-same-owner thing on some of the SlackBuilds I use a
while back and the only reason I didn't persist was the need to update
them all after each weekly SBo update.
The main reason I was playing with it at all was that, when using a
docker container for building, tar extraction would sometimes fail
because files would be extracted to illegal uid or gid. In reality, that
could have been due to faulty /etc/sub{git,uid} settings but using
--no-same-owner overcame the problem for me.
chris
More information about the SlackBuilds-users
mailing list