Closed
Description
Describe the bug
Due to the rejection of #2617 (comment), I'll assume that files with newer timestamps across remote and local should be chosen as the version to be kept. However, there are some cases where this policy is not consistently followed. If these are expected behaviors, the timestamp-first mode should be considered as a feature request. Both sides should be evaluated for changes rather than one side always replacing the other, especially if both sides could be changing.
Operating System Details
skipped
Client Installation Method
From Source
OneDrive Account Type
Personal
What is your OneDrive Application Version
v2.5.0-alpha-5 GitHub version: v2.4.25-64-g1630ae3
What is your OneDrive Application Configuration
skipped
What is your 'curl' version
skipped
Where is your 'sync_dir' located
Local
What are all your system 'mount points'
skipped
What are all your local file system partition types
skipped
How do you use 'onedrive'
skipped
Steps to reproduce the behaviour
Case 1-1
$ touch 1.txt
$ onedrive --sync
$ curl -X PUT "https://graph.microsoft.com/v1.0/me/drive/root:/1.txt:/content" \
--data "modify first (should be ignored)"
$ echo "modify again locally (newer version should be kept)" > 1.txt
$ onedrive --sync
$ cat 1.txt
modify first (should be ignored)
Case 1-2 (resync)
$ touch 1.txt
$ onedrive --sync
$ curl -X PUT "https://graph.microsoft.com/v1.0/me/drive/root:/1.txt:/content" \
--data "modify first (should be ignored)"
$ echo "modify again locally (newer version should be kept)" > 1.txt
$ onedrive --sync --resync
$ cat 1.txt
modify first (should be ignored)
Case 2-1
$ touch 1.txt
$ onedrive --sync --local-first
$ echo "modify first (should be ignored)" > 1.txt
$ curl -X PUT "https://graph.microsoft.com/v1.0/me/drive/root:/1.txt:/content" \
--data "modify again remotely(newer version should be kept)"
$ onedrive --sync --local-first
$ cat 1.txt
modify first (should be ignored)
Case 2-2 (resync)
$ touch 1.txt
$ onedrive --sync --local-first
$ echo "modify first (should be ignored)" > 1.txt
$ curl -X PUT "https://graph.microsoft.com/v1.0/me/drive/root:/1.txt:/content" \
--data "modify again remotely(newer version should be kept)"
$ onedrive --sync --local-first --resync
$ cat 1.txt
modify first (should be ignored)
Complete Verbose Log Output
Case 1-1
Reading configuration file: /home/alan/.config/onedrive/config
Configuration file successfully loaded
Using 'user' configuration path for application state data: /home/alan/.config/onedrive
Using the following path to store the runtime application log: /var/log/onedrive
Using IPv4 and IPv6 (if configured) for all network operations
Checking Application Version ...
Attempting to initialise the OneDrive API ...
Configuring Global Azure AD Endpoints
The OneDrive API was initialised successfully
Opening the item database ...
Application Version: v2.5.0-alpha-5 GitHub version: v2.4.25-64-g1630ae3
Account Type: personal
Default Drive ID: af2b5e52bea96776
Default Root ID: AF2B5E52BEA96776!sea8cc6beffdb43d7976fbc7da445c639
Remaining Free Space: 5.00 GB (5364164153 bytes)
Sync Engine Initialised with new Onedrive API instance
All application operations will be performed in the configured local 'sync_dir' directory: /home/alan/OneDrive
Fetching /delta response from the OneDrive API for Drive ID: af2b5e52bea96776
Processing API Response Bundle: 1 - Quantity of 'changes|items' in this bundle to process: 2
Finished processing /delta JSON response from the OneDrive API
Processing 1 applicable changes and items received from Microsoft OneDrive
Processing OneDrive JSON item batch [1/1] to ensure consistent local state
Number of items to download from OneDrive: 1
The local file to replace (./1.txt) has been modified locally since the last download. Renaming it to avoid potential local data loss.
The local item is out-of-sync with OneDrive, renaming to preserve existing file and prevent local data loss: ./1.txt -> ./1-55db26f69037.txt
Downloading file ./1.txt ... done
Performing a database consistency and integrity check on locally stored data
Processing DB entries for this Drive ID: af2b5e52bea96776
Processing ~/OneDrive
The directory has not changed
Processing 1.txt
The file has not changed
Scanning the local file system '~/OneDrive' for new data to upload
New items to upload to OneDrive: 1
Total New Data to Upload: 52 Bytes
Uploading new file ./1-55db26f69037.txt ... done.
Performing a last examination of the most recent online data within Microsoft OneDrive to complete the reconciliation process
Fetching /delta response from the OneDrive API for Drive ID: af2b5e52bea96776
Processing API Response Bundle: 1 - Quantity of 'changes|items' in this bundle to process: 2
Finished processing /delta JSON response from the OneDrive API
Processing 1 applicable changes and items received from Microsoft OneDrive
Processing OneDrive JSON item batch [1/1] to ensure consistent local state
Sync with Microsoft OneDrive is complete
Case 1-2
Reading configuration file: /home/alan/.config/onedrive/config
Configuration file successfully loaded
Using 'user' configuration path for application state data: /home/alan/.config/onedrive
Using the following path to store the runtime application log: /var/log/onedrive
The usage of --resync will delete your local 'onedrive' client state, thus no record of your current 'sync status' will exist.
This has the potential to overwrite local versions of files with perhaps older versions of documents downloaded from OneDrive, resulting in local data loss.
If in doubt, backup your local data before using --resync
Are you sure you wish to proceed with --resync? [Y/N] y
Deleting the saved application sync status ...
Using IPv4 and IPv6 (if configured) for all network operations
Checking Application Version ...
Attempting to initialise the OneDrive API ...
Configuring Global Azure AD Endpoints
The OneDrive API was initialised successfully
Opening the item database ...
Application Version: v2.5.0-alpha-5 GitHub version: v2.4.25-64-g1630ae3
Account Type: personal
Default Drive ID: af2b5e52bea96776
Default Root ID: AF2B5E52BEA96776!sea8cc6beffdb43d7976fbc7da445c639
Remaining Free Space: 5.00 GB (5364164153 bytes)
Sync Engine Initialised with new Onedrive API instance
All application operations will be performed in the configured local 'sync_dir' directory: /home/alan/OneDrive
Fetching /delta response from the OneDrive API for Drive ID: af2b5e52bea96776
Processing API Response Bundle: 1 - Quantity of 'changes|items' in this bundle to process: 3
Skipping item - excluded by skip_file config: /./~tmp21_1
Finished processing /delta JSON response from the OneDrive API
Processing 1 applicable changes and items received from Microsoft OneDrive
Processing OneDrive JSON item batch [1/1] to ensure consistent local state
Local file time discrepancy detected: ./1.txt
This local file has a different modified time 2024-Feb-04 15:51:53Z (UTC) when compared to remote modified time 2024-Feb-04 15:51:49Z (UTC)
The local file has a different hash when compared to remote file hash
Local item does not exist in local database - replacing with file from OneDrive - failed download?
The local item is out-of-sync with OneDrive, renaming to preserve existing file and prevent local data loss: ./1.txt -> ./1-55db26f69037.txt
Number of items to download from OneDrive: 1
Downloading file ./1.txt ... done
Performing a database consistency and integrity check on locally stored data
Processing DB entries for this Drive ID: af2b5e52bea96776
Processing ~/OneDrive
The directory has not changed
Processing 1.txt
The file has not changed
Scanning the local file system '~/OneDrive' for new data to upload
New items to upload to OneDrive: 1
Total New Data to Upload: 52 Bytes
Uploading new file ./1-55db26f69037.txt ... done.
Performing a last examination of the most recent online data within Microsoft OneDrive to complete the reconciliation process
Fetching /delta response from the OneDrive API for Drive ID: af2b5e52bea96776
Processing API Response Bundle: 1 - Quantity of 'changes|items' in this bundle to process: 2
Finished processing /delta JSON response from the OneDrive API
Processing 1 applicable changes and items received from Microsoft OneDrive
Processing OneDrive JSON item batch [1/1] to ensure consistent local state
Sync with Microsoft OneDrive is complete
Case 2-1
Reading configuration file: /home/alan/.config/onedrive/config
Configuration file successfully loaded
Using 'user' configuration path for application state data: /home/alan/.config/onedrive
Using the following path to store the runtime application log: /var/log/onedrive
Using IPv4 and IPv6 (if configured) for all network operations
Checking Application Version ...
Attempting to initialise the OneDrive API ...
Configuring Global Azure AD Endpoints
The OneDrive API was initialised successfully
Opening the item database ...
Application Version: v2.5.0-alpha-5 GitHub version: v2.4.25-64-g1630ae3
Account Type: personal
Default Drive ID: af2b5e52bea96776
Default Root ID: AF2B5E52BEA96776!sea8cc6beffdb43d7976fbc7da445c639
Remaining Free Space: 5.00 GB (5364164153 bytes)
Sync Engine Initialised with new Onedrive API instance
All application operations will be performed in the configured local 'sync_dir' directory: /home/alan/OneDrive
Performing a database consistency and integrity check on locally stored data
Processing DB entries for this Drive ID: af2b5e52bea96776
Processing ~/OneDrive
The directory has not changed
Processing 1.txt
Local file time discrepancy detected: 1.txt
The file content has changed locally and has a newer timestamp, thus needs to be uploaded to OneDrive
Changed local items to upload to OneDrive: 1
Uploading modified file 1.txt ... done.
Scanning the local file system '~/OneDrive' for new data to upload
Fetching /delta response from the OneDrive API for Drive ID: af2b5e52bea96776
Processing API Response Bundle: 1 - Quantity of 'changes|items' in this bundle to process: 2
Finished processing /delta JSON response from the OneDrive API
Processing 1 applicable changes and items received from Microsoft OneDrive
Processing OneDrive JSON item batch [1/1] to ensure consistent local state
Sync with Microsoft OneDrive is complete
Case 2-2
Reading configuration file: /home/alan/.config/onedrive/config
Configuration file successfully loaded
Using 'user' configuration path for application state data: /home/alan/.config/onedrive
Using the following path to store the runtime application log: /var/log/onedrive
The usage of --resync will delete your local 'onedrive' client state, thus no record of your current 'sync status' will exist.
This has the potential to overwrite local versions of files with perhaps older versions of documents downloaded from OneDrive, resulting in local data loss.
If in doubt, backup your local data before using --resync
Are you sure you wish to proceed with --resync? [Y/N] y
Deleting the saved application sync status ...
Using IPv4 and IPv6 (if configured) for all network operations
Checking Application Version ...
Attempting to initialise the OneDrive API ...
Configuring Global Azure AD Endpoints
The OneDrive API was initialised successfully
Opening the item database ...
Application Version: v2.5.0-alpha-5 GitHub version: v2.4.25-64-g1630ae3
Account Type: personal
Default Drive ID: af2b5e52bea96776
Default Root ID: AF2B5E52BEA96776!sea8cc6beffdb43d7976fbc7da445c639
Remaining Free Space: 5.00 GB (5364164153 bytes)
Sync Engine Initialised with new Onedrive API instance
All application operations will be performed in the configured local 'sync_dir' directory: /home/alan/OneDrive
Performing a database consistency and integrity check on locally stored data
Processing DB entries for this Drive ID: af2b5e52bea96776
Processing ~/OneDrive
The directory has not changed
Scanning the local file system '~/OneDrive' for new data to upload
New items to upload to OneDrive: 1
Total New Data to Upload: 33 Bytes
The file we are attemtping to upload as a new file already exists on Microsoft OneDrive: ./1.txt
Skipping uploading this file as moving it to upload as a modified file (online item already exists): ./1.txt
Changed local items to upload to OneDrive: 1
Uploading modified file ./1.txt ... done.
Fetching /delta response from the OneDrive API for Drive ID: af2b5e52bea96776
Processing API Response Bundle: 1 - Quantity of 'changes|items' in this bundle to process: 3
Skipping item - excluded by skip_file config: /./~tmp21_1
Finished processing /delta JSON response from the OneDrive API
Processing 1 applicable changes and items received from Microsoft OneDrive
Processing OneDrive JSON item batch [1/1] to ensure consistent local state
Sync with Microsoft OneDrive is complete
Screenshots
No response
Other Log Information or Details
No response
Additional context
No response