0

The gsutil rsync documentation describes two options which sound identical:

Option Description
-i This forces rsync to skip any files which exist on the destination and have a modified time that is newer than the source file. (If an existing destination file has a modification time equal to the source file's, it will be updated if the sizes are different.)
-u When a file/object is present in both the source and destination, if mtime is available for both, do not perform the copy if the destination mtime is newer.

Although they use different terms, mtime and modification time, still it seems to be the same. At least I have not found any info on the difference. Both options effectively state that the file will not be copied (skipped) if the destination file is newer.

However, there must be some difference. I can't assume that the product team kept two identical options by mistake.

What is the difference in effect of these two options?

The only possible difference may be in the case of equal modification times of the source and destination, as described in the parentheses. In this case, the documentation might be improved to explicitly link the two options and point out the only difference. At least the same terms should be used to avoid confusion.

I've asked a similar question on StackOverflow earlier, but it is not specific enough (leaning to the difference between terms “mtime” and “modification time”), hence the answer is not complete. Now I'm asking here because the question is not about programming, and the question is specific now.

AKd
  • 101
  • 1
  • 1
    Since the source code to `gsutil` is published, look in the source code for the answer since your goal is a better answer. Once you complete that review, post an answer. – John Hanley Dec 20 '22 at 05:35
  • Oh, I didn't know it is open source, thanks for hinting. If no one who knows the difference for sure answers, I will, of course, resort to looking in the source code. – AKd Dec 20 '22 at 05:59
  • `-u `option will check if a file/object is present at both the source and destination and if the `mtime` is available for both and if yes, then it does not perform a copy if the destination has newer(latest) `mtime`. `-i` option will force skip any file which are already present in the destination and have newer(latest) modification time.Also if modification time of destination file is equal to source file then it will check sizes and update if size is mismatched. I have just tried to put a little more explanation above,also as mentioned by John,it is published and the source is available. – Vaidehi Jamankar Dec 22 '22 at 13:21
  • Thanks. I've already looked at the source code, and found two PRs which added `-u` and `-i` options. And it seems to me that the description of the `-i` option is incorrect, as it just makes `rsync` to skip existing files regardless of the modification time. See [my comment on GitHub](https://github.com/GoogleCloudPlatform/gsutil/pull/1183#pullrequestreview-1224254773). The repo contributor tends to agree. – AKd Dec 23 '22 at 03:58
  • You can also raise a [Public Issue tracker](https://cloud.google.com/support/docs/issue-trackers) here with the details ,so the concerned team and take this further. – Vaidehi Jamankar Dec 27 '22 at 09:32
  • They are redesigning `rsync` soon, so perhaps the docs will also be rewritten. – AKd Dec 27 '22 at 15:18

0 Answers0