forked from apenwarr/redo
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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 <[email protected]>
- Loading branch information
Showing
5 changed files
with
44 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
/rodir |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
[ -e rodir ] && chmod u+w rodir | ||
[ -e rodir/rwdir ] && chmod u+w rodir/rwdir | ||
rm -rf rodir | ||
rm -f *~ .*~ |