mirror of
https://git.savannah.gnu.org/git/coreutils.git
synced 2026-11-19 03:33:43 +03:00
A cross-partition move of a file in a sticky tmpdir and owned by another user would evoke an invalid diagnostic after copying it: mv: cannot remove `x': Operation not permitted Either of the following (mv.c, remove.c) changes would fix the bug by itself. I think it's slightly better to use both; the added cost is minimal: mv: an extra lstat-per-mv-cmdline-arg-that-goes-cross-partition, rm: an extra lstat-per-unlink-that-fails-w/EPERM. * src/remove.c (remove_entry): Also lstat the file upon EPERM. * src/mv.c (rm_option_init): Initialize root_dev_ino just as is done in rm, so that a cross-partition invoked remove.c:rm call works the same way as one invoked from the command-line use of "rm". That setting of root_dev_ino makes rm() do the equivalent of an additional lstat for each argument, which in turn gives rm enough information to issue the right diagnostic. * tests/mv/sticky-to-xpart (version): New file. Test for the above. * tests/mv/Makefile.am (TESTS): Add sticky-to-xpart. Arrange for "make check-root" to run the new root-only test. * tests/Makefile.am (tb): New target, to run the new root-only test. (all_t): Add tb. * src/c99-to-c89.diff: Adjust offsets.
89 lines
2.3 KiB
Makefile
89 lines
2.3 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
|
|
|
|
built_programs = (cd ../src && MAKEFLAGS= $(MAKE) -s built_programs.list)
|
|
|
|
TESTS = help-version
|
|
TESTS_ENVIRONMENT = \
|
|
built_programs="`$(built_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 \
|
|
CuTmpdir.pm \
|
|
Makefile.am.in \
|
|
README \
|
|
acl \
|
|
check.mk \
|
|
envvar-check \
|
|
expensive \
|
|
group-names \
|
|
input-tty \
|
|
lang-default \
|
|
mk-script \
|
|
mkdtemp \
|
|
other-fs-tmpdir \
|
|
priv-check \
|
|
rwx-to-mode \
|
|
sample-test \
|
|
selinux \
|
|
setgid-check \
|
|
sparse-file \
|
|
strace \
|
|
test-lib.sh \
|
|
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 du head \
|
|
install join ln ls misc mkdir mv pr readlink rm rmdir \
|
|
sort tac tail tail-2 test touch tr \
|
|
uniq wc
|
|
## N O T E :: Please do not add new directories.
|
|
|
|
all_t = t1 t2 t3 t4 t5 t6 t7 t8 t9 ta tb
|
|
.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
|
|
t9:
|
|
cd cp && $(MAKE) check TESTS=cp-a-selinux
|
|
ta:
|
|
cd mkdir && $(MAKE) check TESTS=writable-under-readonly
|
|
tb:
|
|
cd mv && $(MAKE) check TESTS=sticky-to-xpart
|
|
|
|
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 '***********************************************************'
|