extfs: use numeric (0/0) root user uid/gid in helpers instead of root/root

Non-Linux systems don't always name the user and group with uid/gid of 0
"root". On macOS group "wheel" has gid of 0 and group "root" doesn't exist. On
FreeBSD there is a user with gid of 0 named "toor". This causes user/group id
lookups in mc to fail and instead return the uid/gid of the current user.

Signed-off-by: Yury V. Zaytsev <yury@shurup.com>
This commit is contained in:
Yury V. Zaytsev 2024-08-29 20:34:12 +02:00
parent c869893f04
commit c94fe5ed18
10 changed files with 67 additions and 67 deletions

View File

@ -120,23 +120,23 @@ sub list
chop($stats = `apt-cache stats 2>/dev/null`);
chop($config = `apt-config dump 2>&1`);
$sz = length($check);
print "-r--r--r-- 1 root root $sz $DATE CHECK\n";
print "-r--r--r-- 1 0 0 $sz $DATE CHECK\n";
$sz = length($available);
print "-r--r--r-- 1 root root $sz $DATE AVAILABLE\n";
print "-r--r--r-- 1 0 0 $sz $DATE AVAILABLE\n";
$sz = length($stats);
print "-r--r--r-- 1 root root $sz $DATE STATS\n";
print "-r--r--r-- 1 0 0 $sz $DATE STATS\n";
$sz = length($config);
print "-r--r--r-- 1 root root $sz $DATE CONFIG\n";
print "-r--r--r-- 1 0 0 $sz $DATE CONFIG\n";
$sz = length($pressupdate);
print "-r-xr--r-- 1 root root $sz $DATE UPDATE\n";
print "-r-xr--r-- 1 0 0 $sz $DATE UPDATE\n";
$sz = length($pressupgrade);
print "-r-xr--r-- 1 root root $sz $DATE UPGRADE\n";
print "-r-xr--r-- 1 root root $sz $DATE DIST-UPGRADE\n";
print "-r-xr--r-- 1 0 0 $sz $DATE UPGRADE\n";
print "-r-xr--r-- 1 0 0 $sz $DATE DIST-UPGRADE\n";
ls("/etc/apt/sources.list","sources.list");
ls('/etc/apt/apt.conf','apt.conf') if (-f '/etc/apt/apt.conf');
print "drwxr-xr-x 1 root root 0 $DATE all\n";
print "drwxr-xr-x 1 0 0 0 $DATE all\n";
if ( open(PIPEIN, "find /var/cache/apt/archives -type f |") ) {
while(<PIPEIN>) {
@ -179,18 +179,18 @@ sub list
my $sub = $dn;
while( $sub =~ s!^(.*)/[^/]*$!$1! ) {
unless( $sects{$sub} ) {
print "drwxr-xr-x 1 root root 0 $DATE $sub/\n";
print "drwxr-xr-x 1 0 0 0 $DATE $sub/\n";
$sects{$sub} = 1;
}
}
print "drwxr-xr-x 1 root root 0 $DATE $dn/\n";
print "drwxr-xr-x 1 0 0 0 $DATE $dn/\n";
$sects{$dn} = 1;
}
$sz = $debd{$pkg}{'status'} =~ /config-files/ ? 0 : $debd{$pkg}{'installed-size'} * 1024;
@stat = stat("/var/lib/dpkg/info/".$debd{$pkg}{package}.".list");
$bt = bt($stat[9]);
print "-rw-r--r-- 1 root root $sz $bt $dn/$fn.debd\n";
print "lrwxrwxrwx 1 root root $sz $bt all/$fn.debd -> ../$dn/$fn.debd\n";
print "-rw-r--r-- 1 0 0 $sz $bt $dn/$fn.debd\n";
print "lrwxrwxrwx 1 0 0 $sz $bt all/$fn.debd -> ../$dn/$fn.debd\n";
}
open STAT, "apt-cache dumpavail |"
@ -219,16 +219,16 @@ sub list
my $sub = $dn;
while( $sub =~ s!^(.*)/[^/]*$!$1! ) {
unless( $sects{$sub} ) {
print "drwxr-xr-x 1 root root 0 $DATE $sub/\n";
print "drwxr-xr-x 1 0 0 0 $DATE $sub/\n";
$sects{$sub} = 1;
}
}
print "drwxr-xr-x 1 root root 0 $DATE $dn/\n";
print "drwxr-xr-x 1 0 0 0 $DATE $dn/\n";
$sects{$dn} = 1;
}
$sz = $deba{$pkg}{'status'} =~ /config-files/ ? 0 : $deba{$pkg}{'installed-size'} * 1024;
print "-rw-r--r-- 1 root root $sz $DATE $dn/$fn.deba\n";
print "lrwxrwxrwx 1 root root $sz $DATE all/$fn.deba -> ../$dn/$fn.deba\n";
print "-rw-r--r-- 1 0 0 $sz $DATE $dn/$fn.deba\n";
print "lrwxrwxrwx 1 0 0 $sz $DATE all/$fn.deba -> ../$dn/$fn.deba\n";
}
}

