summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjlam <jlam@pkgsrc.org>2007-07-04 19:18:12 +0000
committerjlam <jlam@pkgsrc.org>2007-07-04 19:18:12 +0000
commitc991b497a5e2287422db1b749779e3e9098af6e3 (patch)
tree66de8e2ca4b6d4d517a5625eb0806fff1c0f7e71
parent66b3ee2847e403f106d7257870d276084bcc2911 (diff)
downloadpkgsrc-c991b497a5e2287422db1b749779e3e9098af6e3.tar.gz
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.
-rw-r--r--regress/bootstrap-install-sh/Makefile31
1 files changed, 29 insertions, 2 deletions
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: