Ensure correct operation with read-only target dirs and .do file dirs.
Although I expect this is rather rare, some people may want to build in a read-write subdir of a read-only tree. Other than some confusing error reporting, this works fine in redo after the recent changes to temp file handling, but let's add a test to make sure it stays that way. The test found a bug in minimal/do, so let's fix that. Reported-by: Jeff Stearns <jeff.stearns@gmail.com>
This commit is contained in:
parent
d95277d121
commit
39e017869d
5 changed files with 44 additions and 16 deletions
1
t/204-readonly/.gitignore
vendored
Normal file
1
t/204-readonly/.gitignore
vendored
Normal file
|
|
@ -0,0 +1 @@
|
|||
/rodir
|
||||
25
t/204-readonly/all.do
Normal file
25
t/204-readonly/all.do
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
[ -e rodir ] && chmod u+w rodir
|
||||
[ -e rodir/rwdir ] && chmod u+w rodir/rwdir
|
||||
rm -rf rodir
|
||||
mkdir rodir rodir/rwdir
|
||||
|
||||
cd rodir
|
||||
cat >default.ro1.do <<-EOF
|
||||
chmod u+w "\$(dirname "\$1")"
|
||||
echo 'redir' >\$3
|
||||
EOF
|
||||
cat >default.ro2.do <<-EOF
|
||||
chmod u+w "\$(dirname "\$1")"
|
||||
echo 'stdout'
|
||||
EOF
|
||||
|
||||
# Check that:
|
||||
# - redo works when the .do file is in a read-only directory.
|
||||
# - redo works when the target is in a read-only directory that becomes
|
||||
# writable only *after* launching the .do script. (For example, the .do
|
||||
# might mount a new read-write filesystem in an otherwise read-only
|
||||
# tree.)
|
||||
chmod a-w . rwdir
|
||||
redo rwdir/a.ro1
|
||||
chmod a-w . rwdir
|
||||
redo rwdir/a.ro2
|
||||
4
t/204-readonly/clean.do
Normal file
4
t/204-readonly/clean.do
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
[ -e rodir ] && chmod u+w rodir
|
||||
[ -e rodir/rwdir ] && chmod u+w rodir/rwdir
|
||||
rm -rf rodir
|
||||
rm -f *~ .*~
|
||||
Loading…
Add table
Add a link
Reference in a new issue