summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTheo Buehler <tb@cvs.openbsd.org>2017-02-18 18:27:13 +0000
committerTheo Buehler <tb@cvs.openbsd.org>2017-02-18 18:27:13 +0000
commit1d1cdb40482e7cba1643711c258d520c594c256f (patch)
treeb8124e5635bae7fba54846afaf96e319650c0ea1
parent1891e7aea83551a85522612583c0e7bc6cd2b275 (diff)
Add a regress test for the chflags problem analogous to the chmod bug
found by Christopher Wellons (see chmod.c r1.41).
-rw-r--r--regress/bin/chmod/Makefile15
1 files changed, 14 insertions, 1 deletions
diff --git a/regress/bin/chmod/Makefile b/regress/bin/chmod/Makefile
index 2857b1b7043..b4dc6be4b68 100644
--- a/regress/bin/chmod/Makefile
+++ b/regress/bin/chmod/Makefile
@@ -1,4 +1,4 @@
-# $OpenBSD: Makefile,v 1.2 2017/02/17 09:59:31 tb Exp $
+# $OpenBSD: Makefile,v 1.3 2017/02/18 18:27:12 tb Exp $
REGRESS_TARGETS= chmod_abs_0000 chmod_abs_0644
REGRESS_TARGETS+= chmod_sym_0644 chmod_sym_0000
@@ -25,6 +25,7 @@ REGRESS_TARGETS+= chown_error
REGRESS_TARGETS+= chflags chflags_no
REGRESS_TARGETS+= chflags_R chflags_RP chflags_RH chflags_RL
+REGRESS_TARGETS+= chflags_via_link
REGRESS_TARGETS+= chflags_error
prepfile: clean
@@ -459,6 +460,18 @@ chflags_RL: chflags_prepdir
@[ `/usr/bin/stat -f '%f' regress/dir` == '1' ]
@[ `/usr/bin/stat -f '%f' regress/link_target_file` == '1' ]
+chflags_via_link: chflags_prepfile
+ @echo chflags via link
+ @/bin/ln -s ${.OBJDIR}/regress/file ${.OBJDIR}/regress/link
+ @chflags -h uchg regress/link
+ @chflags nodump regress/link
+ @[ `stat -f '%f' regress/link` == '2' ]
+ @[ `stat -f '%f' regress/file` == '1' ]
+ @chflags -h nouchg regress/link
+ @chflags dump regress/link
+ @[ `stat -f '%f' regress/link` == '0' ]
+ @[ `stat -f '%f' regress/file` == '0' ]
+
chflags_error:
@echo chflags error
@/usr/bin/chflags foo bar 2> ${.OBJDIR}/chflags.error || /usr/bin/true