Skip to content
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

Added parameter ignore_device to constructor of DirectorySnapshotDiff. #597

Merged
merged 4 commits into from
Dec 3, 2019
Merged

Conversation

Ajordat
Copy link
Contributor

@Ajordat Ajordat commented Dec 2, 2019

To compare two DirectorySnapshots the file attributes are used: A file/folder is uniquely identified using the st_ino and st_dev values.

The problem is that st_dev may change between reboots as stated in the GNU manual. Therefore if we compare a snapshot of a previous boot with the current one, DirectorySnapshotDiff may report a file as deleted and created again even if it hasn't been touched.

This PR adds the optional parameter ignore_device to the constructor of DirectorySnapshotDiff to just use the value st_ino and ignore st_dev.

@BoboTiG
Copy link
Collaborator

BoboTiG commented Dec 2, 2019

Hello @Ajordat,

Thanks for the PR 👍!

Could you add docstrings and/or comments to explain what they do and why 🙏?

@BoboTiG
Copy link
Collaborator

BoboTiG commented Dec 2, 2019

Also, do you think you can manage to create a simple test for that?

@Ajordat
Copy link
Contributor Author

Ajordat commented Dec 2, 2019

I've just added a docstring to explain it. I will create a test for it later (maybe tomorrow)!

@Ajordat
Copy link
Contributor Author

Ajordat commented Dec 3, 2019

Done. Check the changes and apply them if you think they should be on the library!

@BoboTiG BoboTiG merged commit 7a55f31 into gorakhargosh:master Dec 3, 2019
@BoboTiG
Copy link
Collaborator

BoboTiG commented Dec 3, 2019

Thank you very much @Ajordat, perfect PR !

@BoboTiG BoboTiG added the feature label Feb 6, 2020
CCP-Aporia pushed a commit to CCP-Aporia/watchdog that referenced this pull request Aug 13, 2020
…ff (gorakhargosh#597)

* Added parameter `ignore_device` to constructor of DirectorySnapshotDiff.

* Fixed E704.

* Added docstring.

* Added test for `ignore_device` parameter on DirectorySnapshotDiff constructor.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants