Skip to content

check and cryptcheck: report directory differences with --report-dirs - fixes #6440 - #7514

Open
nielash wants to merge 1 commit into
rclone:masterfrom
nielash:check-report-dirs
Open

nielash wants to merge 1 commit into
rclone:masterfrom
nielash:check-report-dirs

Conversation

@nielash

@nielash nielash commented Dec 18, 2023 •

Copy link
Copy Markdown
Contributor

What is the purpose of this change?

Before this change, check and cryptcheck would not inform the user of directory differences (for example, an empty directory that exists only on the src.)

After this change, a new --report-dirs flag allows alerting users of such differences.

Note that directories will be reported regardless of whether they are empty. They will be included in the total error count, but counted and summarized separately, and not included in output files. --report-dirs is ignored when --checkfile is in use.

Was the change discussed in an issue or in the forum before?

Checklist

  • I have read the contribution guidelines.
  • I have added tests for all changes in this PR if appropriate.
  • I have added documentation for the changes if appropriate.
  • All commit messages are in house style.
  • I'm done, this Pull Request is ready for review :-)

@nielash nielash added this to the v1.66 milestone Dec 18, 2023
@nielash nielash linked an issue Dec 18, 2023 that may be closed by this pull request
@nielash
nielash marked this pull request as ready for review December 18, 2023 18:13

@albertony albertony left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this looks good. No test, but maybe that's ok here (opt-in, not the most central code). I have a small comment regarding name of the flag, but its not a stopper, more thinking out loud...

Comment thread cmd/check/check.go Outdated

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Naming things... We seem to spell out words like "directory" for most flags, and even for crypt backend we have this rather long --crypt-directory-name-encryption. However, its not very consistent, as for config we have two flags --temp-dir and --cache-dir. So I'm thinking if this should be --report-directories, or could it simply be --directories?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Either of those would be fine with me! My thought was that dirs is consistent with --create-empty-src-dirs (the closest comparable flag) and also that shorter is better when it comes to flag names. But I am happy to change it!

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, right, that is one command flag using the short, and plural, "dirs". I looked primarily at global and backend flags, I think. So it is even more mixed than I initially thought.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

He, he!

--report-dirs I think is OK! At some point I want to put these flags on sync/copy/move and for that --dirs is too generic.

fixes rclone#6440

Before this change, check and cryptcheck would not inform the user of directory
differences (for example, an empty directory that exists only on the src.)

After this change, a new --report-dirs flag allows alerting users of such
differences.

Note that directories will be reported regardless of whether they are empty.
They will be included in the total error count, but counted and summarized
separately, and not included in output files. --report-dirs is ignored when
--checkfile is in use.

@ncw ncw left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a nice feature - thank you for implementing it and sorry it has been hanging around so long!

I don't think this is reporting to the report files is it? And if we do that we should make sure directories get reported with a trailing / so users can tell them apart from files.

I think it should probably have a test.

I put some other things inline.

Thank you

Comment thread cmd/check/check.go
var (
download = false
oneway = false
ReportDirs = false

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be small r - ReportDirs

Comment thread cmd/check/check.go Outdated

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

He, he!

--report-dirs I think is OK! At some point I want to put these flags on sync/copy/move and for that --dirs is too generic.

}
defer close()

opt.ReportDirs = check.ReportDirs

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We shouldn't need this - it should be in the return of check.GetCheckOpt already.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I could have sworn there was a reason for needing to do this... but 10 months later I can't remember what it was! I guess I'll try removing it and see if anything breaks 😅

Comment thread fs/operations/check.go
Fdst, Fsrc fs.Fs // fses to check
Check checkFn // function to use for checking
OneWay bool // one way only?
ReportDirs bool // report dir differences in addition to files

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This changes the rc interface, so the docs need fixing up here

- oneWay - check one way only, source files must exist on remote

@nielash

nielash commented Sep 29, 2024

Copy link
Copy Markdown
Contributor Author

I don't think this is reporting to the report files is it? And if we do that we should make sure directories get reported with a trailing / so users can tell them apart from files.

It does not currently report to the output files (this is mentioned in the commit message.) Do you think it should?

All the other comments made sense -- will fix and add a test.

@ncw

ncw commented Sep 30, 2024

Copy link
Copy Markdown
Member

I don't think this is reporting to the report files is it? And if we do that we should make sure directories get reported with a trailing / so users can tell them apart from files.

It does not currently report to the output files (this is mentioned in the commit message.) Do you think it should?

I think that would probably be more useful if it appears in the output files

All the other comments made sense -- will fix and add a test.

👍

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.

cryptcheck should also check and report directory differences

4 participants