View File

@ -14,8 +14,8 @@ export LC_TIME
mcbppfs_list ()
{
FILEPREF="-r--r--r-- 1 root root "
FIEXPREF="-r-xr-xr-x 1 root root "
FILEPREF="-r--r--r-- 1 0 0 "
FIEXPREF="-r-xr-xr-x 1 0 0 "
DATE=`date +"%b %d %H:%M"`
set x `ls -l "$1"`
size=$6

View File

@ -37,10 +37,10 @@ sub mcdebfs_list
chop($info_size=`dpkg -I $qarchivename | wc -c`);
$install_size=length($pressinstall);
print "dr-xr-xr-x 1 root root 0 $date CONTENTS\n";
print "dr-xr-xr-x 1 root root 0 $date DEBIAN\n";
print "-r--r--r-- 1 root root $info_size $date INFO\n";
print "-r-xr--r-- 1 root root $install_size $date INSTALL\n";
print "dr-xr-xr-x 1 0 0 0 $date CONTENTS\n";
print "dr-xr-xr-x 1 0 0 0 $date DEBIAN\n";
print "-r--r--r-- 1 0 0 $info_size $date INFO\n";
print "-r-xr--r-- 1 0 0 $install_size $date INSTALL\n";
if ( open(PIPEIN, "LC_ALL=C dpkg-deb -c $qarchivename |") )
{
@ -117,7 +117,7 @@ sub mcdebfs_list
$perm='-r--r--r--';
$name=$_[4];
}
print "$perm 1 root root $size $date DEBIAN/$name\n";
print "$perm 1 0 0 $size $date DEBIAN/$name\n";
}
}
}

View File

@ -21,14 +21,14 @@ sub list
$install_size=length($pressinstall);
$upgrade_size=length($pressupgrade);
print "-r--r--r-- 1 root root $info_size $date INFO\n";
print "-r--r--r-- 1 0 0 $info_size $date INFO\n";
chop($debd = `dpkg -s $qarchive | grep -i ^Version | sed 's/^version: //i'`);
chop($deba = `apt-cache show $qarchive | grep -i ^Version | sed 's/^version: //i'`);
if( ! $debd ) {
print "-r-xr--r-- 1 root root $install_size $date INSTALL\n";
print "-r-xr--r-- 1 0 0 $install_size $date INSTALL\n";
} elsif( $debd ne $deba ) {
print "-r-xr--r-- 1 root root $upgrade_size $date UPGRADE\n";
print "-r-xr--r-- 1 0 0 $upgrade_size $date UPGRADE\n";
}
}

View File

