summaryrefslogtreecommitdiff
path: root/tests/install/basic-1
diff options
context:
space:
mode:
authorPaul Eggert <eggert@cs.ucla.edu>2006-09-16 20:03:56 +0000
committerPaul Eggert <eggert@cs.ucla.edu>2006-09-16 20:03:56 +0000
commitb67faf329cebf0805b2b73cc775ccfc7a05390de (patch)
tree61071dc36a049a4685e757f637bc36ac928ade0e /tests/install/basic-1
parentadbad7626cbbf81745482b4ddb4a0bcea97a6db6 (diff)
downloadcoreutils-b67faf329cebf0805b2b73cc775ccfc7a05390de.tar.xz
* NEWS: Document that mkdir -p and install -d now fork on occasion.
* bootstrap.conf (gnulib_modules): Add savewd. * src/install.c: Include savewd.h. (process_dir): New function. (main, install_file_in_file_parents): Use it, along with the new savewd module, to avoid some race conditions. * src/mkdir.c: Include savewd.h. (struct mkdir_options): New members make_ancestor_function, mode, mode_bits. (make_ancestor): Return 1 if the resulting directory is not readable. (process_dir): New function. (main): Use it, along with new savewd module, to avoid some race conditions. Fill in new slots of struct mkdir_options, so that callees get the values. * tests/install/basic-1: Test for coreutils 5.97 bug that was fixed in coreutils 6.0, and which should still be fixed with this change. * tests/mkdir/p-3: Likewise.
Diffstat (limited to 'tests/install/basic-1')
-rwxr-xr-xtests/install/basic-125
1 files changed, 18 insertions, 7 deletions
diff --git a/tests/install/basic-1 b/tests/install/basic-1
index c41ea889b..bfddd6ef8 100755
--- a/tests/install/basic-1
+++ b/tests/install/basic-1
@@ -1,7 +1,7 @@
#! /bin/sh
# Basic tests for "install".
-# Copyright (C) 1998, 2000, 2001, 2002, 2004, 2005 Free Software
+# Copyright (C) 1998, 2000, 2001, 2002, 2004, 2005, 2006 Free Software
# Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
@@ -95,16 +95,27 @@ test -d newdir3 || fail=1
# initial working directory ($abs) after creating the first argument, and
# hence cannot do anything meaningful with the following relative-named dirs.
abs=$pwd/$tmp
-mkdir sub && cd sub
-chmod 0 .; ginstall -d $abs/xx/yy rel/sub1 rel/sub2 2> /dev/null && fail=1
-chmod 755 $abs/sub
+mkdir sub || fail=1
+(cd sub && chmod 0 . && ginstall -d $abs/xx/yy rel/sub1 rel/sub2 2> /dev/null) && fail=1
+chmod 755 sub
# Ensure that the first argument-dir has been created.
-test -d $abs/xx/yy || fail=1
+test -d xx/yy || fail=1
# Make sure that the `rel' directory was not created...
-test -d $abs/sub/rel && fail=1
+test -d sub/rel && fail=1
# and make sure it was not created in the wrong place.
-test -d $abs/xx/rel && fail=1
+test -d xx/rel && fail=1
+
+# Test that we can install from an unreadable directory with an
+# inaccessible parent. coreutils 5.97 fails this test.
+mkdir -p sub1/d || fail=1
+(cd sub1/d && chmod a-rx .. && chmod a-r . &&
+ ginstall -d $abs/xx/zz rel/a rel/b 2> /dev/null) || fail=1
+chmod 755 sub1 || fail=1
+chmod 755 sub1/d || fail=1
+test -d xx/zz || fail=1
+test -d sub1/d/rel/a || fail=1
+test -d sub1/d/rel/b || fail=1
(exit $fail); exit $fail