diff options
-rw-r--r-- | pkgtools/pkgtasks/Makefile | 4 | ||||
-rw-r--r-- | pkgtools/pkgtasks/files/NEWS.md | 15 | ||||
-rw-r--r-- | pkgtools/pkgtasks/files/README.md | 2 | ||||
-rwxr-xr-x | pkgtools/pkgtasks/files/build-aux/install-sh | 2 | ||||
-rwxr-xr-x | pkgtools/pkgtasks/files/configure | 20 | ||||
-rw-r--r-- | pkgtools/pkgtasks/files/configure.ac | 2 | ||||
-rw-r--r-- | pkgtools/pkgtasks/files/ocaml_findlib.subr | 17 | ||||
-rw-r--r-- | pkgtools/pkgtasks/files/refcount_file.subr | 32 | ||||
-rw-r--r-- | pkgtools/pkgtasks/files/shells.subr | 16 | ||||
-rw-r--r-- | pkgtools/pkgtasks/files/t/t_ocaml_findlib.sh | 59 | ||||
-rw-r--r-- | pkgtools/pkgtasks/files/t/t_shells.sh | 59 |
11 files changed, 175 insertions, 53 deletions
diff --git a/pkgtools/pkgtasks/Makefile b/pkgtools/pkgtasks/Makefile index 27e8d750825..a8f604da13f 100644 --- a/pkgtools/pkgtasks/Makefile +++ b/pkgtools/pkgtasks/Makefile @@ -1,6 +1,6 @@ -# $NetBSD: Makefile,v 1.6 2017/08/19 00:30:07 jlam Exp $ +# $NetBSD: Makefile,v 1.7 2017/08/23 17:53:19 jlam Exp $ -DISTNAME= pkgtasks-1-1.14 +DISTNAME= pkgtasks-1-1.15 CATEGORIES= pkgtools MASTER_SITES= # empty DISTFILES= # empty diff --git a/pkgtools/pkgtasks/files/NEWS.md b/pkgtools/pkgtasks/files/NEWS.md index d814f2953b1..107d3573a72 100644 --- a/pkgtools/pkgtasks/files/NEWS.md +++ b/pkgtools/pkgtasks/files/NEWS.md @@ -2,6 +2,19 @@ Package Tasks ============= +Changes in version 1.15 +----------------------- +**Released on 2017-08-23.** + +* Fix bug where the `ocaml_findlib` and `shells` tasks were not + preserving the ownership and permissions of existing system files + when updating their contents. + +* Relax the permissions of the files created by the `refcount_file` + implementation of the `refcount` task so that they are readable + by anyone. + + Changes in version 1.14 ----------------------- **Released on 2017-08-14.** @@ -15,7 +28,7 @@ Changes in version 1.13 **Released on 2017-08-08.** * Make the output messages for the `groups` and `users` tasks easier - to understand by making them slightly more verobse and changing + to understand by making them slightly more verbose and changing the formatting. diff --git a/pkgtools/pkgtasks/files/README.md b/pkgtools/pkgtasks/files/README.md index caafd1915f5..7318a370f5b 100644 --- a/pkgtools/pkgtasks/files/README.md +++ b/pkgtools/pkgtasks/files/README.md @@ -26,7 +26,7 @@ same entry more than once. Getting sources --------------- -The latest version of *pkgtasks* is 1.14 and was released on August 14th, 2017. +The latest version of *pkgtasks* is 1.15 and was released on August 23th, 2017. See the [release notes](NEWS.md) for information about the changes in this and all previous releases. diff --git a/pkgtools/pkgtasks/files/build-aux/install-sh b/pkgtools/pkgtasks/files/build-aux/install-sh index 341d6c498f9..7aec7e9fb0e 100755 --- a/pkgtools/pkgtasks/files/build-aux/install-sh +++ b/pkgtools/pkgtasks/files/build-aux/install-sh @@ -1,6 +1,6 @@ #!/bin/sh # -# $NetBSD: install-sh,v 1.4 2017/08/19 00:30:07 jlam Exp $ +# $NetBSD: install-sh,v 1.5 2017/08/23 17:53:19 jlam Exp $ # This script now also installs multiple files, but might choke on installing # multiple files with spaces in the file names. # diff --git a/pkgtools/pkgtasks/files/configure b/pkgtools/pkgtasks/files/configure index 84501924816..43ff8f7de13 100755 --- a/pkgtools/pkgtasks/files/configure +++ b/pkgtools/pkgtasks/files/configure @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.69 for pkgtasks-1 1.14. +# Generated by GNU Autoconf 2.69 for pkgtasks-1 1.15. # # Report bugs to <jlam@NetBSD.org>. # @@ -580,8 +580,8 @@ MAKEFLAGS= # Identity of this package. PACKAGE_NAME='pkgtasks-1' PACKAGE_TARNAME='pkgtasks-1' -PACKAGE_VERSION='1.14' -PACKAGE_STRING='pkgtasks-1 1.14' +PACKAGE_VERSION='1.15' +PACKAGE_STRING='pkgtasks-1 1.15' PACKAGE_BUGREPORT='jlam@NetBSD.org' PACKAGE_URL='' @@ -1209,7 +1209,7 @@ if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures pkgtasks-1 1.14 to adapt to many kinds of systems. +\`configure' configures pkgtasks-1 1.15 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1275,7 +1275,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of pkgtasks-1 1.14:";; + short | recursive ) echo "Configuration of pkgtasks-1 1.15:";; esac cat <<\_ACEOF @@ -1355,7 +1355,7 @@ fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -pkgtasks-1 configure 1.14 +pkgtasks-1 configure 1.15 generated by GNU Autoconf 2.69 Copyright (C) 2012 Free Software Foundation, Inc. @@ -1372,7 +1372,7 @@ cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by pkgtasks-1 $as_me 1.14, which was +It was created by pkgtasks-1 $as_me 1.15, which was generated by GNU Autoconf 2.69. Invocation command line was $ $0 $@ @@ -2242,7 +2242,7 @@ fi # Define the identity of the package. PACKAGE='pkgtasks-1' - VERSION='1.14' + VERSION='1.15' cat >>confdefs.h <<_ACEOF @@ -3078,7 +3078,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by pkgtasks-1 $as_me 1.14, which was +This file was extended by pkgtasks-1 $as_me 1.15, which was generated by GNU Autoconf 2.69. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -3131,7 +3131,7 @@ _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ -pkgtasks-1 config.status 1.14 +pkgtasks-1 config.status 1.15 configured by $0, generated by GNU Autoconf 2.69, with options \\"\$ac_cs_config\\" diff --git a/pkgtools/pkgtasks/files/configure.ac b/pkgtools/pkgtasks/files/configure.ac index fe4fbcac890..5c433c62047 100644 --- a/pkgtools/pkgtasks/files/configure.ac +++ b/pkgtools/pkgtasks/files/configure.ac @@ -26,7 +26,7 @@ dnl ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE dnl POSSIBILITY OF SUCH DAMAGE. dnl -AC_INIT([pkgtasks-1], [1.14], [jlam@NetBSD.org]) +AC_INIT([pkgtasks-1], [1.15], [jlam@NetBSD.org]) AC_CONFIG_AUX_DIR([build-aux]) diff --git a/pkgtools/pkgtasks/files/ocaml_findlib.subr b/pkgtools/pkgtasks/files/ocaml_findlib.subr index 89bb6f6ef32..976719a4db2 100644 --- a/pkgtools/pkgtasks/files/ocaml_findlib.subr +++ b/pkgtools/pkgtasks/files/ocaml_findlib.subr @@ -109,6 +109,7 @@ task_load quote task_ocaml_findlib() { + : ${CP:=cp} : ${MV:=mv} : ${OCAML_SITELIB:=lib/ocaml/site-lib} @@ -200,12 +201,15 @@ task_ocaml_findlib() task_quote "$temp" temp_quoted="$quoted" __task_ocaml_findlib_temps__="$__task_ocaml_findlib_temps__ $temp_quoted" - if [ ! -f "$ldconf" ]; then - echo "$libdir" + if [ -f "$ldconf" ]; then + # Preserve existing ownership and permissions onto tempfile. + ${CP} -fp "$ldconf" "$temp" + # Overwrite contents of tempfile. + { task_match -vw "$libdir" < $ldconf; echo "$libdir"; } > $temp else - task_match -vw "$libdir" < $ldconf - echo "$libdir" - fi > $temp + # Overwrite contents of tempfile. + echo "$libdir" > $temp + fi # rename(2) is atomic. if ${MV} -f "$temp" "$ldconf"; then $echo "${TASK_MSG}> path added: $libdir" @@ -225,6 +229,9 @@ task_ocaml_findlib() task_quote "$temp" temp_quoted="$quoted" __task_ocaml_findlib_temps__="$__task_ocaml_findlib_temps__ $temp_quoted" + # Preserve existing ownership and permissions onto tempfile. + ${CP} -fp "$ldconf" "$temp" + # Overwrite contents of tempfile. task_match -vw "$libdir" < $ldconf > $temp # rename(2) is atomic. if ${MV} -f "$temp" "$ldconf"; then diff --git a/pkgtools/pkgtasks/files/refcount_file.subr b/pkgtools/pkgtasks/files/refcount_file.subr index ba801152b66..3a0c7aacc07 100644 --- a/pkgtools/pkgtasks/files/refcount_file.subr +++ b/pkgtools/pkgtasks/files/refcount_file.subr @@ -214,6 +214,8 @@ _task_refcount_file_delete() _task_refcount_file_add() { + : ${CHMOD:=chmod} + : ${CP:=cp} : ${MV:=mv} local token= @@ -252,11 +254,17 @@ _task_refcount_file_add() task_quote "$temp" temp_quoted=$quoted __task_refcount_file_temps__="$__task_refcount_file_temps__ $temp_quoted" - { if [ -f "$countfile" ]; then - task_match -sv "$token" < $countfile - fi - echo "$token" - } > $temp + if [ -f "$countfile" ]; then + # Preserve existing ownership and permissions onto tempfile. + ${CP} -fp "$countfile" "$temp" + # Overwrite contents of tempfile. + { task_match -sv "$token" < $countfile; echo "$token"; } > $temp + else + # Overwrite contents of tempfile. + echo "$token" > $temp + # Relax permissions of new file. + ${CHMOD} go+r "$temp" + fi # rename(2) is atomic if ${MV} -f "$temp" "$countfile"; then __task_refcount_file_temps__=${__task_refcount_file_temps__% $temp_quoted} @@ -274,6 +282,7 @@ _task_refcount_file_add() _task_refcount_file_remove() { + : ${CP:=cp} : ${MV:=mv} : ${RM:=rm} : ${RMDIR:=rmdir} @@ -312,6 +321,9 @@ _task_refcount_file_remove() task_quote "$temp" temp_quoted=$quoted __task_refcount_file_temps__="$__task_refcount_file_temps__ $temp_quoted" + # Preserve existing ownership and permissions onto tempfile. + ${CP} -fp "$countfile" "$temp" + # Overwrite contents of tempfile. task_match -sv "$token" < $countfile > $temp local remaining= if [ -f "$temp" ]; then @@ -383,6 +395,8 @@ _task_refcount_file_prop_exists() _task_refcount_file_prop_put() { + : ${CHMOD:=chmod} + : ${CP:=cp} : ${MV:=mv} local db="$1"; shift @@ -408,6 +422,14 @@ _task_refcount_file_prop_put() task_quote "$temp" temp_quoted=$quoted __task_refcount_file_temps__="$__task_refcount_file_temps__ $temp_quoted" + if [ -f "$propfile" ]; then + # Preserve existing ownership and permissions onto tempfile. + ${CP} -fp "$propfile" "$temp" + else + # Relax permissions of new file. + ${CHMOD} go+r "$temp" + fi + # Overwrite contents of tempfile. local value if [ $# -gt 0 ]; then value="$@" diff --git a/pkgtools/pkgtasks/files/shells.subr b/pkgtools/pkgtasks/files/shells.subr index fef1d388f57..7b837f882b4 100644 --- a/pkgtools/pkgtasks/files/shells.subr +++ b/pkgtools/pkgtasks/files/shells.subr @@ -109,6 +109,7 @@ task_load truthy task_shells() { + : ${CP:=cp} : ${MV:=mv} : ${PKG_PREFIX:=/usr/pkg} @@ -199,12 +200,14 @@ task_shells() task_quote "$temp" temp_quoted="$quoted" __task_shells_temps__="$__task_shells_temps__ $temp_quoted" - if [ ! -f "$shelldb" ]; then - echo "$shell" + if [ -f "$shelldb" ]; then + # Preserve existing ownership and permissions onto tempfile. + ${CP} -fp "$shelldb" "$temp" + # Overwrite contents of tempfile. + { task_match -vw "$shell" < $shelldb; echo "$shell"; } > $temp else - task_match -vw "$shell" < $shelldb - echo "$shell" - fi > $temp + echo "$shell" > $temp + fi # rename(2) is atomic. if ${MV} -f "$temp" "$shelldb"; then $echo "${TASK_MSG}> shell added: $shell" @@ -226,6 +229,9 @@ task_shells() task_quote "$temp" temp_quoted="$quoted" __task_shells_temps__="$__task_shells_temps__ $temp_quoted" + # Preserve existing ownership and permissions onto tempfile. + ${CP} -fp "$shelldb" "$temp" + # Overwrite contents of tempfile. task_match -vw "$shell" < $shelldb > $temp # rename(2) is atomic. if ${MV} -f "$temp" "$shelldb"; then diff --git a/pkgtools/pkgtasks/files/t/t_ocaml_findlib.sh b/pkgtools/pkgtasks/files/t/t_ocaml_findlib.sh index 1e8cc0968a8..d0e3c0fa863 100644 --- a/pkgtools/pkgtasks/files/t/t_ocaml_findlib.sh +++ b/pkgtools/pkgtasks/files/t/t_ocaml_findlib.sh @@ -28,6 +28,7 @@ task_load createfile task_load makedir task_load ocaml_findlib +task_load permissions task_load unittest test_setup() @@ -110,6 +111,24 @@ test3() test4() { + : ${LS:=ls} + + describe="verify permissions" + task_makedir "${ldconf%/*}" + task_createfile -m 666 "$ldconf" + task_ocaml_findlib add < $datafile + if task_check_permissions "$ldconf" 666; then + : "success" + else + describe="$describe: wrong mode!" + ${LS} -l "$ldconf" + return 1 + fi + return 0 +} + +test5() +{ describe="check-add findlib dirs with all dirs added" task_ocaml_findlib add < $datafile if task_ocaml_findlib check-add < $datafile; then @@ -124,7 +143,7 @@ test4() return 0 } -test5() +test6() { describe="check-remove findlib dirs with no dirs removed" task_ocaml_findlib add < $datafile @@ -138,7 +157,7 @@ test5() return 0 } -test6() +test7() { describe="remove findlib dirs" task_ocaml_findlib add < $datafile @@ -154,7 +173,7 @@ test6() return 0 } -test7() +test8() { describe="verify empty ld.conf" task_ocaml_findlib add < $datafile @@ -171,7 +190,7 @@ test7() return 0 } -test8() +test9() { describe="check-remove findlib dirs with empty ld.conf" task_makedir "${ldconf%/*}" @@ -188,7 +207,7 @@ test8() return 0 } -test9() +test10() { describe="add findlib dirs with PKG_DESTDIR" test_destdir_setup @@ -212,7 +231,7 @@ test9() return 0 } -test10() +test11() { describe="verify uniqueness with PKG_DESTDIR" test_destdir_setup @@ -240,7 +259,25 @@ test10() return 0 } -test11() +test12() +{ + : ${LS:=ls} + + describe="verify permissions with PKG_DESTDIR" + task_makedir "${PKG_DESTDIR}${PKG_PREFIX}/${ldconf%/*}" + task_createfile -m 666 "${PKG_DESTDIR}${PKG_PREFIX}/$ldconf" + task_ocaml_findlib add < $datafile + if task_check_permissions "${PKG_DESTDIR}${PKG_PREFIX}/$ldconf" 666; then + : "success" + else + describe="$describe: wrong mode!" + ${LS} -l "${PKG_DESTDIR}${PKG_PREFIX}/$ldconf" + return 1 + fi + return 0 +} + +test13() { describe="check-add findlib dirs with all dirs added with PKG_DESTDIR" test_destdir_setup @@ -261,7 +298,7 @@ test11() return 0 } -test12() +test14() { describe="check-remove findlib dirs with no dirs removed with PKG_DESTDIR" test_destdir_setup @@ -280,7 +317,7 @@ test12() return 0 } -test13() +test15() { describe="remove findlib dirs with PKG_DESTDIR" test_destdir_setup @@ -301,7 +338,7 @@ test13() return 0 } -test14() +test16() { describe="verify empty ld.conf with PKG_DESTDIR" test_destdir_setup @@ -323,7 +360,7 @@ test14() return 0 } -test15() +test17() { describe="check-remove findlib dirs with empty ld.conf with PKG_DESTDIR" test_destdir_setup diff --git a/pkgtools/pkgtasks/files/t/t_shells.sh b/pkgtools/pkgtasks/files/t/t_shells.sh index bf72cc45d08..790721d9545 100644 --- a/pkgtools/pkgtasks/files/t/t_shells.sh +++ b/pkgtools/pkgtasks/files/t/t_shells.sh @@ -27,6 +27,7 @@ task_load createfile task_load makedir +task_load permissions task_load shells task_load unittest @@ -106,6 +107,24 @@ test3() test4() { + : ${LS:=ls} + + describe="verify permissions" + task_makedir "${shelldb%/*}" + task_createfile -m 666 "$shelldb" + task_shells add < $datafile + if task_check_permissions "$shelldb" 666; then + : "success" + else + describe="$describe: wrong permissions!" + ${LS} -l "$shelldb" + return 1 + fi + return 0 +} + +test5() +{ describe="check-add shells with all shells added" task_shells add < $datafile if task_shells check-add < $datafile; then @@ -120,7 +139,7 @@ test4() return 0 } -test5() +test6() { describe="check-remove shells with no shells removed" task_shells add < $datafile @@ -134,7 +153,7 @@ test5() return 0 } -test6() +test7() { describe="remove shells" task_shells add < $datafile @@ -150,7 +169,7 @@ test6() return 0 } -test7() +test8() { describe="verify empty shell database" task_shells add < $datafile @@ -166,7 +185,7 @@ test7() return 0 } -test8() +test9() { describe="check-remove shells with empty shell database" task_makedir "${shelldb%/*}" @@ -183,7 +202,7 @@ test8() return 0 } -test9() +test10() { describe="add shells with PKG_DESTDIR" test_destdir_setup @@ -203,7 +222,7 @@ test9() return 0 } -test10() +test11() { describe="verify uniqueness with PKG_DESTDIR" test_destdir_setup @@ -231,7 +250,25 @@ test10() return 0 } -test11() +test12() +{ + : ${LS:=ls} + + describe="verify permissions with PKG_DESTDIR" + task_makedir "${PKG_DESTDIR}${PKG_PREFIX}/${shelldb%/*}" + task_createfile -m 666 "${PKG_DESTDIR}${PKG_PREFIX}/$shelldb" + task_shells add < $datafile + if task_check_permissions "${PKG_DESTDIR}${PKG_PREFIX}/$shelldb" 666; then + : "success" + else + describe="$describe: wrong permissions!" + ${LS} -l "${PKG_DESTDIR}${PKG_PREFIX}/$shelldb" + return 1 + fi + return 0 +} + +test13() { describe="check-add shells with all shells added with PKG_DESTDIR" test_destdir_setup @@ -252,7 +289,7 @@ test11() return 0 } -test12() +test14() { describe="check-remove shells with no shells removed with PKG_DESTDIR" test_destdir_setup @@ -271,7 +308,7 @@ test12() return 0 } -test13() +test15() { describe="remove shells with PKG_DESTDIR" test_destdir_setup @@ -292,7 +329,7 @@ test13() return 0 } -test14() +test16() { describe="verify empty shell database" test_destdir_setup @@ -313,7 +350,7 @@ test14() return 0 } -test15() +test17() { describe="check-remove shells with empty shell database" test_destdir_setup |