@ -120,30 +120,30 @@ sub list
$select_size=length($pressselect);
$unselect_size=length($pressunselect);
print "dr-xr-xr-x 1 root root 0 $date CONTENTS\n";
print "dr-xr-xr-x 1 root root 0 $date DEBIAN\n";
print "-r--r--r-- 1 root root $info_size $date INFO\n";
print "-r-xr--r-- 1 root root $purge_size $date DPKG-PURGE\n";
print "dr-xr-xr-x 1 0 0 0 $date CONTENTS\n";
print "dr-xr-xr-x 1 0 0 0 $date DEBIAN\n";
print "-r--r--r-- 1 0 0 $info_size $date INFO\n";
print "-r-xr--r-- 1 0 0 $purge_size $date DPKG-PURGE\n";
chop($status = `dpkg -s $qarchive | grep ^Status`);
if( $status =~ /deinstall/ ) {
print "-r-xr--r-- 1 root root $select_size $date DPKG-SELECT\n";
print "-r-xr--r-- 1 0 0 $select_size $date DPKG-SELECT\n";
} elsif( $status =~ /install/ ) {
print "-r-xr--r-- 1 root root $unselect_size $date DPKG-UNSELECT\n";
print "-r-xr--r-- 1 0 0 $unselect_size $date DPKG-UNSELECT\n";
}
if( $status !~ /config-files/ ) {
if ( -x "/usr/bin/dpkg-repack" ) {
print "-r-xr--r-- 1 root root $repack_size $date DPKG-REPACK\n";
print "-r-xr--r-- 1 0 0 $repack_size $date DPKG-REPACK\n";
}
print "-r-xr--r-- 1 root root $remove_size $date DPKG-REMOVE\n";
print "-r-xr--r-- 1 0 0 $remove_size $date DPKG-REMOVE\n";
if ( -x "/usr/bin/apt-get" ) {
print "-r-xr--r-- 1 root root $remove_size $date APT-REMOVE\n";
print "-r-xr--r-- 1 root root $reinstall_size $date APT-REINSTALL\n";
print "-r-xr--r-- 1 root root $purge_size $date APT-PURGE\n";
print "-r-xr--r-- 1 0 0 $remove_size $date APT-REMOVE\n";
print "-r-xr--r-- 1 0 0 $reinstall_size $date APT-REINSTALL\n";
print "-r-xr--r-- 1 0 0 $purge_size $date APT-PURGE\n";
}
}
if( -x "/usr/bin/dpkg-reconfigure" && -x "/var/lib/dpkg/info/$archive.config" ) {
print "-r-xr--r-- 1 root root $reconfigure_size $date DPKG-RECONFIGURE\n";
print "-r-xr--r-- 1 0 0 $reconfigure_size $date DPKG-RECONFIGURE\n";
}

View File

@ -123,27 +123,27 @@ sub list
chop($getselections = `dpkg --get-selections 2>/dev/null`);
chop($audit = `dpkg --audit 2>/dev/null`);
$sz = length($diversions);
print "-r--r--r-- 1 root root $sz $DATE DIVERSIONS\n";
print "-r--r--r-- 1 0 0 $sz $DATE DIVERSIONS\n";
$sz = length($architecture);
print "-r--r--r-- 1 root root $sz $DATE ARCHITECTURE\n";
print "-r--r--r-- 1 0 0 $sz $DATE ARCHITECTURE\n";
$sz = length($list);
print "-r--r--r-- 1 root root $sz $DATE LIST\n";
print "-r--r--r-- 1 0 0 $sz $DATE LIST\n";
$sz = length($getselections);
print "-r--r--r-- 1 root root $sz $DATE GET-SELECTIONS\n";
print "-r--r--r-- 1 0 0 $sz $DATE GET-SELECTIONS\n";
$sz = length($audit);
print "-r--r--r-- 1 root root $sz $DATE AUDIT\n";
print "-r--r--r-- 1 0 0 $sz $DATE AUDIT\n";
$sz = length($pressconfigure);
print "-r-xr--r-- 1 root root $sz $DATE CONFIGURE\n";
print "-r-xr--r-- 1 0 0 $sz $DATE CONFIGURE\n";
$sz = length($pressremove);
print "-r-xr--r-- 1 root root $sz $DATE REMOVE\n";
print "-r-xr--r-- 1 0 0 $sz $DATE REMOVE\n";
$sz = length($pressclearavail);
print "-r-xr--r-- 1 root root $sz $DATE CLEAR-AVAIL\n";
print "-r-xr--r-- 1 0 0 $sz $DATE CLEAR-AVAIL\n";
$sz = length($pressforgetoldunavail);
print "-r-xr--r-- 1 root root $sz $DATE FORGET-OLD-UNAVAIL\n";
print "-r-xr--r-- 1 0 0 $sz $DATE FORGET-OLD-UNAVAIL\n";
ls("/var/lib/dpkg/status","STATUS","-r--r--r--");
# ls("/var/lib/dpkg/available","AVAILABLE","-r--r--r--");
print "drwxr-xr-x 1 root root 0 $DATE all\n";
print "drwxr-xr-x 1 0 0 0 $DATE all\n";
open STAT, "/var/lib/dpkg/status"
or exit 1;
@ -171,18 +171,18 @@ sub list
my $sub = $dn;
while( $sub =~ s!^(.*)/[^/]*$!$1! ) {
unless( $sects{$sub} ) {
print "drwxr-xr-x 1 root root 0 $DATE $sub/\n";
print "drwxr-xr-x 1 0 0 0 $DATE $sub/\n";
$sects{$sub} = 1;
}
}
print "drwxr-xr-x 1 root root 0 $DATE $dn/\n";
print "drwxr-xr-x 1 0 0 0 $DATE $dn/\n";
$sects{$dn} = 1;
}
$sz = $debs{$pkg}{'status'} =~ /config-files/ ? 0 : $debs{$pkg}{'installed-size'} * 1024;
@stat = stat("/var/lib/dpkg/info/".$debs{$pkg}{package}.".list");
$bt = bt($stat[9]);
print "-rw-r--r-- 1 root root $sz $bt $dn/$fn.debd\n";
print "lrwxrwxrwx 1 root root $sz $bt all/$fn.debd -> ../$dn/$fn.debd\n";
print "-rw-r--r-- 1 0 0 $sz $bt $dn/$fn.debd\n";
print "lrwxrwxrwx 1 0 0 $sz $bt all/$fn.debd -> ../$dn/$fn.debd\n";
}
}

