+2008-01-29 Jim Meyering <meyering@redhat.com>
+
+ ls: don't segfault on files in /proc with an old libselinux
+ * src/ls.c (gobble_file): Work around a bug in libselinux1-2.0.15
+ whereby getfilecon returns 0 yet sets the context to NULL.
+ Reported by Jan Moringen via Michael Stone in
+ http://bugs.debian.org/463043
+ * tests/ls/Makefile.am (TESTS): Add proc-selinux-segfault.
+ * tests/ls/proc-selinux-segfault: Test for the above fix.
+ * NEWS: Mention the fix.
+
2008-01-26 Jim Meyering <meyering@redhat.com>
Work around Darwin9's set-GID-like group ownership inheritance.
** Bug fixes
+ ls no longer segfaults on files in /proc when linked with an older version
+ of libselinux. E.g., ls -l /proc/sys would dereference a NULL pointer.
+
Fix a non-portable use of sed in configure.ac.
[bug introduced in coreutils-6.9.92]
Jamie Lokier jamie@imbolc.ucc.ie
Jamie McClelland jm@mayfirst.org
Jan Fedak J.Fedak@sh.cvut.cz
+Jan Moringen jan.moringen@uni-bielefeld.de
Jan Nieuwenhuizen janneke@gnu.org
Janos Farkas chexum@shadow.banki.hu
Jarkko Hietaniemi jhi@epsilon.hut.fi
/* `dir', `vdir' and `ls' directory listing programs for GNU.
- Copyright (C) 85, 88, 90, 91, 1995-2007 Free Software Foundation, Inc.
+ Copyright (C) 85, 88, 90, 91, 1995-2008 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
: lgetfilecon (absolute_name, &f->scontext));
err = (attr_len < 0);
+ /* Contrary to its documented API, getfilecon may return 0,
+ yet set f->scontext to NULL (on at least Debian's libselinux1
+ 2.0.15-2+b1), so work around that bug.
+ FIXME: remove this work-around in 2011, or whenever affected
+ versions of libselinux are long gone. */
+ if (attr_len == 0)
+ {
+ err = 0;
+ f->scontext = xstrdup ("unlabeled");
+ }
+
if (err == 0)
have_acl = ! STREQ ("unlabeled", f->scontext);
else
# Make coreutils tests for "ls". -*-Makefile-*-
-# Copyright (C) 1997-2003, 2006-2007 Free Software Foundation, Inc.
+# Copyright (C) 1997-2003, 2006-2008 Free Software Foundation, Inc.
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# along with this program. If not, see <http://www.gnu.org/licenses/>.
TESTS = \
+ proc-selinux-segfault \
stat-free-symlinks \
nameless-uid \
color-dtype-dir \
--- /dev/null
+#!/bin/sh
+# ls -l /proc/sys would segfault when built against libselinux1 2.0.15-2+b1
+
+# Copyright (C) 2008 Free Software Foundation, Inc.
+
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+if test "$VERBOSE" = yes; then
+ set -x
+ ls --version
+fi
+
+. $srcdir/../envvar-check
+. $srcdir/../test-lib.sh
+
+f=/proc/sys
+test -r $f || f=.
+
+fail=0
+ls -l $f > out || fail=1
+
+(exit $fail); exit $fail