mirror of
git://git.sv.gnu.org/coreutils.git
synced 2026-04-12 06:57:33 +02:00
I started with the patches from Red Hat. The entries below tell how the code evolved. * src/ls.c (print_long_format, print_file_name_and_frills): When there is no security context (due to getfilecon/lgetfilecon failing with e.g. ENOTSUP), print it as "?", not "". * src/ls.c (print_file_name_and_frills): Make -Z work without -l. (length_of_file_name_and_frills): Likewise. * src/ls.c: Remove the --lcontext and --scontext options. Change the way -Z, --context work so that it no longer implies -l. Thus, -Z -l will work like -lcontext and -Z without -l will work like --scontext. Adjust tests to reflect new 'ls -l' syntax -- affects only systems with SELinux when operating on a file with no ACL. These tests assumed that everything before the first space on each line is the 10-byte mode string. But there may also be a "+" in the 11th column, just before the space. However, note that this is not new. The same thing would have happened even without the change below, when listing a file with an ACL. * tests/chmod/equals, tests/cp/cp-parents, tests/cp/fail-perm: * tests/cp/link-preserve, tests/install/basic-1, tests/misc/mknod: * tests/mkdir/parents, tests/mkdir/special-1, tests/mv/partition-perm: Don't make compilation depend on USE_ACL. An SELinux security context counts as an "alternate access control method", so ls must output a "+" for each file with a security context. * src/ls.c [struct fileinfo] (have_acl): Declare unconditionally. (FILE_HAS_ACL): Remove macro definition. Use f->have_acl directly. (gobble_file): Record whether a file has a security context, and update the condition used to determine whether to print the "+". (gobble_file): Call getfilecon/lgetfilecon also when format == long_format, so that we get the "+". * src/ls.c (gobble_file): Add a comment explaining why (with a security context option) ls doesn't exit nonzero due to e.g., getfilecon failing with errno == ENOTSUP. * src/ls.c (gobble_file): Ignore failure of getfilecon if it's due to ENOTSUP. * src/ls.c (gobble_file): Factor out three small blocks using getfilecon and lgetfilecon. Don't ignore return value from getfilecon and lgetfilecon. * src/ls.c (print_long_format): Don't use ?: (empty 2nd arg with C ternary operator). (print_scontext_format): Likewise. (print_scontext): Declare to be "bool", not int. Adjust uses. * src/Makefile.am (dir_LDADD, ls_LDADD, vdir_LDADD): Add $(LIB_SELINUX). * tests/misc/chcon: New file. * tests/misc/chcon-fail: New file. * tests/Makefile.am (check-root): Run new, root-only misc/chcon test. * tests/misc/Makefile.am (TESTS): Add chcon and chcon-fail. * tests/misc/Makefile.am (TESTS): Add selinux. * tests/misc/selinux: New file. * tests/help-version: Skip chcon.
63 lines
2.0 KiB
Makefile
63 lines
2.0 KiB
Makefile
## Process this file with automake to produce Makefile.in -*-Makefile-*-.
|
|
|
|
# Sort in traditional ASCII order, regardless of the current locale;
|
|
# otherwise we may get into trouble with distinct strings that the
|
|
# current locale considers to be equal.
|
|
ASSORT = LC_ALL=C sort
|
|
|
|
all_programs = (cd ../src && MAKEFLAGS= $(MAKE) -s all_programs.list)
|
|
|
|
TESTS = help-version
|
|
TESTS_ENVIRONMENT = \
|
|
all_programs="`$(all_programs)`" \
|
|
PACKAGE_BUGREPORT=$(PACKAGE_BUGREPORT) \
|
|
CU_TEST_NAME=`basename $(abs_srcdir)`,$$tst \
|
|
PATH="$(VG_PATH_PREFIX)`pwd`/../src$(PATH_SEPARATOR)$$PATH"
|
|
|
|
EXTRA_DIST = \
|
|
$(TESTS) Coreutils.pm Makefile.am.in README acl envvar-check \
|
|
expensive group-names input-tty lang-default mk-script \
|
|
other-fs-tmpdir priv-check \
|
|
rwx-to-mode sample-test setgid-check sparse-file \
|
|
umask-check very-expensive
|
|
|
|
## N O T E :: Please do not add new tests/ directories.
|
|
## There are too many already. Put new tests in misc/.
|
|
SUBDIRS = \
|
|
chgrp chmod chown cp cut dd dircolors du expr factor fmt head \
|
|
install join ln ls ls-2 md5sum misc mkdir mv od pr readlink rm rmdir \
|
|
seq sha1sum shred sort stty sum tac tail tail-2 tee test touch tr \
|
|
tsort unexpand uniq wc
|
|
## N O T E :: Please do not add new directories.
|
|
|
|
all_t = t1 t2 t3 t4 t5 t6 t7 t8
|
|
.PHONY: check-root $(all_t)
|
|
check-root: $(all_t)
|
|
|
|
t1:
|
|
cd chown && $(MAKE) check TESTS=basic
|
|
t2:
|
|
cd cp && $(MAKE) check TESTS=special-bits
|
|
t3:
|
|
cd rm && $(MAKE) check TESTS=no-give-up
|
|
t4:
|
|
cd rm && $(MAKE) check TESTS=fail-2eperm
|
|
t5:
|
|
cd tail-2 && $(MAKE) check TESTS=append-only
|
|
t6:
|
|
cd rm && $(MAKE) check TESTS=one-file-system
|
|
t7:
|
|
cd ls && $(MAKE) check TESTS=nameless-uid
|
|
t8:
|
|
cd misc && $(MAKE) check TESTS=chcon
|
|
|
|
check-recursive: root-hint
|
|
|
|
# Advertise `check-root' target.
|
|
.PHONY: root-hint
|
|
root-hint:
|
|
@echo '***********************************************************'
|
|
@echo "NOTICE: Some tests may be run only as root."
|
|
@echo " Do \`make check-root' as \`root' to run these tests."
|
|
@echo '***********************************************************'
|