View File

@ -217,7 +217,7 @@ BEGIN {
attr=substr($0, 1, length($0)-length(name))
# strip inodes and extra dir entries; fix perms
sub(irx, "", name)
sub("^---------- 0 0 0", "-r--r--r-- 1 root root", attr)
sub("^---------- 0 0 0", "-r--r--r-- 1 0 0 ", attr)
sub(" $", "", name)
# for Joliet UCS level 3
if (SEMICOLON == "YES") sub(";1$", "", name);

View File

@ -74,7 +74,7 @@ SED="sed"
param=$1; shift
rpm_filename=$1; shift
FILEPREF="-r--r--r-- 1 root root "
FILEPREF="-r--r--r-- 1 0 0 "
mcrpmfs_getDesription()
{
@ -135,7 +135,7 @@ mcrpmfs_list_fastRPM ()
echo "$FILEPREF 0 $DATE INFO/VENDOR"
echo "$FILEPREF 0 $DATE INFO/DESCRIPTION"
echo "$FILEPREF 0 $DATE INFO/SUMMARY"
echo "dr-xr-xr-x 1 root root 0 $DATE INFO/SCRIPTS"
echo "dr-xr-xr-x 1 0 0 0 $DATE INFO/SCRIPTS"
echo "$FILEPREF 0 $DATE INFO/SCRIPTS/PRETRANS"
echo "$FILEPREF 0 $DATE INFO/SCRIPTS/POSTTRANS"
echo "$FILEPREF 0 $DATE INFO/SCRIPTS/PREIN"
@ -220,17 +220,17 @@ mcrpmfs_list ()
HEADERSIZE=`printf '%s\n' "$DESC" | wc -c` # 'echo' can't be used for arbitrary data (see commit message).
printf '%s %s %s HEADER\n' "${FILEPREF}" "${HEADERSIZE}" "${DATE}"
echo "-r-xr-xr-x 1 root root 0 $DATE INSTALL"
echo "-r-xr-xr-x 1 0 0 0 $DATE INSTALL"
case "${rpm_filename}" in
*.src.rpm)
echo "-r-xr-xr-x 1 root root 0 $DATE REBUILD"
echo "-r-xr-xr-x 1 0 0 0 $DATE REBUILD"
;;
*)
echo "-r-xr-xr-x 1 root root 0 $DATE UPGRADE"
echo "-r-xr-xr-x 1 0 0 0 $DATE UPGRADE"
;;
esac
echo "dr-xr-xr-x 3 root root 0 $DATE INFO"
echo "dr-xr-xr-x 3 0 0 0 $DATE INFO"
if [ `mcrpmfs_getRawOneTag "%{EPOCH}"` = "(none)" ]; then
echo "$FILEPREF 0 $DATE INFO/NAME-VERSION-RELEASE"
else

