Commit 22e2fb1a authored by Han-Wen Nienhuys's avatar Han-Wen Nienhuys

UnionFs: Make all directories appear writable.

This allows new files to be edited directly.
parent f45ece61
......@@ -154,6 +154,10 @@ func (me *UnionFs) getBranchAttrNoCache(name string) getBranchResult {
a, s := fs.GetAttr(name)
if s == fuse.OK {
if a.Mode & fuse.S_IFDIR != 0 {
// Make all directories appear writable
a.Mode |= 0200
}
return getBranchResult{
attr: a,
code: s,
......
......@@ -255,7 +255,7 @@ func TestMkdir(t *testing.T) {
dirname := wd + "/mount/subdir"
err := os.Mkdir(dirname, 0755)
CheckSuccess(err)
err = os.Remove(dirname)
CheckSuccess(err)
}
......@@ -318,3 +318,18 @@ func TestRename(t *testing.T) {
}
}
func TestWritableDir(t *testing.T) {
t.Log("TestWritableDir")
wd, state := setup(t)
defer state.Unmount()
dirname := wd + "/ro/subdir"
err := os.Mkdir(dirname, 0555)
CheckSuccess(err)
fi, err := os.Lstat(wd+"/mount/subdir")
CheckSuccess(err)
if fi.Permission() & 0222 == 0 {
t.Errorf("unexpected permission %o", fi.Permission())
}
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment