pkgsrc-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[pkgsrc/trunk]: pkgsrc/regress regress/check-perms: add test for broken CHECK...
details: https://anonhg.NetBSD.org/pkgsrc/rev/095ba1af5e30
branches: trunk
changeset: 339982:095ba1af5e30
user: rillig <rillig%pkgsrc.org@localhost>
date: Thu Sep 19 23:53:36 2019 +0000
description:
regress/check-perms: add test for broken CHECK_PERMS_AUTOFIX
The variable CHECK_PERMS_AUTOFIX has been existing since 2006 but is not
used in any package. This may be because it is not helpful in any way.
When a package sets this variables to yes, the permission errors are not
silently fixed, but the build still fails instead. This behavior is not
useful in any way and thus needs to be fixed.
See https://mail-index.netbsd.org/tech-pkg/2019/08/thread1.html#021828
diffstat:
regress/Makefile | 3 +-
regress/check-perms/DESCR | 1 +
regress/check-perms/Makefile | 25 ++++++++++++++++++
regress/check-perms/PLIST | 2 +
regress/check-perms/spec | 58 ++++++++++++++++++++++++++++++++++++++++++++
5 files changed, 88 insertions(+), 1 deletions(-)
diffs (119 lines):
diff -r 0427037cccb2 -r 095ba1af5e30 regress/Makefile
--- a/regress/Makefile Thu Sep 19 21:59:36 2019 +0000
+++ b/regress/Makefile Thu Sep 19 23:53:36 2019 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.24 2019/07/17 18:34:16 rillig Exp $
+# $NetBSD: Makefile,v 1.25 2019/09/19 23:53:36 rillig Exp $
#
# See https://www.netbsd.org/docs/pkgsrc/regression.html for more
# information about these tests.
@@ -11,6 +11,7 @@
SUBDIR+= buildlink-libtool
SUBDIR+= buildlink-transform
SUBDIR+= buildlink-unwrap
+SUBDIR+= check-perms
SUBDIR+= check-portability
SUBDIR+= compiler
SUBDIR+= env-vars
diff -r 0427037cccb2 -r 095ba1af5e30 regress/check-perms/DESCR
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/regress/check-perms/DESCR Thu Sep 19 23:53:36 2019 +0000
@@ -0,0 +1,1 @@
+Regression test for mk/check/check-perms.mk.
diff -r 0427037cccb2 -r 095ba1af5e30 regress/check-perms/Makefile
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/regress/check-perms/Makefile Thu Sep 19 23:53:36 2019 +0000
@@ -0,0 +1,25 @@
+# $NetBSD: Makefile,v 1.1 2019/09/19 23:53:36 rillig Exp $
+
+DISTNAME= check-perms-1.0
+CATEGORIES= regress
+MASTER_SITES= # none
+DISTFILES= # none
+
+MAINTAINER= pkgsrc-users%NetBSD.org@localhost
+COMMENT= Ensures that wrong file permissions are fixed
+LICENSE= 2-clause-bsd
+
+NO_CHECKSUM= yes
+WRKSRC= ${WRKDIR}
+BUILD_DIRS= # none
+AUTO_MKDIRS= yes
+
+USE_TOOLS+= pax
+
+do-extract:
+ cd ${WRKSRC} && > demo-file && chmod 777 demo-file
+
+do-install:
+ cd ${WRKSRC} && pax -wr -pp demo-file ${DESTDIR}${PREFIX}/share/regress-check-perms/
+
+.include "../../mk/bsd.pkg.mk"
diff -r 0427037cccb2 -r 095ba1af5e30 regress/check-perms/PLIST
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/regress/check-perms/PLIST Thu Sep 19 23:53:36 2019 +0000
@@ -0,0 +1,2 @@
+@comment $NetBSD: PLIST,v 1.1 2019/09/19 23:53:36 rillig Exp $
+share/regress-check-perms/demo-file
diff -r 0427037cccb2 -r 095ba1af5e30 regress/check-perms/spec
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/regress/check-perms/spec Thu Sep 19 23:53:36 2019 +0000
@@ -0,0 +1,58 @@
+#! /bin/sh
+# $NetBSD: spec,v 1.1 2019/09/19 23:53:36 rillig Exp $
+set -eu
+
+do_cleanup() {
+ $TEST_MAKE deinstall clean
+}
+
+do_make() {
+ echo "Running test case $*"
+
+ #$TEST_MAKE "$@" show-all-check-perms
+
+ $TEST_MAKE "$@" deinstall clean install 1>"$TEST_OUTFILE" 2>&1 \
+ && TEST_EXITSTATUS=0 || TEST_EXITSTATUS=$?
+}
+
+test_no_developer_no_autofix() {
+ do_make PKG_DEVELOPER=no CHECK_PERMS_AUTOFIX=no
+
+ exit_status 0
+}
+
+test_no_developer_autofix() {
+ do_make PKG_DEVELOPER=no CHECK_PERMS_AUTOFIX=yes
+
+ # FIXME: The permissions must be fixed even though PKG_DEVELOPER=no.
+ exit_status 0
+ output_prohibit "^error: .*: world-writable file"
+}
+
+test_developer_no_autofix() {
+ do_make PKG_DEVELOPER=yes CHECK_PERMS_AUTOFIX=no
+
+ exit_status 1
+ output_require "^warning: .*/demo-file: too small to be a valid executable file"
+ output_require "^warning: .*/demo-file: group-writable file"
+ output_require "^error: .*/demo-file: world-writable file"
+}
+
+test_developer_autofix() {
+ do_make PKG_DEVELOPER=yes CHECK_PERMS_AUTOFIX=yes
+
+ # FIXME: Since all permission problems have been fixed, the exit status must be 0.
+ # This needs to be fixed in checkperms upstream.
+ exit_status 1
+ output_require "^warning: .*/demo-file: too small to be a valid executable file"
+ output_require "^warning: .*/demo-file: group-writable file"
+ output_require "^error: .*/demo-file: world-writable file"
+ output_require "^note: .*/demo-file: fixed permissions from 0777 to 0644"
+}
+
+do_test() {
+ test_no_developer_no_autofix
+ test_no_developer_autofix
+ test_developer_no_autofix
+ test_developer_autofix
+}
Home |
Main Index |
Thread Index |
Old Index