View File

@ -46,9 +46,9 @@ sub list
}
}
for $i (sort keys %files) {
print "dr-xr-xr-x 1 root root 0 $DATE $i/\n";
print "dr-xr-xr-x 1 0 0 0 $DATE $i/\n";
for $fn (sort @{$files{$i}}) {
print "-r--r--r-- 1 root root $sizes{$fn} $dates{$fn} $i/$fn.trpm\n";
print "-r--r--r-- 1 0 0 $sizes{$fn} $dates{$fn} $i/$fn.trpm\n";
}
}
}

View File

@ -33,13 +33,13 @@ mcrpmfs_list ()
if test -z "$MCFASTRPM"; then
MCFASTRPM=$MCFASTRPM_DFLT
fi
FILEPREF="-r--r--r-- 1 root root "
FILEPREF="-r--r--r-- 1 0 0 "
DESC=`$RPM -qi -- "$1"`
DATE=`$RPM -q --qf "%{BUILDTIME:date}" -- "$1" | cut -c 5-11,21-24`
HEADERSIZE=`echo "$DESC" | wc -c`
echo "-r--r--r-- 1 root root $HEADERSIZE $DATE HEADER"
echo "-r-xr-xr-x 1 root root 40 $DATE UNINSTALL"
echo "dr-xr-xr-x 3 root root 0 $DATE INFO"
echo "-r--r--r-- 1 0 0 $HEADERSIZE $DATE HEADER"
echo "-r-xr-xr-x 1 0 0 40 $DATE UNINSTALL"
echo "dr-xr-xr-x 3 0 0 0 $DATE INFO"
echo "$FILEPREF 0 $DATE INFO/NAME-VERSION-RELEASE"
echo "$FILEPREF 0 $DATE INFO/GROUP"
echo "$FILEPREF 0 $DATE INFO/BUILDHOST"
@ -54,7 +54,7 @@ mcrpmfs_list ()
test "`$RPM -q --qf \"%{SUMMARY}\" -- "$1"`" = "(none)" ||
echo "$FILEPREF 0 $DATE INFO/SUMMARY"
if test "`$RPM -q --qf \"%{RPMTAG_PREIN}%{RPMTAG_POSTIN}%{RPMTAG_PREUN}%{RPMTAG_POSTUN}%{VERIFYSCRIPT}\" -- "$1"`" != "(none)(none)(none)(none)(none)"; then
echo "dr-xr-xr-x 1 root root 0 $DATE INFO/SCRIPTS"
echo "dr-xr-xr-x 1 0 0 0 $DATE INFO/SCRIPTS"
test "`$RPM -q --qf \"%{RPMTAG_PREIN}\" -- "$1"`" = '(none)' ||
echo "$FILEPREF 0 $DATE INFO/SCRIPTS/PREIN"
test "`$RPM -q --qf \"%{RPMTAG_POSTIN}\" -- "$1"`" = '(none)' ||
@ -72,7 +72,7 @@ mcrpmfs_list ()
echo "$FILEPREF 0 $DATE INFO/VENDOR"
echo "$FILEPREF 0 $DATE INFO/DESCRIPTION"
echo "$FILEPREF 0 $DATE INFO/SUMMARY"
echo "dr-xr-xr-x 1 root root 0 $DATE INFO/SCRIPTS"
echo "dr-xr-xr-x 1 0 0 0 $DATE INFO/SCRIPTS"
echo "$FILEPREF 0 $DATE INFO/SCRIPTS/PREIN"
echo "$FILEPREF 0 $DATE INFO/SCRIPTS/POSTIN"
echo "$FILEPREF 0 $DATE INFO/SCRIPTS/PREUN"