automatic version update by autodist [release 9.6-1mamba;Fri Jan 31 2025]

This commit is contained in:
Automatic Build System 2025-02-03 10:44:06 +01:00
parent c26754df5e
commit 1a339ede04
3 changed files with 4801 additions and 4706 deletions

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,98 @@
From 915004f403cb25fadb207ddfdbe6a2f43bd44fac Mon Sep 17 00:00:00 2001
From: =?utf8?q?P=C3=A1draig=20Brady?= <P@draigBrady.com>
Date: Fri, 17 Jan 2025 17:29:34 +0000
Subject: [PATCH] ls: fix crash with --context
* src/ls.c (main): Flag that we need to stat()
if we're going to get security context (call file_has_aclinfo_cache).
(file_has_aclinfo_cache): Be defensive and only lookup the device
for the file if the stat has been performed.
(has_capability_cache): Likewise.
* tests/ls/selinux-segfault.sh: Add a test case.
* NEWS: Mention the bug fix.
Reported by Bruno Haible.
---
NEWS | 5 +++++
src/ls.c | 10 +++++-----
tests/ls/selinux-segfault.sh | 3 +++
3 files changed, 13 insertions(+), 5 deletions(-)
diff --git a/NEWS b/NEWS
index 9be61e4c4..c9ba5f196 100644
--- a/NEWS
+++ b/NEWS
@@ -2,6 +2,11 @@ GNU coreutils NEWS -*- outline -*-
* Noteworthy changes in release ?.? (????-??-??) [?]
+** Bug fixes
+
+ `ls -Z dir` would crash.
+ [bug introduced in coreutils-9.6]
+
* Noteworthy changes in release 9.6 (2025-01-17) [stable]
diff --git a/src/ls.c b/src/ls.c
index 321536021..f67167f16 100644
--- a/src/ls.c
+++ b/src/ls.c
@@ -1768,7 +1768,7 @@ main (int argc, char **argv)
format_needs_stat = ((sort_type == sort_time) | (sort_type == sort_size)
| (format == long_format)
- | print_block_size | print_hyperlink);
+ | print_block_size | print_hyperlink | print_scontext);
format_needs_type = ((! format_needs_stat)
& (recursive | print_with_color | print_scontext
| directories_first
@@ -3309,7 +3309,7 @@ file_has_aclinfo_cache (char const *file, struct fileinfo *f,
static int unsupported_scontext_err;
static dev_t unsupported_device;
- if (f->stat.st_dev == unsupported_device)
+ if (f->stat_ok && f->stat.st_dev == unsupported_device)
{
ai->buf = ai->u.__gl_acl_ch;
ai->size = 0;
@@ -3322,7 +3322,7 @@ file_has_aclinfo_cache (char const *file, struct fileinfo *f,
errno = 0;
int n = file_has_aclinfo (file, ai, flags);
int err = errno;
- if (n <= 0 && !acl_errno_valid (err))
+ if (f->stat_ok && n <= 0 && !acl_errno_valid (err))
{
unsupported_return = n;
unsupported_scontext = ai->scontext;
@@ -3342,14 +3342,14 @@ has_capability_cache (char const *file, struct fileinfo *f)
found that has_capability fails indicating lack of support. */
static dev_t unsupported_device;
- if (f->stat.st_dev == unsupported_device)
+ if (f->stat_ok && f->stat.st_dev == unsupported_device)
{
errno = ENOTSUP;
return 0;
}
bool b = has_capability (file);
- if ( !b && !acl_errno_valid (errno))
+ if (f->stat_ok && !b && !acl_errno_valid (errno))
unsupported_device = f->stat.st_dev;
return b;
}
diff --git a/tests/ls/selinux-segfault.sh b/tests/ls/selinux-segfault.sh
index 11623acb3..1cac2b5fc 100755
--- a/tests/ls/selinux-segfault.sh
+++ b/tests/ls/selinux-segfault.sh
@@ -30,4 +30,7 @@ mkdir sedir || framework_failure_
ln -sf missing sedir/broken || framework_failure_
returns_ 1 ls -L -R -Z -m sedir > out || fail=1
+# ls 9.6 would segfault with the following
+ls -Z . > out || fail=1
+
Exit $fail
--
2.34.1

View File

@ -1,7 +1,7 @@
%define i18npatch_version %{version}
Name: coreutils
Version: 9.5
Release: 2mamba
Version: 9.6
Release: 1mamba
Summary: A GNU set of tools commonly used in shell scripts
Group: System/Tools
Vendor: openmamba
@ -14,6 +14,7 @@ Source1: coreutils-pam-su
Patch0: http://www.linuxfromscratch.org/patches/downloads/coreutils/coreutils-%{i18npatch_version}-i18n-1.patch
# or http://pkgs.fedoraproject.org/cgit/coreutils.git/plain/coreutils-i18n.patch
#Patch0: coreutils-8.22-i18n.patch
Patch1: coreutils-9.6-upstream-fix-crash-with-context.patch
License: GPL
## AUTOBUILDREQ-BEGIN
BuildRequires: glibc-devel
@ -81,56 +82,41 @@ These tools're the GNU versions of common useful and popular file and text utili
- modifying text file (spliting, joining, comparing, modifying, ...)
Most of these programs have significant advantages over their Unix counterparts, such as greater speed, additional options, and fewer arbitrary limits.
%debug_package
%prep
%setup -q
# lin18nux/LSB compliance
%patch 0 -p1 -b .i18n
%patch 1 -p1 -F2 -b .upstream-fix-crash-with-context
# From Fedora:
# FIXME: Force a newer gettext version to workaround `autoreconf -i` errors
# with coreutils 9.6 and bundled gettext 0.19.2 from gettext-common-devel.
sed -i 's/0.19.2/0.22.5/' bootstrap.conf configure.ac
autoreconf -fiv
# docs should say /var/run/[uw]tmp not /etc/[uw]tmp
sed -i 's,/etc/utmp,/var/run/utmp,g;
s,/etc/wtmp,/var/run/wtmp,g' doc/coreutils.texi
%build
export CFLAGS="%{optflags} -fpic -D_GNU_SOURCE=1"
# see: ./lib/config.h
CONFIG_OPTS="DEFAULT_POSIX2_VERSION=200112"
%if "%{_host}" != "%{_build}"
# disable help2man execution
sed -i "s|\.x\.1:|disabled.x.1:|" man/Makefile.in
cat > config.cache << _EOF
fu_cv_sys_stat_statvfs=yes
gl_cv_func_sleep_works=yes
_EOF
%endif
%configure ${CONFIG_OPTS} \
--sbindir=%{_bindir} \
--enable-install-program=arch \
--enable-no-install-program=hostname,kill,uptime \
%if "%{_host}" != "%{_build}"
--cache-file=config.cache
%endif
# export CPPFLAGS="-DUSE_PAM"
#LDFLAGS="-lpam -lpam_misc" \
%make all -j1 \
%if "%{_host}" != "%{_build}"
LIB_SELINUX="-lsepol -lselinux"
%endif
[ -f ChangeLog -a ! -f ChangeLog.bz2 ] && bzip2 -9f ChangeLog
%make all -j1
%install
[ "%{buildroot}" != / ] && rm -rf %{buildroot}
%makeinstall
# These tools come from other packages
for f in hostname groups kill uptime; do
for f in hostname kill uptime; do
rm -f %{buildroot}{%_bindir/$f,%_mandir/man1/${f}.1}
done
@ -158,6 +144,9 @@ rm -f %{buildroot}%{_infodir}/dir
%doc AUTHORS THANKS
%changelog
* Fri Jan 31 2025 Automatic Build System <autodist@openmamba.org> 9.6-1mamba
- automatic version update by autodist
* Sat Mar 30 2024 Silvan Calarco <silvan.calarco@mambasoft.it> 9.5-2mamba
- remove conflicting infodir dir file