[FileMetaDataProvider] Actually check if the file can be modified
ClosedPublic

Authored by bruns on May 3 2019, 12:00 AM.

Details

Summary

Adding tags etc. requires the file to be writable, so disallow editing
for readonly files.

Depends on D20980

Test Plan
  1. Add a tag to some file
  2. Remove write permissions
  3. The tag is still shown, but can no longer be edited

Diff Detail

Repository
R824 Baloo Widgets
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.
bruns created this revision.May 3 2019, 12:00 AM
Restricted Application added a project: Baloo. · View Herald TranscriptMay 3 2019, 12:00 AM
bruns requested review of this revision.May 3 2019, 12:00 AM

Doesn't this add a whole lot of new stat calls? Is there any other way we can determine this from data we already have?

bruns added a comment.May 3 2019, 6:34 PM

Doesn't this add a whole lot of new stat calls? Is there any other way we can determine this from data we already have?

For the single file case (IndexedDataRetriever) it does not really matter IMHO, and we also do a couple of getxattr calls on the file anyway. It is also done in a job (contrary to the old code before D20980).

For the multiple file case ('FileFetchJob`), the check is skipped after the first negative result, and when xattrs are not supported at all. Also, the "its a job" and "we call getxattr already" applies as well. For a way to reduce the number of blocking syscalls, see D20967 - this often removes 3 out of 4 syscalls (no comment, tag, rating, originURL).

ngraham accepted this revision.May 3 2019, 6:36 PM

Lovely, thanks for the explanation.

This revision is now accepted and ready to land.May 3 2019, 6:36 PM
This revision was automatically updated to reflect the committed changes.