pkgsrc-Changes archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

CVS commit: pkgsrc/regress



Module Name:    pkgsrc
Committed By:   rillig
Date:           Thu Sep 19 23:53:36 UTC 2019

Modified Files:
        pkgsrc/regress: Makefile
Added Files:
        pkgsrc/regress/check-perms: DESCR Makefile PLIST spec

Log Message:
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


To generate a diff of this commit:
cvs rdiff -u -r1.24 -r1.25 pkgsrc/regress/Makefile
cvs rdiff -u -r0 -r1.1 pkgsrc/regress/check-perms/DESCR \
    pkgsrc/regress/check-perms/Makefile pkgsrc/regress/check-perms/PLIST \
    pkgsrc/regress/check-perms/spec

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: pkgsrc/regress/Makefile
diff -u pkgsrc/regress/Makefile:1.24 pkgsrc/regress/Makefile:1.25
--- pkgsrc/regress/Makefile:1.24        Wed Jul 17 18:34:16 2019
+++ pkgsrc/regress/Makefile     Thu Sep 19 23:53:36 2019
@@ -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+=      bootstrap-install-sh
 SUBDIR+=       buildlink-libtool
 SUBDIR+=       buildlink-transform
 SUBDIR+=       buildlink-unwrap
+SUBDIR+=       check-perms
 SUBDIR+=       check-portability
 SUBDIR+=       compiler
 SUBDIR+=       env-vars

Added files:

Index: pkgsrc/regress/check-perms/DESCR
diff -u /dev/null pkgsrc/regress/check-perms/DESCR:1.1
--- /dev/null   Thu Sep 19 23:53:36 2019
+++ pkgsrc/regress/check-perms/DESCR    Thu Sep 19 23:53:36 2019
@@ -0,0 +1 @@
+Regression test for mk/check/check-perms.mk.
Index: pkgsrc/regress/check-perms/Makefile
diff -u /dev/null pkgsrc/regress/check-perms/Makefile:1.1
--- /dev/null   Thu Sep 19 23:53:36 2019
+++ pkgsrc/regress/check-perms/Makefile Thu Sep 19 23:53:36 2019
@@ -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"
Index: pkgsrc/regress/check-perms/PLIST
diff -u /dev/null pkgsrc/regress/check-perms/PLIST:1.1
--- /dev/null   Thu Sep 19 23:53:36 2019
+++ pkgsrc/regress/check-perms/PLIST    Thu Sep 19 23:53:36 2019
@@ -0,0 +1,2 @@
+@comment $NetBSD: PLIST,v 1.1 2019/09/19 23:53:36 rillig Exp $
+share/regress-check-perms/demo-file
Index: pkgsrc/regress/check-perms/spec
diff -u /dev/null pkgsrc/regress/check-perms/spec:1.1
--- /dev/null   Thu Sep 19 23:53:36 2019
+++ pkgsrc/regress/check-perms/spec     Thu Sep 19 23:53:36 2019
@@ -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