Skip to content

Conversation

@dudarev
Copy link
Contributor

@dudarev dudarev commented Dec 5, 2020

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.

Thank you for the contribution - we'll try to review it as soon as possible. 🙏

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 dudarev marked this pull request as draft December 5, 2020 14:13
@shcheklein
Copy link
Member

@dudarev could you please summarize what are the next steps here?

@dudarev
Copy link
Contributor Author

dudarev commented Dec 5, 2020

@shcheklein the next steps could be:

  • make all tests pass
  • figure out how to test mode change on checkout (test on Windows either should be skipped or set only allowed permission byte)
  • implement chmod on checkout
  • fix all tests if they will be broken on the previous step
    --- tasks below this line probably can be a separate ticket ---
  • think of various error handling scenarios
  • implement error handling

@shcheklein
Copy link
Member

@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)
Copy link
Contributor

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?

Copy link
Contributor Author

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

@efiop
Copy link
Contributor

efiop commented Dec 6, 2020

@dudarev Hi! Thanks for the PR! 🚀 A few comments:

  1. Could you please rename it to reflect the contents?
  2. Please add a reference for the ticket, so github could track it.
  3. Please install pre-commit hooks as noted in https://dvc.org/doc/user-guide/contributing/core . Currently linter checks fail.

Thanks! 🙂


mode = oct(os.stat(path).st_mode)

return HashInfo("md5", value, size=int(actual_size), mode=mode)
Copy link
Contributor

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. 🙂

Copy link
Contributor Author

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.

Copy link
Contributor

@efiop efiop Dec 7, 2020

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

def dumpd(self):
. We could just add 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!

self.hash_info = self.get_hash()

@dudarev dudarev changed the title WIP Initial commit for 4578 WIP Initial commit for #4578 - save permission in dvc file Dec 7, 2020
@dudarev
Copy link
Contributor Author

dudarev commented Dec 7, 2020

@efiop Thank you for your feedback!

  1. I renamed the PR to better reflect its content.
  2. Also added the reference to the ticket in the description.
  3. I installed pre-commit hook when working on the previous PR but this time commited from IDE that did not use it. I'll be more mindful about commit from git cli in the following PRs.

You have a very good point about storing only user execution permission and not having mode in HashInfo. I asked a few questions to your comments above that could streamline the development. Please have a look.

@efiop efiop changed the title WIP Initial commit for #4578 - save permission in dvc file [WIP] save permissions in dvc files Dec 7, 2020
@dudarev dudarev closed this Dec 8, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants