From c84cd7f43a8b9f6ef4cced6ff8f289ccd6979288 Mon Sep 17 00:00:00 2001 From: jlam Date: Wed, 4 Jul 2007 19:18:12 +0000 Subject: Add a test to verify that nonexistent intermediate directories are created with the proper permissions. XXX sysutils/install-sh isn't quite right the same as /usr/bin/install XXX because it ignores the umask for directory creation. --- regress/bootstrap-install-sh/Makefile | 31 +++++++++++++++++++++++++++++-- 1 file changed, 29 insertions(+), 2 deletions(-) (limited to 'regress') diff --git a/regress/bootstrap-install-sh/Makefile b/regress/bootstrap-install-sh/Makefile index 69618c67e1e..219dba91e38 100644 --- a/regress/bootstrap-install-sh/Makefile +++ b/regress/bootstrap-install-sh/Makefile @@ -1,4 +1,4 @@ -# $NetBSD: Makefile,v 1.3 2007/06/20 16:26:20 jlam Exp $ +# $NetBSD: Makefile,v 1.4 2007/07/04 19:18:12 jlam Exp $ DISTNAME= bootstrap-install-sh-0.0 CATEGORIES= regress @@ -15,7 +15,7 @@ NO_BUILD= yes NO_INSTALL= yes NO_PACKAGE= yes -INSTALL_SH= ${WRKSRC}/install-sh +INSTALL_SH?= ${WRKSRC}/install-sh post-extract: ${CP} ${PKGSRCDIR}/sysutils/install-sh/files/install-sh.in ${WRKSRC} @@ -48,6 +48,30 @@ test-d3: ${TEST} -d ${WRKSRC}/d3_dir2 && \ ${TEST} -d ${WRKSRC}/d3_dir3 ) || exit 1 +# create one directory with several nonexistent intermediate directories +regress: test-d4 +test-d4: + ${INSTALL_SH} -d -m 700 ${WRKSRC}/d4_comp1/d4_comp2/d4_comp3/d4_final + ${TEST} -d ${WRKSRC}/d4_comp1/d4_comp2/d4_comp3/d4_final || exit 1 + ${FIND} ${WRKSRC}/d4_comp1 -type d -exec ${LS} -ld {} \; | \ + while read a b; do \ + case "$$b" in \ + */d4_final) \ + case "$$a" in \ + d${MODE_7}${MODE_0}${MODE_0}) \ + exit 0 ;; \ + *) exit 1 ;; \ + esac; \ + ;; \ + *) \ + case "$$a" in \ + ${MODE_DIR}) exit 0 ;; \ + *) exit 1 ;; \ + esac; \ + ;; \ + esac; \ + done + # copy one existing file to nonexistent file regress: test-c1 test-c1: @@ -96,6 +120,9 @@ MODE_5= r-x MODE_6= rw- MODE_7= rwx +# Convert ${PKGDIRMODE} into the appropriate "ls" output. +MODE_DIR= d${MODE_${PKGDIRMODE:C/(.)(.)(.)/\1/}}${MODE_${PKGDIRMODE:C/(.)(.)(.)/\2/}}${MODE_${PKGDIRMODE:C/(.)(.)(.)/\3/}} + # test mode permissions on installing file to nonexisting file regress: test-m1 test-m1: -- cgit v1.2.3