-
Notifications
You must be signed in to change notification settings - Fork 1.2k
[WIP] save permissions in dvc files #5036
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Modification of tests/func/test_add.py:test_add to output mode parameter in dvc-file. Implementation of this test. Other tests are not validated and not addressed yet.
|
@dudarev could you please summarize what are the next steps here? |
|
@shcheklein the next steps could be:
|
|
@dudarev sounds about right to me! I guess we can move forward with this and other folks will review and chime in along the way! |
| self._update_state_record_timestamp_for_inode(actual_inode) | ||
| return HashInfo("md5", value, size=int(actual_size)) | ||
|
|
||
| mode = oct(os.stat(path).st_mode) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is full mode intentional? Or did you only mean to include permission bits?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm leaning now more towards only saving user executable bit, so we could have a boolean parameter:
is_user_executable: false/true
|
@dudarev Hi! Thanks for the PR! 🚀 A few comments:
Thanks! 🙂 |
|
|
||
| mode = oct(os.stat(path).st_mode) | ||
|
|
||
| return HashInfo("md5", value, size=int(actual_size), mode=mode) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
mode is not really used by state, so we shouldn't include it here (we can probably do that in Output.save with self.tree.stat(self.path_info).st_mode. Also mode is not really related to HashInfo so it shoudn't be.a part of it, unless there are good reasons to include it. 🙂
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, it makes sense not to include mode as part of hash. Should content of output file looks like:
outs:
- md5: acbd18db4cc2f85cedef654fccc4a4d8
size: 3
path: foo
- is_user_executable: false
So there will be two separate outputs. Will it affect anything that uses those files?
Could you provide a link to a place where outs are set in the code? I'm having trouble finding it quickly.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@dudarev It should be more like:
outs:
- md5: acbd18db4cc2f85cedef654fccc4a4d8
size: 3
path: foo
is_user_executable: false
Since that relates to the same output. Maybe you are confused about the way that entry is generated, see
Line 299 in f09c27e
| def dumpd(self): |
ret[self.PARAM_ISEXEC] = self.isexec there and parse it on the roundtrip similar to other fields.
Could you provide a link to a place where outs are set in the code? I'm having trouble finding it quickly.
Sure!
Line 289 in f09c27e
| self.hash_info = self.get_hash() |
|
@efiop Thank you for your feedback!
You have a very good point about storing only user execution permission and not having |
This is work in progress for #4578
Modification of tests/func/test_add.py:test_add to output mode parameter in .dvc file.
Implementation of this test.
Other tests are not validated and not addressed yet.
❗ I have followed the Contributing to DVC checklist.
📖 If this PR requires documentation updates, I have created a separate PR (or issue, at least) in dvc.org and linked it here.
Thank you for the contribution - we'll try to review it as soon as possible. 🙏