rpodgorny / unionfs-fuse

union filesystem using fuse
Other
309 stars 76 forks source link

Removing a file from a unionfs such that a formerly shadowed file does not appear in its place #76

Open lvml opened 7 years ago

lvml commented 7 years ago

Maybe I misunderstood what the unionfs-fuse man-page wanted to tell me with:

-o hide_meta_files In our unionfs root path we have a .unionfs directory that includes metadata, such as hidden (deleted) files.

... but that led me to believe it is possible to remove a file from a mounted unionfs such that a potentially existing file of the same name from a "lower branch" would not appear in its place.

However, that does not work - I see the file from the "lower branch" immediately after removing the file from the "higher branch".

That is a problem for me, because the "lower branch" not only holds a file of the same name - that file also is owned by a user other than the one mounting the unionfs-fuse, so any attempt to re-create/overwrite the file in the mounted unionfs will end in a "no permission" error.

Is there a way to hide a file from a "lower branch" once and for all? (It would be sufficient for me if I had to name it specifically at mount-time.)

mohitmv commented 3 years ago

Hi, Any update on this ? I'm facing the same issue. @lvml - btw, did you find any other unionfs which can work in macOS as well and the union (merged) fs supports deletion of files from read-only branch.

bsbernd commented 3 years ago

Oh really, there should be a file in the .unionfs structure, which will make the lower branch file to not show up. Can you post an example how to reproduce this? Maybe a quick fix...

mohitmv commented 3 years ago

It works for simple directories (i.e. if the read-only directory is created by me). However it doesn't work for system read-only directories like /bin.

System: macOS

Repro: mkdir -p /tmp/A ./src/unionfs -o cow -o debug /tmp/A=rw:/bin=ro /tmp/C cd /tmp/C && rm ls

Here is what I get in the debug info when I try to remove "ls" binary.

getattr /ls
   unique: 2, success, outsize: 136
unique: 4, opcode: GETXATTR (22), nodeid: 35, insize: 75, pid: 32781
getxattr /ls com.apple.rootless 128 0
   unique: 4, error: -93 (Attribute not found), outsize: 16
unique: 5, opcode: GETATTR (3), nodeid: 1, insize: 56, pid: 32781
getattr /
   unique: 5, success, outsize: 136
unique: 3, opcode: GETATTR (3), nodeid: 35, insize: 56, pid: 32781
getattr /ls
   unique: 3, success, outsize: 136
unique: 2, opcode: GETXATTR (22), nodeid: 35, insize: 75, pid: 32781
getxattr /ls com.apple.rootless 128 0
   unique: 2, error: -93 (Attribute not found), outsize: 16
unique: 4, opcode: GETATTR (3), nodeid: 1, insize: 56, pid: 32781