From 5fddde06d34da3d42d04f4c5b9da78b05f3b98ea Mon Sep 17 00:00:00 2001 From: Joshua Root Date: Tue, 5 Dec 2023 23:14:20 +1100 Subject: [PATCH] Don't give mtree a uname or gname if non-root It can't enforce them in this case anyway, and some users are required to use nonstandard group names that mtree would error on. Closes: https://trac.macports.org/ticket/49501 Closes: https://github.com/macports/macports-base/pull/293 --- configure | 8 ++++++++ configure.ac | 7 +++++++ doc/base.mtree.in | 2 +- doc/prefix.mtree.in | 2 +- 4 files changed, 17 insertions(+), 2 deletions(-) diff --git a/configure b/configure index 270622c8f5..51faa27121 100755 --- a/configure +++ b/configure @@ -703,6 +703,7 @@ UNIVERSAL_ARCHS startupitem_install MPFRAMEWORKSDIR MPAPPLICATIONSDIR +MTREE_UGNAME DSTMODE RUNUSR DSTGRP @@ -7013,6 +7014,13 @@ printf "%s\n" "$DSTMODE" >&6; } fi +# Don't set uname or gname in .mtree files unless root +# https://trac.macports.org/ticket/49501 +if test "$DSTUSR" = "root" ; then + MTREE_UGNAME="uname=root gname=$DSTGRP" +fi + + # Check for default directories diff --git a/configure.ac b/configure.ac index a6d837ba30..ad12f72409 100644 --- a/configure.ac +++ b/configure.ac @@ -227,6 +227,13 @@ MP_CHECK_RUNUSER MP_DIRECTORY_MODE MP_SHARED_DIRECTORY +# Don't set uname or gname in .mtree files unless root +# https://trac.macports.org/ticket/49501 +if test "$DSTUSR" = "root" ; then + MTREE_UGNAME="uname=root gname=$DSTGRP" +fi +AC_SUBST(MTREE_UGNAME) + # Check for default directories MP_PATH_APPLICATIONS MP_PATH_FRAMEWORKS diff --git a/doc/base.mtree.in b/doc/base.mtree.in index a498b57d90..08b9ee2f54 100644 --- a/doc/base.mtree.in +++ b/doc/base.mtree.in @@ -1,7 +1,7 @@ # MacPorts filesystem hierarchy, for internal use only. Changes to this file will not stick across installations. # -/set type=dir uname=@DSTUSR@ gname=@DSTGRP@ mode=@DSTMODE@ +/set type=dir @MTREE_UGNAME@ mode=@DSTMODE@ . man type=link link=share/man .. diff --git a/doc/prefix.mtree.in b/doc/prefix.mtree.in index 104ce59a71..56aa7fe13f 100644 --- a/doc/prefix.mtree.in +++ b/doc/prefix.mtree.in @@ -1,6 +1,6 @@ # MacPorts filesystem hierarchy, for internal use only. Changes to this file will not stick across installations. -/set type=dir uname=@DSTUSR@ gname=@DSTGRP@ mode=@DSTMODE@ +/set type=dir @MTREE_UGNAME@ mode=@DSTMODE@ . bin ..