feat: add -x flag to strip xattr keys on non-client setxattr - #49
Open
flash7777 wants to merge 2 commits into
Open
feat: add -x flag to strip xattr keys on non-client setxattr#49flash7777 wants to merge 2 commits into
flash7777 wants to merge 2 commits into
Conversation
File managers like Nautilus copy all xattrs (including user.openvfs.data)
when doing copy+paste. This causes copied files to inherit the original's
fileId and immutable state, which is incorrect.
The new -x flag accepts a comma-separated list of msgpack keys that
should be cleared when a non-client process writes user.openvfs.data:
openvfsfuse -x fileid,immutable -o owner /mountpoint
When a process other than the registered desktop client writes
user.openvfs.data, the specified keys are set to "" in the msgpack
payload before writing. This ensures copied files get fresh identity
on the next sync while preserving other attributes like size and etag.
The desktop client PID (from the VERSION handshake) is exempt, so
cloudd/sync clients can still write all keys.
Member
|
Thanks a lot for you PR, good catch. What I do not get completely: When the external applications such as nautilus copies the xattrs, why should we not completely remove the user xattrs of openvfs? Why do you want to filter for certain members? Can you elaborate? Thanks. |
… empty Per review by @dragotin: "Why not completely remove the user xattrs?" We strip selectively because user-set metadata (comments, tags, custom properties) should survive copy+paste. Only system-managed per-file identity fields need removal: - fileid: unique per file, must not be duplicated - immutable: protection state is per-file, not inheritable via copy - syncerror: transient sync state Fields like etag, pinstate, size are harmless to copy. Also: use json::erase() instead of setting to "" — cleaner removal.
Member
|
Thanks for updating the PR, but I am still not convinced, I still think you should remove the entire openVFS metadata that are inconsistent. The syncing application should, if the resource is still within a sync dir, set the data new anyway next moment. User Metadata should not be part of the openVFS Namespace anyway. That is why we put our metadata into a JSON document instead into single values. |
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
File managers (Nautilus, Dolphin) copy all
user.*xattrs on copy+paste. This causesuser.openvfs.datato be copied verbatim, so the new file inherits the original'sfileidandimmutablestate — which is incorrect for a copy.Solution
Add a
-x key1,key2,...CLI flag that lists msgpack keys to strip fromuser.openvfs.datawhen written by a non-client process:When Nautilus copies a file and sets
user.openvfs.data, openvfs intercepts thesetxattr, parses the msgpack, clears the listed keys, and writes the cleaned version. The registered desktop client PID (from VERSION handshake) is exempt so sync clients can write all keys.Usage by cloudd
Changes
main.cpp: add-xto getopt, parse comma-separated keys intostripXattrKeysopenvfsfuse.h: addstripXattrKeysto Argsopenvfsfuse.cpp: VFSFuseContext stores keys,setxattrhandler strips them3 files, +49/-2 lines.
Test plan
-x: setxattr passes through unchanged (backwards compatible)-x fileid,immutable: Nautilus copy+paste produces file without fileid/immutable