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

Bug: Online date being changed in download-only mode #2591

Closed
robertschulze opened this issue Jan 14, 2024 · 23 comments
Closed

Bug: Online date being changed in download-only mode #2591

robertschulze opened this issue Jan 14, 2024 · 23 comments
Labels
Bug Something isn't working Fixed
Milestone

Comments

@robertschulze
Copy link

robertschulze commented Jan 14, 2024

Describe the bug

Hello again,
there may be another problem: I am running onedrive with in download-only mode but online OneDrive dates are being modified, e.g. cf. below

DEBUG: ------------------------------------------------------------------
DEBUG: Processing OneDrive JSON item 6 of 83 as part of JSON Item Batch 1 of 1
DEBUG: Raw JSON OneDrive Item: {"@microsoft.graph.downloadUrl":"https:\/\/public.dm.files.1drv.com\/y4momfUOb2DmzAKUI6gNus-csUf9jXZ3rvW1Q6XFFdLJRRzQb-Zg6_2rgdPV9klxhoWaaEgks2LZS8l69_Z9XaPYwzWU6qcYV30JFQc2uYb4GXHu69AQkwDOtc9YNoReSbuXDcGm3GUTfZD5twaOBRgJDaobhVYrAZ8XJNO7KCojkoF2stlqEfsQYdauDNLbB9ykGjau-gTdDW9KkWKknK6Qk4s9jDF21sAaW6eum8H5B05Hf7pIvrQ2NE5JVfGC5wRl6EKKd83sZ08py-VZ-aq4g","cTag":"aYzpGMzAyOEJENzU4NTUyRkFGITY4Mi4yNTc","createdBy":{"application":{"displayName":"MSOffice15","id":"480728c5"},"device":{"id":"188006267c0904"},"oneDriveSync":{"@odata.type":"#microsoft.graph.identity","id":"0cf2e7c6-beb9-4dd9-aab2-ffff3a010000"},"user":{"displayName":"Robert Schulze","id":"9ba6f07668ba1ff7"}},"createdDateTime":"2022-11-13T22:54:06.153Z","eTag":"aRjMwMjhCRDc1ODU1MkZBRiE2ODIuMzc","file":{"hashes":{"quickXorHash":"6VgxIHZd1xZDn1OQ9yXABPCh2z8=","sha1Hash":"5383CEEF4DC78D6A340F7A331B8E8E77F36BA0AC","sha256Hash":"D85C5D6659E36D910D85F1C02E2764BA03A72C8600DD1BB38242F4ADBBE2FEC3"},"mimeType":"application\/octet-stream"},"fileSystemInfo":{"createdDateTime":"2022-11-13T22:54:06.153Z","lastModifiedDateTime":"2024-01-14T21:28:12Z"},"id":"F3028BD758552FAF!682","lastModifiedBy":{"application":{"displayName":"OneDrive Client for Linux","id":"4035b959"},"user":{"displayName":"Robert Schulze","id":"9ba6f07668ba1ff7"}},"lastModifiedDateTime":"2024-01-14T21:28:13.233Z","name":"dsc00018.cpg","parentReference":{"driveId":"f3028bd758552faf","driveType":"personal","id":"F3028BD758552FAF!574","name":"thumb","path":"\/drives\/f3028bd758552faf\/items\/F3028BD758552FAF!4690:\/Datenbanken\/Memory%20Stick%20altes%20Handy\/DCIM\/100MSDCF\/thumb"},"reactions":{"commentCount":0},"shared":{"owner":{"user":{"displayName":"Constanze Schulze","id":"f3028bd758552faf"}},"scope":"users"},"size":3088,"webUrl":"https:\/\/1drv.ms\/u\/s!AK8vVVjXiwLzhSo"}
DEBUG: Attempting to calculate local filesystem path for f3028bd758552faf and F3028BD758552FAF!574
DEBUG: New Item calculated full path is: OneDrive - Constanze/Datenbanken/Memory Stick altes Handy/DCIM/100MSDCF/thumb/dsc00018.cpg
DEBUG: The item we are syncing is a file
DEBUG: skip_file item to check: /OneDrive - Constanze/Datenbanken/Memory Stick altes Handy/DCIM/100MSDCF/thumb/dsc00018.cpg
DEBUG: skip_file evaluation for: /OneDrive - Constanze/Datenbanken/Memory Stick altes Handy/DCIM/100MSDCF/thumb/dsc00018.cpg
DEBUG: Result: false
DEBUG: sync_list item to check: OneDrive - Constanze/Datenbanken/Memory Stick altes Handy/DCIM/100MSDCF/thumb/dsc00018.cpg
DEBUG: Evaluation against 'sync_list' for this path: OneDrive - Constanze/Datenbanken/Memory Stick altes Handy/DCIM/100MSDCF/thumb/dsc00018.cpg
DEBUG: [S]exclude           = false
DEBUG: [S]exludeDirectMatch = false
DEBUG: [S]excludeMatched    = false
DEBUG: Evaluation against 'sync_list' entry: OneDrive-Constanze/Datenbanken/*
DEBUG: Evaluation against 'sync_list' entry: OneDrive - Constanze/Datenbanken/*
DEBUG: Evaluation against 'sync_list' result: wildcard pattern match
DEBUG: Evaluation against 'sync_list' entry: Datenbanken/*
DEBUG: Evaluation against 'sync_list' result: wildcard pattern match
DEBUG: [F]exclude           = false
DEBUG: [F]exludeDirectMatch = false
DEBUG: [F]excludeMatched    = false
DEBUG: Evaluation against 'sync_list' final result: included for sync
DEBUG: Flagging object as a file
DEBUG: OneDrive change is potentially a new local item
DEBUG: Local item time discrepancy detected: OneDrive - Constanze/Datenbanken/Memory Stick altes Handy/DCIM/100MSDCF/thumb/dsc00018.cpg
DEBUG: This local item has a different modified time 2024-Jan-14 22:17:47Z when compared to remote modified time 2024-Jan-14 21:28:12Z
DEBUG: Local item has the same hash value as the item online - correcting timestamp
DEBUG: The source of the incorrect timestamp was OneDrive online - correcting timestamp online
DEBUG: Read token from appConfig
DEBUG: Authorised State: true
DEBUG: Existing Microsoft OneDrive Access Token Expires: 2024-Jan-15 00:17:37.6221615
DEBUG: No valid Microsoft OneDrive webhook subscription to delete
DEBUG: saveItem - creating DB item from this JSON: {"@microsoft.graph.downloadUrl":"https:\/\/xqxz3a.DM.files.1drv.com\/y4pHzbCBD-iHFYMGShnQAEqsg-oiVwj6igq3PMkfDHXfQAVw1z0Bzz9x77RxzAb0_TRXiPcDIs0gYCHuxroZPMwIu9hghw5_QARY8118oUtvi1eMm-k2W-0c8P0r1iqSjNCK05T7rb2m3bv5I7AHWi6P1jy5DFWhwu-TdWF_xwXdtTlWlYOM_S_fCq2ez7-VcBR2x8y2nx8eHjdYBVY6-OcrBIELZOtuD5Kq2Rm5LywvEF7cBF4MAojKODEdoBTYfw0","@odata.context":"https:\/\/graph.m
![Screenshot 2024-01-14 235510](https://github.com/abraunegg/onedrive/assets/13728481/dd2a1774-4c0d-4934-9d8f-68d4ee7ef734)
icrosoft.com\/v1.0\/$metadata#drives('f3028bd758552faf')\/items\/$entity","cTag":"aYzpGMzAyOEJENzU4NTUyRkFGITY4Mi4yNTc","createdBy":{"application":{"displayName":"MSOffice15","id":"480728c5"},"device":{"id":"188006267c0904"},"oneDriveSync":{"@odata.type":"#microsoft.graph.identity","id":"0cf2e7c6-beb9-4dd9-aab2-ffff3a010000"},"user":{"displayName":"Robert Schulze","id":"9ba6f07668ba1ff7"}},"createdDateTime":"2022-11-13T22:54:06.153Z","eTag":"aRjMwMjhCRDc1ODU1MkZBRiE2ODIuMzg","file":{"hashes":{"quickXorHash":"6VgxIHZd1xZDn1OQ9yXABPCh2z8=","sha1Hash":"5383CEEF4DC78D6A340F7A331B8E8E77F36BA0AC","sha256Hash":"D85C5D6659E36D910D85F1C02E2764BA03A72C8600DD1BB38242F4ADBBE2FEC3"},"mimeType":"application\/octet-stream"},"fileSystemInfo":{"createdDateTime":"2022-11-13T22:54:06.153Z","lastModifiedDateTime":"2024-01-14T22:17:47Z"},"id":"F3028BD758552FAF!682","lastModifiedBy":{"application":{"displayName":"OneDrive Client for Linux","id":"4035b959"},"user":{"displayName":"Robert Schulze","id":"9ba6f07668ba1ff7"}},"lastModifiedDateTime":"2024-01-14T22:17:47.38Z","name":"dsc00018.cpg","parentReference":{"driveId":"f3028bd758552faf","driveType":"personal","id":"F3028BD758552FAF!574","name":"thumb","path":"\/drives\/f3028bd758552faf\/items\/F3028BD758552FAF!4690:\/Datenbanken\/Memory%20Stick%20altes%20Handy\/DCIM\/100MSDCF\/thumb"},"reactions":{"commentCount":0},"shared":{"owner":{"user":{"displayName":"Constanze Schulze","id":"f3028bd758552faf"}},"scope":"users"},"size":3088,"webUrl":"https:\/\/1drv.ms\/u\/s!AK8vVVjXiwLzhSo"}
DEBUG: Flagging object as a file
DEBUG: Adding to database: Item("f3028bd758552faf", "F3028BD758552FAF!682", "dsc00018.cpg", "", file, "aRjMwMjhCRDc1ODU1MkZBRiE2ODIuMzg", "aYzpGMzAyOEJENzU4NTUyRkFGITY4Mi4yNTc", 2024-Jan-14 22:17:47Z, "F3028BD758552FAF!574", "6VgxIHZd1xZDn1OQ9yXABPCh2z8=", "", "", "", "Y", "3088")
DEBUG: The item to sync is already present on the local filesystem and is in-sync with what is reported online
DEBUG: Update/Insert local database with item details: Item("f3028bd758552faf", "F3028BD758552FAF!682", "dsc00018.cpg", "", file, "aRjMwMjhCRDc1ODU1MkZBRiE2ODIuMzc", "aYzpGMzAyOEJENzU4NTUyRkFGITY4Mi4yNTc", 2024-Jan-14 21:28:12Z, "F3028BD758552FAF!574", "6VgxIHZd1xZDn1OQ9yXABPCh2z8=", "", "", "", "Y", "3088")
DEBUG: ------------------------------------------------------------------

The original file date was something from 2007. So not sure what happened in the first place that the local file date was set to 2024-Jan-14 22:17:47Z but in any case in download-only mode the updated file date should not be uploaded, shouldn't it?

Thanks,

Robert

Operating System Details

Linux atom 5.15.0-91-generic #101-Ubuntu SMP Tue Nov 14 13:30:08 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 22.04.3 LTS
Release:        22.04
Codename:       jammy

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-34-ga5be48d

What is your OneDrive Application Configuration

sync_dir = "/media/3/3 - OneDrive/OneDrive_robert@guitaronline.de"
monitor_interval = "300"
log_dir = "/var/log/onedrive/"
upload_only = "false"
check_nomount = "false"
check_nosync = "false"
download_only = "true"
cleanup_local_files = "true"
disable_notifications = "false"
disable_upload_validation = "false"
enable_logging = "true"
force_http_11 = "false"
local_first = "false"
no_remote_delete = "false"
skip_symlinks = "false"
debug_https = "false"
skip_dotfiles = "false"
dry_run = "false"
min_notify_changes = "5"
monitor_log_frequency = "5"
monitor_fullscan_frequency = "10"
sync_root_files = "false"
classify_as_big_delete = "1000"
user_agent = ""
remove_source_files = "false"
skip_dir_strict_match = "false"
application_id = ""
resync = "false"
bypass_data_preservation = "false"
azure_ad_endpoint = ""
azure_tenant_id = "common"
sync_dir_permissions = "700"
sync_file_permissions = "600"
rate_limit = "125000000"
operation_timeout = "3600"
webhook_enabled = "false"
webhook_public_url = ""
webhook_listening_host = ""
webhook_listening_port = "8888"
webhook_expiration_interval = "86400"
webhook_renewal_interval = "43200"
skip_file = "~*|.~*|*.tmp"
skip_dir = ""

What is your 'curl' version

curl 7.81.0 (x86_64-pc-linux-gnu) libcurl/7.81.0 OpenSSL/3.0.2 zlib/1.2.11 brotli/1.0.9 zstd/1.4.8 libidn2/2.3.2 libpsl/0.21.0 (+libidn2/2.3.2) libssh/0.9.6/openssl/zlib nghttp2/1.43.0 librtmp/2.3 OpenLDAP/2.5.16
Release-Date: 2022-01-05
Protocols: dict file ftp ftps gopher gophers http https imap imaps ldap ldaps mqtt pop3 pop3s rtmp rtsp scp sftp smb smbs smtp smtps telnet tftp 
Features: alt-svc AsynchDNS brotli GSS-API HSTS HTTP2 HTTPS-proxy IDN IPv6 Kerberos Largefile libz NTLM NTLM_WB PSL SPNEGO SSL TLS-SRP UnixSockets zstd

Where is your 'sync_dir' located

Local

What are all your system 'mount points'

//hyperv/3 on /media/3 type cifs (rw,relatime,vers=2.1,cache=strict,username=Administrator,uid=1000,noforceuid,gid=100,noforcegid,addr=192.168.3.11,file_mode=0777,dir_mode=0777,soft,nounix,serverino,mapposix,rsize=1048576,wsize=1048576,bsize=1048576,echo_interval=60,actimeo=1,closetimeo=1)

What are all your local file system partition types

NAME                  FSTYPE      FSVER    LABEL UUID                                   FSAVAIL FSUSE% MOUNTPOINTS
loop0                 squashfs    4.0                                                         0   100% /snap/canonical-livepatch/246
loop1                 squashfs    4.0                                                         0   100% /snap/bare/5
loop2                 squashfs    4.0                                                         0   100% /snap/canonical-livepatch/248
loop3                 squashfs    4.0                                                         0   100% /snap/core/16091
loop4                 squashfs    4.0                                                         0   100% /snap/core/16202
loop5                 squashfs    4.0                                                         0   100% /snap/core18/2796
loop6                 squashfs    4.0                                                         0   100% /snap/core18/2812
loop7                 squashfs    4.0                                                         0   100% /snap/core20/1974
loop8                 squashfs    4.0                                                         0   100% /snap/core20/2015
loop9                 squashfs    4.0                                                         0   100% /snap/core22/1033
loop10                squashfs    4.0                                                         0   100% /snap/core22/864
loop11                squashfs    4.0                                                         0   100% /snap/cups/974
loop12                squashfs    4.0                                                         0   100% /snap/cups/980
loop13                squashfs    4.0                                                         0   100% /snap/firefox/3358
loop14                squashfs    4.0                                                         0   100% /snap/firefox/3416
loop15                squashfs    4.0                                                         0   100% /snap/gnome-3-26-1604/104
loop16                squashfs    4.0                                                         0   100% /snap/gnome-3-26-1604/111
loop17                squashfs    4.0                                                         0   100% /snap/gnome-3-28-1804/194
loop18                squashfs    4.0                                                         0   100% /snap/gnome-3-28-1804/198
loop19                squashfs    4.0                                                         0   100% /snap/gnome-3-34-1804/90
loop20                squashfs    4.0                                                         0   100% /snap/gnome-3-34-1804/93
loop21                squashfs    4.0                                                         0   100% /snap/gnome-3-38-2004/140
loop22                squashfs    4.0                                                         0   100% /snap/gnome-3-38-2004/143
loop23                squashfs    4.0                                                         0   100% /snap/gnome-42-2204/132
loop24                squashfs    4.0                                                         0   100% /snap/gnome-42-2204/141
loop25                squashfs    4.0                                                         0   100% /snap/gnome-system-monitor/184
loop26                squashfs    4.0                                                         0   100% /snap/gnome-system-monitor/186
loop27                squashfs    4.0                                                         0   100% /snap/gtk-common-themes/1534
loop28                squashfs    4.0                                                         0   100% /snap/gtk-common-themes/1535
loop29                squashfs    4.0                                                         0   100% /snap/snap-store/638
loop30                squashfs    4.0                                                         0   100% /snap/snap-store/959
loop31                squashfs    4.0                                                         0   100% /snap/snapd-desktop-integration/57
loop32                squashfs    4.0                                                         0   100% /snap/snapd-desktop-integration/83
sda                                                                                                    
??sda1                vfat        FAT32          62EB-8E64                               503,3M     1% /boot/efi
??sda2                                                                                                 
??sda5                LVM2_member LVM2 001       X34xd2-HOp4-sAHk-pudA-CzVG-rENF-FOtrO2                
  ??ubuntu--vg-root   ext4        1.0            43f5fc57-8370-4315-b5ba-95912f21e113     24,7G    70% /var/snap/firefox/common/host-hunspell
  ?                                                                                                    /media/robert_home
  ?                                                                                                    /
  ??ubuntu--vg-swap_1 swap        1              ad32bbec-507e-44b0-bb5f-1df3ee647a2a                  [SWAP]

How do you use 'onedrive'

./onedrive --confdir='/home/robert/.config/onedrive/accounts/robert@guitaronline.de' --synchronize --verbose --verbose --resync > debug_output.log 2>&1

Steps to reproduce the behaviour

run from console as above

Complete Verbose Log Output

DEBUG: ------------------------------------------------------------------
DEBUG: Processing OneDrive JSON item 6 of 83 as part of JSON Item Batch 1 of 1
DEBUG: Raw JSON OneDrive Item: {"@microsoft.graph.downloadUrl":"https:\/\/public.dm.files.1drv.com\/y4momfUOb2DmzAKUI6gNus-csUf9jXZ3rvW1Q6XFFdLJRRzQb-Zg6_2rgdPV9klxhoWaaEgks2LZS8l69_Z9XaPYwzWU6qcYV30JFQc2uYb4GXHu69AQkwDOtc9YNoReSbuXDcGm3GUTfZD5twaOBRgJDaobhVYrAZ8XJNO7KCojkoF2stlqEfsQYdauDNLbB9ykGjau-gTdDW9KkWKknK6Qk4s9jDF21sAaW6eum8H5B05Hf7pIvrQ2NE5JVfGC5wRl6EKKd83sZ08py-VZ-aq4g","cTag":"aYzpGMzAyOEJENzU4NTUyRkFGITY4Mi4yNTc","createdBy":{"application":{"displayName":"MSOffice15","id":"480728c5"},"device":{"id":"188006267c0904"},"oneDriveSync":{"@odata.type":"#microsoft.graph.identity","id":"0cf2e7c6-beb9-4dd9-aab2-ffff3a010000"},"user":{"displayName":"Robert Schulze","id":"9ba6f07668ba1ff7"}},"createdDateTime":"2022-11-13T22:54:06.153Z","eTag":"aRjMwMjhCRDc1ODU1MkZBRiE2ODIuMzc","file":{"hashes":{"quickXorHash":"6VgxIHZd1xZDn1OQ9yXABPCh2z8=","sha1Hash":"5383CEEF4DC78D6A340F7A331B8E8E77F36BA0AC","sha256Hash":"D85C5D6659E36D910D85F1C02E2764BA03A72C8600DD1BB38242F4ADBBE2FEC3"},"mimeType":"application\/octet-stream"},"fileSystemInfo":{"createdDateTime":"2022-11-13T22:54:06.153Z","lastModifiedDateTime":"2024-01-14T21:28:12Z"},"id":"F3028BD758552FAF!682","lastModifiedBy":{"application":{"displayName":"OneDrive Client for Linux","id":"4035b959"},"user":{"displayName":"Robert Schulze","id":"9ba6f07668ba1ff7"}},"lastModifiedDateTime":"2024-01-14T21:28:13.233Z","name":"dsc00018.cpg","parentReference":{"driveId":"f3028bd758552faf","driveType":"personal","id":"F3028BD758552FAF!574","name":"thumb","path":"\/drives\/f3028bd758552faf\/items\/F3028BD758552FAF!4690:\/Datenbanken\/Memory%20Stick%20altes%20Handy\/DCIM\/100MSDCF\/thumb"},"reactions":{"commentCount":0},"shared":{"owner":{"user":{"displayName":"Constanze Schulze","id":"f3028bd758552faf"}},"scope":"users"},"size":3088,"webUrl":"https:\/\/1drv.ms\/u\/s!AK8vVVjXiwLzhSo"}
DEBUG: Attempting to calculate local filesystem path for f3028bd758552faf and F3028BD758552FAF!574
DEBUG: New Item calculated full path is: OneDrive - Constanze/Datenbanken/Memory Stick altes Handy/DCIM/100MSDCF/thumb/dsc00018.cpg
DEBUG: The item we are syncing is a file
DEBUG: skip_file item to check: /OneDrive - Constanze/Datenbanken/Memory Stick altes Handy/DCIM/100MSDCF/thumb/dsc00018.cpg
DEBUG: skip_file evaluation for: /OneDrive - Constanze/Datenbanken/Memory Stick altes Handy/DCIM/100MSDCF/thumb/dsc00018.cpg
DEBUG: Result: false
DEBUG: sync_list item to check: OneDrive - Constanze/Datenbanken/Memory Stick altes Handy/DCIM/100MSDCF/thumb/dsc00018.cpg
DEBUG: Evaluation against 'sync_list' for this path: OneDrive - Constanze/Datenbanken/Memory Stick altes Handy/DCIM/100MSDCF/thumb/dsc00018.cpg
DEBUG: [S]exclude           = false
DEBUG: [S]exludeDirectMatch = false
DEBUG: [S]excludeMatched    = false
DEBUG: Evaluation against 'sync_list' entry: OneDrive-Constanze/Datenbanken/*
DEBUG: Evaluation against 'sync_list' entry: OneDrive - Constanze/Datenbanken/*
DEBUG: Evaluation against 'sync_list' result: wildcard pattern match
DEBUG: Evaluation against 'sync_list' entry: Datenbanken/*
DEBUG: Evaluation against 'sync_list' result: wildcard pattern match
DEBUG: [F]exclude           = false
DEBUG: [F]exludeDirectMatch = false
DEBUG: [F]excludeMatched    = false
DEBUG: Evaluation against 'sync_list' final result: included for sync
DEBUG: Flagging object as a file
DEBUG: OneDrive change is potentially a new local item
DEBUG: Local item time discrepancy detected: OneDrive - Constanze/Datenbanken/Memory Stick altes Handy/DCIM/100MSDCF/thumb/dsc00018.cpg
DEBUG: This local item has a different modified time 2024-Jan-14 22:17:47Z when compared to remote modified time 2024-Jan-14 21:28:12Z
DEBUG: Local item has the same hash value as the item online - correcting timestamp
DEBUG: The source of the incorrect timestamp was OneDrive online - correcting timestamp online
DEBUG: Read token from appConfig
DEBUG: Authorised State: true
DEBUG: Existing Microsoft OneDrive Access Token Expires: 2024-Jan-15 00:17:37.6221615
DEBUG: No valid Microsoft OneDrive webhook subscription to delete
DEBUG: saveItem - creating DB item from this JSON: {"@microsoft.graph.downloadUrl":"https:\/\/xqxz3a.DM.files.1drv.com\/y4pHzbCBD-iHFYMGShnQAEqsg-oiVwj6igq3PMkfDHXfQAVw1z0Bzz9x77RxzAb0_TRXiPcDIs0gYCHuxroZPMwIu9hghw5_QARY8118oUtvi1eMm-k2W-0c8P0r1iqSjNCK05T7rb2m3bv5I7AHWi6P1jy5DFWhwu-TdWF_xwXdtTlWlYOM_S_fCq2ez7-VcBR2x8y2nx8eHjdYBVY6-OcrBIELZOtuD5Kq2Rm5LywvEF7cBF4MAojKODEdoBTYfw0","@odata.context":"https:\/\/graph.m
![Screenshot 2024-01-14 235510](https://github.com/abraunegg/onedrive/assets/13728481/dd2a1774-4c0d-4934-9d8f-68d4ee7ef734)
icrosoft.com\/v1.0\/$metadata#drives('f3028bd758552faf')\/items\/$entity","cTag":"aYzpGMzAyOEJENzU4NTUyRkFGITY4Mi4yNTc","createdBy":{"application":{"displayName":"MSOffice15","id":"480728c5"},"device":{"id":"188006267c0904"},"oneDriveSync":{"@odata.type":"#microsoft.graph.identity","id":"0cf2e7c6-beb9-4dd9-aab2-ffff3a010000"},"user":{"displayName":"Robert Schulze","id":"9ba6f07668ba1ff7"}},"createdDateTime":"2022-11-13T22:54:06.153Z","eTag":"aRjMwMjhCRDc1ODU1MkZBRiE2ODIuMzg","file":{"hashes":{"quickXorHash":"6VgxIHZd1xZDn1OQ9yXABPCh2z8=","sha1Hash":"5383CEEF4DC78D6A340F7A331B8E8E77F36BA0AC","sha256Hash":"D85C5D6659E36D910D85F1C02E2764BA03A72C8600DD1BB38242F4ADBBE2FEC3"},"mimeType":"application\/octet-stream"},"fileSystemInfo":{"createdDateTime":"2022-11-13T22:54:06.153Z","lastModifiedDateTime":"2024-01-14T22:17:47Z"},"id":"F3028BD758552FAF!682","lastModifiedBy":{"application":{"displayName":"OneDrive Client for Linux","id":"4035b959"},"user":{"displayName":"Robert Schulze","id":"9ba6f07668ba1ff7"}},"lastModifiedDateTime":"2024-01-14T22:17:47.38Z","name":"dsc00018.cpg","parentReference":{"driveId":"f3028bd758552faf","driveType":"personal","id":"F3028BD758552FAF!574","name":"thumb","path":"\/drives\/f3028bd758552faf\/items\/F3028BD758552FAF!4690:\/Datenbanken\/Memory%20Stick%20altes%20Handy\/DCIM\/100MSDCF\/thumb"},"reactions":{"commentCount":0},"shared":{"owner":{"user":{"displayName":"Constanze Schulze","id":"f3028bd758552faf"}},"scope":"users"},"size":3088,"webUrl":"https:\/\/1drv.ms\/u\/s!AK8vVVjXiwLzhSo"}
DEBUG: Flagging object as a file
DEBUG: Adding to database: Item("f3028bd758552faf", "F3028BD758552FAF!682", "dsc00018.cpg", "", file, "aRjMwMjhCRDc1ODU1MkZBRiE2ODIuMzg", "aYzpGMzAyOEJENzU4NTUyRkFGITY4Mi4yNTc", 2024-Jan-14 22:17:47Z, "F3028BD758552FAF!574", "6VgxIHZd1xZDn1OQ9yXABPCh2z8=", "", "", "", "Y", "3088")
DEBUG: The item to sync is already present on the local filesystem and is in-sync with what is reported online
DEBUG: Update/Insert local database with item details: Item("f3028bd758552faf", "F3028BD758552FAF!682", "dsc00018.cpg", "", file, "aRjMwMjhCRDc1ODU1MkZBRiE2ODIuMzc", "aYzpGMzAyOEJENzU4NTUyRkFGITY4Mi4yNTc", 2024-Jan-14 21:28:12Z, "F3028BD758552FAF!574", "6VgxIHZd1xZDn1OQ9yXABPCh2z8=", "", "", "", "Y", "3088")
DEBUG: ------------------------------------------------------------------

Screenshots

Screenshot 2024-01-14 235510

Other Log Information or Details

No response

Additional context

No response

@robertschulze robertschulze added the Bug Something isn't working label Jan 14, 2024
@robertschulze
Copy link
Author

Screenshot 2024-01-14 235510

@abraunegg
Copy link
Owner

It would be interesting to track back what happenend when the file was actually downloaded.

When the file was written to disk, the online timestamp data should have been used to reset timestamp of the newly written file.

Either that didnt happen - or it did ... and something else modified the file locally post download.

Are you using any file indexing tooling?

Some linux indexing tooling (search issues) will modify the file / timestamp to indicate it has been indexed .... which is 100% the wrong way to do that. Need to rule out this is not the cause.

@abraunegg
Copy link
Owner

@robertschulze
Looking at the JSON data itself we have the following data:

Creation of file online

image

So this is when the file was created online | uploaded for the first time.

Online Filesystem Info

image

The createdDateTime matches the above as expected.

Last Modification Info

image

This date differs to the filesystem info by approx +1.2 seconds

The application, for consistency, will always use the ["fileSystemInfo"]["lastModifiedDateTime"] data from the provided JSON.

So when this is compared, the application does the following:

DEBUG: Local item time discrepancy detected: OneDrive - Constanze/Datenbanken/Memory Stick altes Handy/DCIM/100MSDCF/thumb/dsc00018.cpg
DEBUG: This local item has a different modified time 2024-Jan-14 22:17:47Z when compared to remote modified time 2024-Jan-14 21:28:12Z
DEBUG: Local item has the same hash value as the item online - correcting timestamp
...

So this is working correctly.

However, if you are using --download-only - this should not be happening:

DEBUG: The source of the incorrect timestamp was OneDrive online - correcting timestamp online

So that in itself is a bug (the code is not looking for --download-only at that point) ... however the question that needs to be asked here is - why is the local file newer ?

When a file is downloaded, a function called setTimes() uses the JSON data and sets the local file time to that ["fileSystemInfo"]["lastModifiedDateTime"] data.

Do you have any log that shows the very initial download of the file to your system?

I agree that there is a bug - the correction of the data online in a --download-only mode should not happen ... but I am trying to understand how or what modified the file locally to have a different date to begin with - that is triggering this issue.

@abraunegg abraunegg added this to the v2.5.0 milestone Jan 15, 2024
@abraunegg
Copy link
Owner

@robertschulze
The technical bug has been fixed in v2.5.0-alpha-5 GitHub version: v2.4.25-35-gc5f2ec4 or greater.

Whilst I have not been able to reproduce this (as I do not use any GUI or file indexing) - please can you use this version to validate the fix.

The why still needs to be understood as well - as if you are not making changes to a file locally, and using --download-only .. something on your system modified the timestamp.

@robertschulze
Copy link
Author

@abraunegg I don't know fully sure how the modified file date (it is two years, not just seconds) came about. I am not using any such Indexing software and since onedrive 2.5 I am using no GUI either. However, I recall noticing wrong file dates after synchronization with a prior version of onedrive (not sure whether <2.5 or 2.5-alpha-X), so my guess would be that at some point when downloading the files, the time of the download was used instead of the time stored in OneDrive Online.
I noticed now that something happened earlier as well: alot of the files in this particular OneDrive have the same date from October. I am in the process of restoring the file dates by restoring the files on the OneDrive from another backup. I can continue testing then.

@abraunegg
Copy link
Owner

@robertschulze
Yes - 2 years - my error there.

Older versions of the client, especially the Ubuntu Universe packages have all sorts of bugs that have been fixed.

I have double checked the v2.5.x code and setTimes() is used post file download - so unless something else is going on it is difficult to pinpoint a cause.

What client version were you using around that timeframe?

@robertschulze
Copy link
Author

robertschulze commented Jan 15, 2024

I think it happened with either alpha-3 or already alpha-4, because I posted the following log with alpha-4 cf. the log [here] (#2562 (comment)) where the wrong file date was freshly in place.

DEBUG: Local item time discrepancy detected: OneDrive-Constanze/Logo/20130312 - Ausbildungsvertrag + Anschreiben.pdf
DEBUG: This local item has a different modified time 2023-Dec-21 23:50:51Z when compared to remote modified time 2014-Jul-14 18:41:13Z
DEBUG: Local item has the same hash value as the item online - correcting timestamp
DEBUG: The source of the incorrect timestamp was OneDrive online - correcting timestamp online

@abraunegg
Copy link
Owner

I think it happened with either alpha-3 or already alpha-4, because I posted the following log with alpha-4 cf. the log [here] (#2562 (comment)) where the wrong file date was freshly in place.

DEBUG: Local item time discrepancy detected: OneDrive-Constanze/Logo/20130312 - Ausbildungsvertrag + Anschreiben.pdf
DEBUG: This local item has a different modified time 2023-Dec-21 23:50:51Z when compared to remote modified time 2014-Jul-14 18:41:13Z
DEBUG: Local item has the same hash value as the item online - correcting timestamp
DEBUG: The source of the incorrect timestamp was OneDrive online - correcting timestamp online

Whilst this was 'setting' the online date (as per this bug) to something incorrect - the file was already potentially present on your local filesystem - so the bad time change is not occurring here for the first time ... and it is still unknown what set that date.

What is interesting is that there appears to be a double DB write as well - one with the corrected date data, but also one for the original comparison ... that should not be happening either:

DEBUG: Flagging object as a file
DEBUG: Adding to database: Item("f3028bd758552faf", "F3028BD758552FAF!2977", "20130312 - Ausbildungsvertrag + Anschreiben.pdf", "", file, "aRjMwMjhCRDc1ODU1MkZBRiEyOTc3LjI2", "aYzpGMzAyOEJENzU4NTUyRkFGITI5NzcuMjU3", 2023-Dec-21 23:50:51Z, "F3028BD758552FAF!2948", "Sbrp52ctlmFWVWsj/IILVq5kCJ8=", "", "", "", "Y", "627299")
DEBUG: The item to sync is already present on the local filesystem and is in-sync with what is reported online
DEBUG: Update/Insert local database with item details: Item("f3028bd758552faf", "F3028BD758552FAF!2977", "20130312 - Ausbildungsvertrag + Anschreiben.pdf", "", file, "aRjMwMjhCRDc1ODU1MkZBRiEyOTc3LjU", "aYzpGMzAyOEJENzU4NTUyRkFGITI5NzcuMjU3", 2014-Jul-14 18:41:13Z, "F3028BD758552FAF!2948", "Sbrp52ctlmFWVWsj/IILVq5kCJ8=", "", "", "", "Y", "627299")

This will need some thought on how to handle this to avoid writing 2 different DB records for the same item, but with different data.

@abraunegg
Copy link
Owner

@robertschulze

Please can you rebuild your client to v2.5.0-alpha-5 GitHub version: v2.4.25-37-gb1a07a2 or greater.

I have corrected the double DB writes, and ensured that in a --download-only scenario, if there is a timestamp difference, this is not pushed to OneDrive online.

If you can help validate this against your current issue that would be greatly appreciated.

@robertschulze
Copy link
Author

robertschulze commented Jan 18, 2024

@abraunegg

I think it happened with either alpha-3 or already alpha-4, because I posted the following log with alpha-4 cf. the log [here] (#2562 (comment)) where the wrong file date was freshly in place.

DEBUG: Local item time discrepancy detected: OneDrive-Constanze/Logo/20130312 - Ausbildungsvertrag + Anschreiben.pdf
DEBUG: This local item has a different modified time 2023-Dec-21 23:50:51Z when compared to remote modified time 2014-Jul-14 18:41:13Z
DEBUG: Local item has the same hash value as the item online - correcting timestamp
DEBUG: The source of the incorrect timestamp was OneDrive online - correcting timestamp online

Whilst this was 'setting' the online date (as per this bug) to something incorrect - the file was already potentially present on your local filesystem - so the bad time change is not occurring here for the first time ... and it is still unknown what set that date.

Yes, that's what I meant. In the given log (which is from alpha-4) the offline date was already wrong, so the creation of the wrong offline date must have happened before. Unfortunately I cannot recall whether I did a prior run with alpha-4 but for sure one with alpha-3. Since either of the two would have changed the online date due to the --download-only bug (but the online date was not yet changed), it could not have been earlier than alpha-3.

I have recompiled to v2.5.0-alpha-5 GitHub version: v2.4.25-39-ge8406b7, performed a new full resync and changed to date of TestWordfile.docx from 2023-12-15 to 2023-12-25. Now performing a new full resync does correctly reset the date to 2023-12-15. However, there is a strange log message DEBUG: The local item is out-of-sync with OneDrive, renaming to preserve existing file and prevent local data loss: OneDrive - Constanze/Datenbanken/TestWordfile.docx -> OneDrive - Constanze/Datenbanken/TestWordfile-atom.docx about some renaming but I see no renamed file.

EBUG: ------------------------------------------------------------------
DEBUG: Processing OneDrive JSON item 83 of 83 as part of JSON Item Batch 1 of 1
DEBUG: Raw JSON OneDrive Item: {"@microsoft.graph.downloadUrl":"https:\/\/xqxz3a.dm.files.1drv.com\/y4mFDN6X7wd8IK-N5YqUVrSYhtFHTNUZCztckVD9ibcDKnjHr8Oi9XqxDT_XFhR9nrjDVZ7G-kpIURT4oouwBFwMQx1VcwZE7QXHPaoLZ2GcY1cCsoQsKEWvlaVHClvG2JXWVFwOsIFZFR2GTzRk18iJSU8qVFc9vCs3KN02bWZAjtOEUyn0acplNedJUzuBypjTYp2PH6vCW_AfKDdfMEJxg","cTag":"aYzpGMzAyOEJENzU4NTUyRkFGITQ3MTYuNjQ4","createdBy":{"user":{"displayName":"Robert Schulze","id":"9ba6f07668ba1ff7"}},"createdDateTime":"2023-12-14T23:25:09.13Z","eTag":"aRjMwMjhCRDc1ODU1MkZBRiE0NzE2LjI5","file":{"hashes":{"quickXorHash":"JQvK\/I1JNHwmd8\/DP8oyU5RZpgY=","sha1Hash":"5F1E5B86CFA3B92BC81E7E7234C3FC0A4E298748","sha256Hash":"AE37561FAB7728D809BA558CD78749AFF85BC590C793C4D1A2D3CAF2B2D3A039"},"mimeType":"application\/vnd.openxmlformats-officedocument.wordprocessingml.document"},"fileSystemInfo":{"createdDateTime":"2023-12-14T23:25:09.13Z","lastModifiedDateTime":"2023-12-14T23:25:28Z"},"id":"F3028BD758552FAF!4716","lastModifiedBy":{"application":{"displayName":"MSOffice15","id":"480728c5"},"device":{"id":"18c008d090d4e4"},"oneDriveSync":{"@odata.type":"#microsoft.graph.identity","id":"a03cce43-2015-4db3-b0c8-ffff66090000"},"user":{"displayName":"Robert Schulze","id":"9ba6f07668ba1ff7"}},"lastModifiedDateTime":"2024-01-15T19:10:15.75Z","name":"TestWordfile.docx","parentReference":{"driveId":"f3028bd758552faf","driveType":"personal","id":"F3028BD758552FAF!569","name":"Datenbanken","path":"\/drives\/f3028bd758552faf\/items\/F3028BD758552FAF!4690:\/Datenbanken"},"reactions":{"commentCount":0},"shared":{"owner":{"user":{"displayName":"Constanze Schulze","id":"f3028bd758552faf"}},"scope":"users"},"size":10854,"webUrl":"https:\/\/1drv.ms\/w\/s!AK8vVVjXiwLzpGw"}
DEBUG: Attempting to calculate local filesystem path for f3028bd758552faf and F3028BD758552FAF!569
DEBUG: New Item calculated full path is: OneDrive - Constanze/Datenbanken/TestWordfile.docx
DEBUG: The item we are syncing is a file
DEBUG: skip_file item to check: /OneDrive - Constanze/Datenbanken/TestWordfile.docx
DEBUG: skip_file evaluation for: /OneDrive - Constanze/Datenbanken/TestWordfile.docx
DEBUG: Result: false
DEBUG: sync_list item to check: OneDrive - Constanze/Datenbanken/TestWordfile.docx
DEBUG: Evaluation against 'sync_list' for this path: OneDrive - Constanze/Datenbanken/TestWordfile.docx
DEBUG: [S]exclude           = false
DEBUG: [S]exludeDirectMatch = false
DEBUG: [S]excludeMatched    = false
DEBUG: Evaluation against 'sync_list' entry: OneDrive - Constanze/Datenbanken/*
DEBUG: Evaluation against 'sync_list' result: wildcard pattern match
DEBUG: Evaluation against 'sync_list' entry: Datenbanken/*
DEBUG: Evaluation against 'sync_list' result: wildcard pattern match
DEBUG: [F]exclude           = false
DEBUG: [F]exludeDirectMatch = false
DEBUG: [F]excludeMatched    = false
DEBUG: Evaluation against 'sync_list' final result: included for sync
DEBUG: Flagging object as a file
DEBUG: OneDrive change is potentially a new local item
DEBUG: Path on local disk already exists
DEBUG: Local file time discrepancy detected: OneDrive - Constanze/Datenbanken/TestWordfile.docx
DEBUG: This local file has a different modified time 2024-Jan-18 05:59:27Z when compared to remote modified time 2023-Dec-14 23:25:28Z
DEBUG: Local item has the same hash value as the item online - correcting the applicable file timestamp
DEBUG: The source of the incorrect timestamp was the local file - correcting timestamp locally due to --download-only
DEBUG: Calling setTimes() for this file: OneDrive - Constanze/Datenbanken/TestWordfile.docx
DEBUG: The item to sync exists locally but is potentially not in the local database - otherwise this would be handled as changed item
DEBUG: Remote item modified time is newer based on UTC time conversion
DEBUG: localModifiedTime (local file):   2023-Dec-14 23:25:28Z
DEBUG: itemModifiedTime (OneDrive item): 2023-Dec-14 23:25:28Z
DEBUG: The local item is out-of-sync with OneDrive, renaming to preserve existing file and prevent local data loss: OneDrive - Constanze/Datenbanken/TestWordfile.docx -> OneDrive - Constanze/Datenbanken/TestWordfile-atom.docx
DEBUG: ------------------------------------------------------------------

in fact the message also appears for all other files (i.e. ones which I did not change)

DEBUG: ------------------------------------------------------------------
DEBUG: Processing OneDrive JSON item 82 of 83 as part of JSON Item Batch 1 of 1
DEBUG: Raw JSON OneDrive Item: {"@microsoft.graph.downloadUrl":"https:\/\/public.dm.files.1drv.com\/y4mLKEXR2J9FXvuOKoK6Oejhzxmd7-yv6K4KSpMwcEHfSXBjjBFR0r4ZNXUVrQirY8AyN9AI4FoZEp1R4Mqy4BDgWKwzL5nBUCu4F0RdGqyWrYYk9k9V0sgS5E58rqj88DjVWF86V5iMfT1XOZRpL9tRW79ChxshQfdug09r5DGJArnFlkl17ddN3pQHTe6zdnAkAfS4U7XLZB5tsKxLwRbCEMWtIEQSgQ2tZ0TLrIoRhnVfZAeKBsPxshw5cKT9nX6vtFcNt47R-Cx5zFGkA854A","cTag":"aYzpGMzAyOEJENzU4NTUyRkFGITU3Ny4yNTc","createdBy":{"application":{"displayName":"MSOffice15","id":"480728c5"},"device":{"id":"188006267c0904"},"oneDriveSync":{"@odata.type":"#microsoft.graph.identity","id":"0cf2e7c6-beb9-4dd9-aab2-ffffd6000000"},"user":{"displayName":"Robert Schulze","id":"9ba6f07668ba1ff7"}},"createdDateTime":"2022-11-13T22:53:23.21Z","eTag":"aRjMwMjhCRDc1ODU1MkZBRiE1NzcuNDA","file":{"hashes":{"quickXorHash":"EiKS+Hl33H2w89D7xSCPIia2z2A=","sha1Hash":"8A2DC287CB3074C55EBAD7656F22A12E24E4F8E3","sha256Hash":"36B75ED8D3114FD815FE92DF0D43F34A9BDC81EA1D88B6BE7D88EAF4524AA104"},"mimeType":"application\/octet-stream"},"fileSystemInfo":{"createdDateTime":"2022-11-13T22:53:23.21Z","lastModifiedDateTime":"2011-09-05T18:29:20Z"},"id":"F3028BD758552FAF!577","lastModifiedBy":{"application":{"displayName":"MSOffice15","id":"480728c5"},"device":{"id":"18c008d090d4e4"},"oneDriveSync":{"@odata.type":"#microsoft.graph.identity","id":"a03cce43-2015-4db3-b0c8-ffff43000000"},"user":{"displayName":"Robert Schulze","id":"9ba6f07668ba1ff7"}},"lastModifiedDateTime":"2024-01-14T23:08:11.67Z","name":"Kontakte Handy K750i.csv","parentReference":{"driveId":"f3028bd758552faf","driveType":"personal","id":"F3028BD758552FAF!569","name":"Datenbanken","path":"\/drives\/f3028bd758552faf\/items\/F3028BD758552FAF!4690:\/Datenbanken"},"reactions":{"commentCount":0},"shared":{"owner":{"user":{"displayName":"Constanze Schulze","id":"f3028bd758552faf"}},"scope":"users"},"size":3767,"webUrl":"https:\/\/1drv.ms\/u\/s!AK8vVVjXiwLzhEE"}
DEBUG: Attempting to calculate local filesystem path for f3028bd758552faf and F3028BD758552FAF!569
DEBUG: New Item calculated full path is: OneDrive - Constanze/Datenbanken/Kontakte Handy K750i.csv
DEBUG: The item we are syncing is a file
DEBUG: skip_file item to check: /OneDrive - Constanze/Datenbanken/Kontakte Handy K750i.csv
DEBUG: skip_file evaluation for: /OneDrive - Constanze/Datenbanken/Kontakte Handy K750i.csv
DEBUG: Result: false
DEBUG: sync_list item to check: OneDrive - Constanze/Datenbanken/Kontakte Handy K750i.csv
DEBUG: Evaluation against 'sync_list' for this path: OneDrive - Constanze/Datenbanken/Kontakte Handy K750i.csv
DEBUG: [S]exclude           = false
DEBUG: [S]exludeDirectMatch = false
DEBUG: [S]excludeMatched    = false
DEBUG: Evaluation against 'sync_list' entry: OneDrive - Constanze/Datenbanken/*
DEBUG: Evaluation against 'sync_list' result: wildcard pattern match
DEBUG: Evaluation against 'sync_list' entry: Datenbanken/*
DEBUG: Evaluation against 'sync_list' result: wildcard pattern match
DEBUG: [F]exclude           = false
DEBUG: [F]exludeDirectMatch = false
DEBUG: [F]excludeMatched    = false
DEBUG: Evaluation against 'sync_list' final result: included for sync
DEBUG: Flagging object as a file
DEBUG: OneDrive change is potentially a new local item
DEBUG: Path on local disk already exists
DEBUG: Local file time discrepancy detected: OneDrive - Constanze/Datenbanken/Kontakte Handy K750i.csv
DEBUG: This local file has a different modified time 2024-Jan-18 05:59:27Z when compared to remote modified time 2011-Sep-05 18:29:20Z
DEBUG: Local item has the same hash value as the item online - correcting the applicable file timestamp
DEBUG: The source of the incorrect timestamp was the local file - correcting timestamp locally due to --download-only
DEBUG: Calling setTimes() for this file: OneDrive - Constanze/Datenbanken/Kontakte Handy K750i.csv
DEBUG: The item to sync exists locally but is potentially not in the local database - otherwise this would be handled as changed item
DEBUG: Remote item modified time is newer based on UTC time conversion
DEBUG: localModifiedTime (local file):   2011-Sep-05 18:29:20Z
DEBUG: itemModifiedTime (OneDrive item): 2011-Sep-05 18:29:20Z
DEBUG: The local item is out-of-sync with OneDrive, renaming to preserve existing file and prevent local data loss: OneDrive - Constanze/Datenbanken/Kontakte Handy K750i.csv -> OneDrive - Constanze/Datenbanken/Kontakte Handy K750i-atom.csv
DEBUG: ------------------------------------------------------------------

I then changed to date of TestWordfile.docx from 2023-12-15 to 2023-12-05. Now performing a simple sync does correctly reset the date to 2023-12-15. Here, the strange thing is that the log does not mention the correction/overwrite

DEBUG: ------------------------------------------------------------------
DEBUG: Processing OneDrive JSON item 83 of 83 as part of JSON Item Batch 1 of 1
DEBUG: Raw JSON OneDrive Item: {"@microsoft.graph.downloadUrl":"https:\/\/xqxz3a.dm.files.1drv.com\/y4m1lIouLIz0uTw3lJB4i81siuOEYQUpVEq2BVbYTyMBxV5kw3b7HPMGSyz-QYFMqnyfLLnZLKr0a8FnsS5tZinmJa03ttVfbyfd613XekUvwQ9DoTrGuacRNfy0HMeCFXRqOfqu6vTX9e4Xq02au917lfyw2L9B4XQX8pfBtq3kKW9pts_X4PP3fDWoiQCN1di-iPdiKDItG1s7Yk33NhMmQ","cTag":"aYzpGMzAyOEJENzU4NTUyRkFGITQ3MTYuNjQ4","createdBy":{"user":{"displayName":"Robert Schulze","id":"9ba6f07668ba1ff7"}},"createdDateTime":"2023-12-14T23:25:09.13Z","eTag":"aRjMwMjhCRDc1ODU1MkZBRiE0NzE2LjI5","file":{"hashes":{"quickXorHash":"JQvK\/I1JNHwmd8\/DP8oyU5RZpgY=","sha1Hash":"5F1E5B86CFA3B92BC81E7E7234C3FC0A4E298748","sha256Hash":"AE37561FAB7728D809BA558CD78749AFF85BC590C793C4D1A2D3CAF2B2D3A039"},"mimeType":"application\/vnd.openxmlformats-officedocument.wordprocessingml.document"},"fileSystemInfo":{"createdDateTime":"2023-12-14T23:25:09.13Z","lastModifiedDateTime":"2023-12-14T23:25:28Z"},"id":"F3028BD758552FAF!4716","lastModifiedBy":{"application":{"displayName":"MSOffice15","id":"480728c5"},"device":{"id":"18c008d090d4e4"},"oneDriveSync":{"@odata.type":"#microsoft.graph.identity","id":"a03cce43-2015-4db3-b0c8-ffff66090000"},"user":{"displayName":"Robert Schulze","id":"9ba6f07668ba1ff7"}},"lastModifiedDateTime":"2024-01-15T19:10:15.75Z","name":"TestWordfile.docx","parentReference":{"driveId":"f3028bd758552faf","driveType":"personal","id":"F3028BD758552FAF!569","name":"Datenbanken","path":"\/drives\/f3028bd758552faf\/items\/F3028BD758552FAF!4690:\/Datenbanken"},"reactions":{"commentCount":0},"shared":{"owner":{"user":{"displayName":"Constanze Schulze","id":"f3028bd758552faf"}},"scope":"users"},"size":10854,"webUrl":"https:\/\/1drv.ms\/w\/s!AK8vVVjXiwLzpGw"}
DEBUG: Attempting to calculate local filesystem path for f3028bd758552faf and F3028BD758552FAF!569
DEBUG: New Item calculated full path is: OneDrive - Constanze/Datenbanken/TestWordfile.docx
DEBUG: The item we are syncing is a file
DEBUG: skip_file item to check: /OneDrive - Constanze/Datenbanken/TestWordfile.docx
DEBUG: skip_file evaluation for: /OneDrive - Constanze/Datenbanken/TestWordfile.docx
DEBUG: Result: false
DEBUG: sync_list item to check: OneDrive - Constanze/Datenbanken/TestWordfile.docx
DEBUG: Evaluation against 'sync_list' for this path: OneDrive - Constanze/Datenbanken/TestWordfile.docx
DEBUG: [S]exclude           = false
DEBUG: [S]exludeDirectMatch = false
DEBUG: [S]excludeMatched    = false
DEBUG: Evaluation against 'sync_list' entry: OneDrive - Constanze/Datenbanken/*
DEBUG: Evaluation against 'sync_list' result: wildcard pattern match
DEBUG: Evaluation against 'sync_list' entry: Datenbanken/*
DEBUG: Evaluation against 'sync_list' result: wildcard pattern match
DEBUG: [F]exclude           = false
DEBUG: [F]exludeDirectMatch = false
DEBUG: [F]excludeMatched    = false
DEBUG: Evaluation against 'sync_list' final result: included for sync
DEBUG: Flagging object as a file
DEBUG: OneDrive change is an update to an existing local item
DEBUG: Attempting to calculate local filesystem path for f3028bd758552faf and F3028BD758552FAF!569
DEBUG: Adding changed OneDrive Item to database: Item("f3028bd758552faf", "F3028BD758552FAF!4716", "TestWordfile.docx", "", file, "aRjMwMjhCRDc1ODU1MkZBRiE0NzE2LjI5", "aYzpGMzAyOEJENzU4NTUyRkFGITQ3MTYuNjQ4", 2023-Dec-14 23:25:28Z, "F3028BD758552FAF!569", "JQvK/I1JNHwmd8/DP8oyU5RZpgY=", "", "", "", "Y", "10854")
DEBUG: ------------------------------------------------------------------

instead there is a different section taking care of this now:

DEBUG: Number of JSON items to process is: 0
DEBUG: Number of JSON items processed was: 83
DEBUG: Performing a database consistency and integrity check on locally stored data ... 
DEBUG: Processing DB entries for this Drive ID: 9ba6f07668ba1ff7
DEBUG: Selecting DB items via itemDB.selectByDriveId(driveId)
DEBUG: Database items to process for this driveId: 1
DEBUG: Attempting to calculate local filesystem path for 9ba6f07668ba1ff7 and 9BA6F07668BA1FF7!103
DEBUG: Processing /media/3/3 - OneDrive/OneDrive_robert@guitaronline.de
DEBUG: The directory has not changed
DEBUG: Attempting to calculate local filesystem path for 9ba6f07668ba1ff7 and 9BA6F07668BA1FF7!22186
DEBUG: Processing OneDrive - Constanze
DEBUG: Processing DB entries for this Drive ID: f3028bd758552faf
DEBUG: Selecting DB items via itemDB.selectByDriveId(driveId)
DEBUG: Database items to process for this driveId: 1
[...]
DEBUG: Attempting to calculate local filesystem path for f3028bd758552faf and F3028BD758552FAF!4716
DEBUG: Processing OneDrive - Constanze/Datenbanken/TestWordfile.docx
DEBUG: The local item has a different modified time 2024-Jan-18 06:12:26Z when compared to database modified time 2023-Dec-14 23:25:28Z
DEBUG: The last modified timestamp has changed however the file content has not changed
DEBUG: The local item has the same hash value as the item online - correcting local timestamp due to --download-only being used to ensure local file matches timestamp online
DEBUG: Calling setTimes() for this file: OneDrive - Constanze/Datenbanken/TestWordfile.docx
DEBUG: Attempting to calculate local filesystem path for f3028bd758552faf and F3028BD758552FAF!577

So far so good, but I noticed that there are many cases like

DEBUG: Attempting to calculate local filesystem path for f3028bd758552faf and F3028BD758552FAF!682
DEBUG: Processing OneDrive - Constanze/Datenbanken/Memory Stick altes Handy/DCIM/100MSDCF/thumb/dsc00018.cpg
DEBUG: The local item has a different modified time 2024-Jan-18 06:12:26Z when compared to database modified time 2007-May-06 15:43:16Z
DEBUG: The last modified timestamp has changed however the file content has not changed
DEBUG: The local item has the same hash value as the item online - correcting local timestamp due to --download-only being used to ensure local file matches timestamp online
DEBUG: Calling setTimes() for this file: OneDrive - Constanze/Datenbanken/Memory Stick altes Handy/DCIM/100MSDCF/thumb/dsc00018.cpg
DEBUG: Attempting to calculate local filesystem path for f3028bd758552faf and F3028BD758552FAF!687

The thing is: the files actually have to correct file date, so the determined modified time 2024-Jan-18 06:12:26Z is wrong.

Screenshot 2024-01-18 073452

I guess the wrong determination of the local file data could have been the vector for the modified online dates.

@abraunegg
Copy link
Owner

abraunegg commented Jan 18, 2024

@robertschulze
OK .. so looking at 2 issues here:

  1. A log message citing that a backup of a file is occurring, but no backup file is being found ...
  2. setTimes() is being called, using the DB data, but you say the modified time data being pulled in is incorrect.

RE Point 1: A safe backup should be occurring - as an atomic operation is used to ensure that the target file (the copy) is missing. I would be looking to ensure you have no filesystem issues going on here.

When my system creates a backup, this is correctly created:

This local file has a different modified time 2024-Jan-18 07:29:03Z when compared to remote modified time 2024-Jan-18 07:27:22Z
Local item has the same hash value as the item online - correcting the applicable file timestamp
The source of the incorrect timestamp was the local file - correcting timestamp locally due to --download-only
Remote item modified time is newer based on UTC time conversion
The local item is out-of-sync with OneDrive, renaming to preserve existing file and prevent local data loss: ./newfile.txt -> ./newfile-onedrive-client-dev.txt

Filesystem:

changedfile.txt  newfile-onedrive-client-dev.txt  newfile.txt  random_25k_files  Source_Folder  Target_Folder

RE Point 2: The 'localModifiedTime' is taken again from the underlying filesystem. When viewing the files in a CLI, use stat rather than the GUI:

This local file has a different modified time 2024-Jan-18 07:29:03Z when compared to remote modified time 2024-Jan-18 07:27:22Z

stat

  File: newfile.txt
  Size: 153             Blocks: 8          IO Block: 4096   regular file
Device: 811h/2065d      Inode: 140499877   Links: 1
Access: (0600/-rw-------)  Uid: ( 1000/    alex)   Gid: ( 1000/    alex)
Context: unconfined_u:object_r:user_home_t:s0
Access: 2024-01-18 18:29:03.373773771 +1100
Modify: 2024-01-18 18:29:03.373773771 +1100
Change: 2024-01-18 18:29:03.373773771 +1100
 Birth: 2024-01-18 18:27:17.355430625 +1100

I would suspect that your file has a modify time of 2024-Jan-18 06:12:26Z

I would perform a filesystem integrity check, ensure that you do not have a background running process of 'onedrive' lurking around or something else going on.

Post the --download-only operation, the stat of newfile.txt shows that the timestamp has been changed:

[alex@onedrive-client-dev OneDrive]$ stat newfile.txt 
  File: newfile.txt
  Size: 153             Blocks: 8          IO Block: 4096   regular file
Device: 811h/2065d      Inode: 140499847   Links: 1
Access: (0600/-rw-------)  Uid: ( 1000/    alex)   Gid: ( 1000/    alex)
Context: unconfined_u:object_r:user_home_t:s0
Access: 2024-01-18 18:29:13.360994492 +1100
Modify: 2024-01-18 18:27:22.000000000 +1100   <-- Matches online data now
Change: 2024-01-18 18:29:13.356994404 +1100
 Birth: 2024-01-18 18:29:12.630978358 +1100

@abraunegg
Copy link
Owner

@robertschulze
Regarding this specific log output:

DEBUG: The item to sync exists locally but is potentially not in the local database - otherwise this would be handled as changed item
DEBUG: Remote item modified time is newer based on UTC time conversion
DEBUG: localModifiedTime (local file):   2011-Sep-05 18:29:20Z
DEBUG: itemModifiedTime (OneDrive item): 2011-Sep-05 18:29:20Z

The time comparison here is the same - so in reality, there should be no further action. This has been fixed in v2.5.0-alpha-5 GitHub version: v2.4.25-40-ga1f10cc

Using the following path to store the runtime application log: /home/alex
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-40-ga1f10cc
Account Type:         personal
Default Drive ID:     66d53be8a5056eca
Default Root ID:      66D53BE8A5056ECA!101
Remaining Free Space: 4.92 GB (5280888779 bytes)
Sync Engine Initialised with new Onedrive API instance
All application operations will be performed in the configured local 'sync_dir' directory: /home/alex/OneDrive
Fetching /delta response from the OneDrive API for Drive ID: 66d53be8a5056eca
Processing API Response Bundle: 1 - Quantity of 'changes|items' in this bundle to process: 7
Processing API Response Bundle: 2 - Quantity of 'changes|items' in this bundle to process: 1
Finished processing /delta JSON response from the OneDrive API
Processing 5 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: ./newfile.txt
This local file has a different modified time 2024-Jan-18 08:05:05Z when compared to remote modified time 2024-Jan-18 07:27:22Z
Local item has the same hash value as the item online - correcting the applicable file timestamp
The source of the incorrect timestamp was the local file - correcting timestamp locally due to --download-only
File timestamps are equal, no further action required
Performing a database consistency and integrity check on locally stored data ... 
Processing DB entries for this Drive ID: 66d53be8a5056eca
Processing ~/OneDrive
The directory has not changed
Processing Target_Folder
The directory has not changed
Processing Target_Folder/dummy_doc.docx
The file has not changed
Processing Source_Folder
The directory has not changed
Processing changedfile.txt
The file has not changed

Sync with Microsoft OneDrive is complete

@robertschulze
Copy link
Author

Your hunch appears to be correct. Cleaning up and performing a new resync testWordfile.docx has a Change date still equal to the sync time:

$ stat TestWordfile.docx 
  File: TestWordfile.docx
  Size: 10854           Blocks: 24         IO Block: 1048576 regular file
Device: 31h/49d Inode: 281474977224417  Links: 1
Access: (0777/-rwxrwxrwx)  Uid: ( 1000/  robert)   Gid: (  100/   users)
Access: 2023-12-15 00:25:28.000000000 +0100
Modify: 2023-12-15 00:25:28.000000000 +0100
Change: 2024-01-18 10:34:58.591237500 +0100
 Birth: 2024-01-18 10:34:56.827461200 +0100

If I understood correctly, for you all the dates are equal. The only reason I can think of is that the drive I am storing the backup on is mounted via Windows Filesharing (Samda/CIFS)

//hyperv/3 on /media/3 type cifs (rw,relatime,vers=2.1,cache=strict,username=XYZ,uid=1000,noforceuid,gid=100,noforcegid,addr=192.168.3.11,file_mode=0777,dir_mode=0777,soft,nounix,serverino,mapposix,rsize=1048576,wsize=1048576,bsize=1048576,echo_interval=60,actimeo=1,closetimeo=1)

@abraunegg
Copy link
Owner

abraunegg commented Jan 18, 2024

@robertschulze
When using v2.5.0-alpha-5 GitHub version: v2.4.25-40-ga1f10cc against a SMB and NFS network share, these are my results:

Samba | SMB Mounted Directory

Samba Mount

//ip.redacted/testshare on /mnt/samba type cifs (rw,relatime,vers=3.1.1,cache=strict,username=root,uid=0,noforceuid,gid=10,noforcegid,addr=ip.redacted,file_mode=0775,dir_mode=0775,iocharset=utf8,soft,nounix,serverino,mapposix,noperm,rsize=4194304,wsize=4194304,bsize=1048576,echo_interval=60,actimeo=1)

Files before run

[alex@onedrive-client-dev samba]$ ls -la
total 2048
drwxrwxr-x. 2 root wheel   0 Jan 19 08:25 .
drwxr-xr-x. 4 root root   30 Jan 19 07:22 ..
-rwxrwxr-x. 1 root wheel  41 Jan 18 08:28 changedfile.txt
-rwxrwxr-x. 1 root wheel 153 Jan 18 18:27 newfile.txt
drwxrwxr-x. 2 root wheel   0 Jan 17 09:44 Source_Folder
drwxrwxr-x. 2 root wheel   0 Jan 19 08:25 Target_Folder
[alex@onedrive-client-dev samba]$ stat changedfile.txt 
  File: changedfile.txt
  Size: 41              Blocks: 2048       IO Block: 1048576 regular file
Device: 32h/50d Inode: 141         Links: 1
Access: (0775/-rwxrwxr-x)  Uid: (    0/    root)   Gid: (   10/   wheel)
Context: system_u:object_r:cifs_t:s0
Access: 2024-01-18 08:28:14.000000000 +1100
Modify: 2024-01-18 08:28:14.000000000 +1100
Change: 2024-01-18 08:28:14.000000000 +1100
 Birth: 2024-01-19 08:25:27.153251900 +1100
[alex@onedrive-client-dev samba]$ touch changedfile.txt 
[alex@onedrive-client-dev samba]$ stat changedfile.txt  
  File: changedfile.txt
  Size: 41              Blocks: 2048       IO Block: 1048576 regular file
Device: 32h/50d Inode: 141         Links: 1
Access: (0775/-rwxrwxr-x)  Uid: (    0/    root)   Gid: (   10/   wheel)
Context: system_u:object_r:cifs_t:s0
Access: 2024-01-19 08:28:25.552609500 +1100
Modify: 2024-01-19 08:28:25.552609500 +1100
Change: 2024-01-19 08:28:25.552609500 +1100
 Birth: 2024-01-19 08:25:27.153251900 +1100
[alex@onedrive-client-dev samba]$ 

Application Run:

Using the following path to store the runtime application log: /home/alex
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-36-gcda8317
Account Type:         personal
Default Drive ID:     66d53be8a5056eca
Default Root ID:      66D53BE8A5056ECA!101
Remaining Free Space: 4.92 GB (5280888779 bytes)
Sync Engine Initialised with new Onedrive API instance
All application operations will be performed in the configured local 'sync_dir' directory: /mnt/samba/
Fetching /delta response from the OneDrive API for Drive ID: 66d53be8a5056eca
Processing API Response Bundle: 1 - Quantity of 'changes|items' in this bundle to process: 7
Processing API Response Bundle: 2 - Quantity of 'changes|items' in this bundle to process: 1
Finished processing /delta JSON response from the OneDrive API
Processing 5 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: ./changedfile.txt
This local file has a different modified time 2024-Jan-18 21:28:25Z when compared to remote modified time 2024-Jan-17 21:28:14Z
Local item has the same hash value as the item online - correcting the applicable file timestamp
The source of the incorrect timestamp was the local file - correcting timestamp locally due to --download-only
File timestamps are equal, no further action required
Performing a database consistency and integrity check on locally stored data ... 
Processing DB entries for this Drive ID: 66d53be8a5056eca
Processing /mnt/samba
The directory has not changed
Processing Target_Folder
The directory has not changed
Processing Target_Folder/dummy_doc.docx
The file has not changed
Processing Source_Folder
The directory has not changed
Processing newfile.txt
The file has not changed

Sync with Microsoft OneDrive is complete

File post run with corrected timestamp

[alex@onedrive-client-dev samba]$ stat changedfile.txt 
  File: changedfile.txt
  Size: 41              Blocks: 2048       IO Block: 1048576 regular file
Device: 32h/50d Inode: 141         Links: 1
Access: (0775/-rwxrwxr-x)  Uid: (    0/    root)   Gid: (   10/   wheel)
Context: system_u:object_r:cifs_t:s0
Access: 2024-01-18 08:28:14.000000000 +1100
Modify: 2024-01-18 08:28:14.000000000 +1100
Change: 2024-01-18 08:28:14.000000000 +1100
 Birth: 2024-01-19 08:25:27.153251900 +1100
[alex@onedrive-client-dev samba]$ 

NFS Mounted Directory

NFS Mount

ip.redacted:/storage0/data-shares/testshare on /mnt/nfs type nfs4 (rw,relatime,vers=4.2,rsize=131072,wsize=131072,namlen=255,hard,proto=tcp,timeo=600,retrans=2,sec=sys,clientaddr=ip.redacted,local_lock=none,addr=ip.redacted)

Files before run

[alex@onedrive-client-dev nfs]$ ls -la
total 17
drwxrwxr-x. 4 root wheel   6 Jan 19 07:57 .
drwxr-xr-x. 4 root root   30 Jan 19 07:22 ..
-rw-------. 1 alex alex   41 Jan 18 08:28 changedfile.txt
-rw-------. 1 alex alex  153 Jan 18 18:27 newfile.txt
drwx------. 2 alex alex    2 Jan 17 09:44 Source_Folder
drwx------. 2 alex alex    3 Jan 19 07:57 Target_Folder
[alex@onedrive-client-dev nfs]$ stat changedfile.txt  
  File: changedfile.txt
  Size: 41              Blocks: 1          IO Block: 131072 regular file
Device: 35h/53d Inode: 12          Links: 1
Access: (0600/-rw-------)  Uid: ( 1000/    alex)   Gid: ( 1000/    alex)
Context: system_u:object_r:nfs_t:s0
Access: 2024-01-18 08:28:14.000000000 +1100
Modify: 2024-01-18 08:28:14.000000000 +1100
Change: 2024-01-19 07:58:41.315277367 +1100
 Birth: -
[alex@onedrive-client-dev nfs]$ touch changedfile.txt 
[alex@onedrive-client-dev nfs]$ stat changedfile.txt  
  File: changedfile.txt
  Size: 41              Blocks: 1          IO Block: 131072 regular file
Device: 35h/53d Inode: 12          Links: 1
Access: (0600/-rw-------)  Uid: ( 1000/    alex)   Gid: ( 1000/    alex)
Context: system_u:object_r:nfs_t:s0
Access: 2024-01-19 07:59:09.825264738 +1100
Modify: 2024-01-19 07:59:09.825264738 +1100
Change: 2024-01-19 07:59:09.825264738 +1100
 Birth: -

Application Run:

Using the following path to store the runtime application log: /home/alex
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-36-gcda8317
Account Type:         personal
Default Drive ID:     66d53be8a5056eca
Default Root ID:      66D53BE8A5056ECA!101
Remaining Free Space: 4.92 GB (5280888779 bytes)
Sync Engine Initialised with new Onedrive API instance
All application operations will be performed in the configured local 'sync_dir' directory: /mnt/nfs/
Fetching /delta response from the OneDrive API for Drive ID: 66d53be8a5056eca
Processing API Response Bundle: 1 - Quantity of 'changes|items' in this bundle to process: 7
Processing API Response Bundle: 2 - Quantity of 'changes|items' in this bundle to process: 1
Finished processing /delta JSON response from the OneDrive API
Processing 5 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: ./changedfile.txt
This local file has a different modified time 2024-Jan-18 20:59:09Z when compared to remote modified time 2024-Jan-17 21:28:14Z
Local item has the same hash value as the item online - correcting the applicable file timestamp
The source of the incorrect timestamp was the local file - correcting timestamp locally due to --download-only
File timestamps are equal, no further action required
Performing a database consistency and integrity check on locally stored data ... 
Processing DB entries for this Drive ID: 66d53be8a5056eca
Processing /mnt/nfs
The directory has not changed
Processing Target_Folder
The directory has not changed
Processing Target_Folder/dummy_doc.docx
The file has not changed
Processing Source_Folder
The directory has not changed
Processing newfile.txt
The file has not changed

Sync with Microsoft OneDrive is complete

File post run with corrected timestamp

[alex@onedrive-client-dev nfs]$ stat changedfile.txt 
  File: changedfile.txt
  Size: 41              Blocks: 1          IO Block: 131072 regular file
Device: 35h/53d Inode: 12          Links: 1
Access: (0600/-rw-------)  Uid: ( 1000/    alex)   Gid: ( 1000/    alex)
Context: system_u:object_r:nfs_t:s0
Access: 2024-01-18 08:28:14.000000000 +1100
Modify: 2024-01-18 08:28:14.000000000 +1100
Change: 2024-01-19 07:59:24.154755779 +1100
 Birth: -
[alex@onedrive-client-dev nfs]$ 

In both instances, the application is resetting the file modified time to 2024-Jan-17 21:28:14Z (which is UTC time) and this is equivalent to 2024-Jan-18 08:28:14 as reflected by stat for the 'Modify' attribute.

If you still think you have an issue, then I would be looking at your Samba and/or Ubuntu platform for time sync issues and ensure that all your platforms are reporting the correct time. It must also be noted that you are also specifying to use version 2.1 of the SMB protocol for the connection for your SMB mount. You should be using something higher for this connection.

I cannot find or see any further problem here with the 'onedrive' application.

@abraunegg
Copy link
Owner

@robertschulze
Any update regarding this issue?

@robertschulze
Copy link
Author

robertschulze commented Jan 19, 2024

Strange, even with samba 3.1.1 I get the same result:

robert@atom:~/onedrive$ ./onedrive --confdir='/home/robert/.config/onedrive/accounts/robert@guitaronline.de' --sync --verbose --verbose --resync > debug_output.log 2>&1
y
robert@atom:~/onedrive$ stat /media/3/3\ -\ OneDrive/OneDrive_robert@guitaronline.de/OneDrive\ -\ Constanze/Datenbanken/TestWordfile.docx 
  File: /media/3/3 - OneDrive/OneDrive_robert@guitaronline.de/OneDrive - Constanze/Datenbanken/TestWordfile.docx
  Size: 10854           Blocks: 24         IO Block: 1048576 regular file
Device: 35h/53d Inode: 281474977224509  Links: 1
Access: (0777/-rwxrwxrwx)  Uid: ( 1000/  robert)   Gid: (  100/   users)
Access: 2023-12-15 00:25:28.000000000 +0100
Modify: 2023-12-15 00:25:28.000000000 +0100
Change: 2024-01-19 07:25:44.661052700 +0100
 Birth: 2024-01-19 07:25:42.755189200 +0100

Host platform for the Samba share is a Windows Server 2019, so actually nothing exotic.

How is onedrive setting the file Change date? Maybe I can reproduce a minimal example outside of onedrive to debug the issue more efficiently. Although setting this attribute appears to be quite difficult, cf. here or here. So not sure whether Modify date would be the better attribute.

@robertschulze
Copy link
Author

robertschulze commented Jan 19, 2024

@abraunegg I upgraded to -45 but now all my local files synced by a first --sync --resync run are deleted on a second --sync --resync run.

DEBUG: ------------------------------------------------------------------
DEBUG: Record is a Remote Object: Item("9ba6f07668ba1ff7", "9BA6F07668BA1FF7!22186", "OneDrive - Constanze", "", remote, "aOUJBNkYwNzY2OEJBMUZGNyEyMjE4Ni4zNw", "adDo5QkE2RjA3NjY4QkExRkY3ITIyMTg2LjYzODQwOTUzMDI2NTIzMDAwMA", 2024-Jan-14 22:00:39.74Z, "9BA6F07668BA1FF7!103", "", "", "f3028bd758552faf", "F3028BD758552FAF!4690", "Y", "")
DEBUG: Selecting Record that is NOT Remote Object: Item("f3028bd758552faf", "F3028BD758552FAF!4690", "OneDrive - Constanze", "", dir, "aRjMwMjhCRDc1ODU1MkZBRiE0NjkwLjQw", "adDpGMzAyOEJENzU4NTUyRkFGITQ2OTAuNjM4NDA5NDg1NzcxMjAwMDAw", 2024-Jan-14 22:00:39.74Z, "", "", "", "", "", "Y", "")
DEBUG: Checking file: ./OneDrive - Constanze/Datenbanken/TestWordfile.docx
DEBUG: skip_file evaluation for: /OneDrive - Constanze/Datenbanken/TestWordfile.docx
DEBUG: Evaluation against 'sync_list' for this path: OneDrive - Constanze/Datenbanken/TestWordfile.docx
DEBUG: [S]exclude           = false
DEBUG: [S]exludeDirectMatch = false
DEBUG: [S]excludeMatched    = false
DEBUG: Evaluation against 'sync_list' entry: OneDrive - Constanze/Datenbanken/*
DEBUG: Evaluation against 'sync_list' result: wildcard pattern match
DEBUG: Evaluation against 'sync_list' entry: Datenbanken/*
DEBUG: Evaluation against 'sync_list' result: wildcard pattern match
DEBUG: [F]exclude           = false
DEBUG: [F]exludeDirectMatch = false
DEBUG: [F]excludeMatched    = false
DEBUG: Evaluation against 'sync_list' final result: included for sync
DEBUG: Removing local file as --download-only & --cleanup-local-files configured
DEBUG: Removing local file: ./OneDrive - Constanze/Datenbanken/TestWordfile.docx
DEBUG: ------------------------------------------------------------------

Also, looking at the output of a --sync run following an initial --sync --resync, I am wondering which date from stat is actually used?
Because the supposed modified date of 23:36:17

DEBUG: Processing OneDrive - Constanze/Datenbanken/TestWordfile.docx
DEBUG: The local item has a different modified time 2024-Jan-19 23:36:17Z when compared to database modified time 2023-Dec-14 23:25:28Z
DEBUG: The last modified timestamp has changed however the file content has not changed
DEBUG: The local item has the same hash value as the item online - correcting local timestamp due to --download-only being used to ensure local file matches timestamp online
DEBUG: Calling setTimes() for this file: OneDrive - Constanze/Datenbanken/TestWordfile.docx

is not in the stat dates (even when shifted +1h)

robert@atom:~/onedrive$ stat /media/3/3\ -\ OneDrive/OneDrive_robert@guitaronline.de/OneDrive\ -\ Constanze/Datenbanken/TestWordfile.docx 
  File: /media/3/3 - OneDrive/OneDrive_robert@guitaronline.de/OneDrive - Constanze/Datenbanken/TestWordfile.docx
  Size: 10854           Blocks: 24         IO Block: 1048576 regular file
Device: 35h/53d Inode: 844424930645915  Links: 1
Access: (0777/-rwxrwxrwx)  Uid: ( 1000/  robert)   Gid: (  100/   users)
Access: 2023-12-15 00:25:28.000000000 +0100
Modify: 2023-12-15 00:25:28.000000000 +0100
Change: 2024-01-20 00:35:17.481378300 +0100
 Birth: 2024-01-20 00:35:16.215843900 +0100

nor does it appear further up the logfile

[...]
DEBUG: ------------------------------------------------------------------
DEBUG: Processing OneDrive Item 85 of 85 from API Response Bundle 0
DEBUG: Raw JSON OneDrive Item: {"@microsoft.graph.downloadUrl":"https:\/\/xqxz3a.dm.files.1drv.com\/y4mer4rRjh8OI0NarIGezwlY7uR_CUU3bUOvZc6HPCPGaVaeE7q6xNE3dpmviepWsACpTaOYgA4JM1-JHiYxpYFNgk3oyc2O61br5UDWR7jwe64PAeZ_f7PBaqJS9nHFtowqhQ1BTJLs2j8z7S_RyY3HIAhMrb55SYesAHVrSLlONg5YTb-KU56cs5hzE13bK0jBAyiVZv8aGHfCOzj7AT2hg","cTag":"aYzpGMzAyOEJENzU4NTUyRkFGITQ3MTYuNjQ4","createdBy":{"user":{"displayName":"Robert Schulze","id":"9ba6f07668ba1ff7"}},"createdDateTime":"2023-12-14T23:25:09.13Z","eTag":"aRjMwMjhCRDc1ODU1MkZBRiE0NzE2LjI5","file":{"hashes":{"quickXorHash":"JQvK\/I1JNHwmd8\/DP8oyU5RZpgY=","sha1Hash":"5F1E5B86CFA3B92BC81E7E7234C3FC0A4E298748","sha256Hash":"AE37561FAB7728D809BA558CD78749AFF85BC590C793C4D1A2D3CAF2B2D3A039"},"mimeType":"application\/vnd.openxmlformats-officedocument.wordprocessingml.document"},"fileSystemInfo":{"createdDateTime":"2023-12-14T23:25:09.13Z","lastModifiedDateTime":"2023-12-14T23:25:28Z"},"id":"F3028BD758552FAF!4716","lastModifiedBy":{"application":{"displayName":"MSOffice15","id":"480728c5"},"device":{"id":"18c008d090d4e4"},"oneDriveSync":{"@odata.type":"#microsoft.graph.identity","id":"a03cce43-2015-4db3-b0c8-ffff66090000"},"user":{"displayName":"Robert Schulze","id":"9ba6f07668ba1ff7"}},"lastModifiedDateTime":"2024-01-15T19:10:15.75Z","name":"TestWordfile.docx","parentReference":{"driveId":"f3028bd758552faf","driveType":"personal","id":"F3028BD758552FAF!569","name":"Datenbanken","path":"\/drives\/f3028bd758552faf\/items\/F3028BD758552FAF!4690:\/Datenbanken"},"reactions":{"commentCount":0},"shared":{"owner":{"user":{"displayName":"Constanze Schulze","id":"f3028bd758552faf"}},"scope":"users"},"size":10854,"webUrl":"https:\/\/1drv.ms\/w\/s!AK8vVVjXiwLzpGw"}
DEBUG: This item is not a OneDrive deletion change
DEBUG: defaultRootId                                        = 9BA6F07668BA1FF7!103
DEBUG: 'search id'                                          = F3028BD758552FAF!4716
DEBUG: id == defaultRootId                                  = false
DEBUG: isItemRoot(onedriveJSONItem)                         = false
DEBUG: onedriveJSONItem['name'].str == 'root'               = false
DEBUG: itemHasParentReferenceId                             = true
DEBUG: Adding this Raw JSON OneDrive Item to jsonItemsToProcess array for further processing
DEBUG: ------------------------------------------------------------------
[...]
DEBUG: ------------------------------------------------------------------
DEBUG: Processing OneDrive JSON item 83 of 83 as part of JSON Item Batch 1 of 1
DEBUG: Raw JSON OneDrive Item: {"@microsoft.graph.downloadUrl":"https:\/\/xqxz3a.dm.files.1drv.com\/y4mer4rRjh8OI0NarIGezwlY7uR_CUU3bUOvZc6HPCPGaVaeE7q6xNE3dpmviepWsACpTaOYgA4JM1-JHiYxpYFNgk3oyc2O61br5UDWR7jwe64PAeZ_f7PBaqJS9nHFtowqhQ1BTJLs2j8z7S_RyY3HIAhMrb55SYesAHVrSLlONg5YTb-KU56cs5hzE13bK0jBAyiVZv8aGHfCOzj7AT2hg","cTag":"aYzpGMzAyOEJENzU4NTUyRkFGITQ3MTYuNjQ4","createdBy":{"user":{"displayName":"Robert Schulze","id":"9ba6f07668ba1ff7"}},"createdDateTime":"2023-12-14T23:25:09.13Z","eTag":"aRjMwMjhCRDc1ODU1MkZBRiE0NzE2LjI5","file":{"hashes":{"quickXorHash":"JQvK\/I1JNHwmd8\/DP8oyU5RZpgY=","sha1Hash":"5F1E5B86CFA3B92BC81E7E7234C3FC0A4E298748","sha256Hash":"AE37561FAB7728D809BA558CD78749AFF85BC590C793C4D1A2D3CAF2B2D3A039"},"mimeType":"application\/vnd.openxmlformats-officedocument.wordprocessingml.document"},"fileSystemInfo":{"createdDateTime":"2023-12-14T23:25:09.13Z","lastModifiedDateTime":"2023-12-14T23:25:28Z"},"id":"F3028BD758552FAF!4716","lastModifiedBy":{"application":{"displayName":"MSOffice15","id":"480728c5"},"device":{"id":"18c008d090d4e4"},"oneDriveSync":{"@odata.type":"#microsoft.graph.identity","id":"a03cce43-2015-4db3-b0c8-ffff66090000"},"user":{"displayName":"Robert Schulze","id":"9ba6f07668ba1ff7"}},"lastModifiedDateTime":"2024-01-15T19:10:15.75Z","name":"TestWordfile.docx","parentReference":{"driveId":"f3028bd758552faf","driveType":"personal","id":"F3028BD758552FAF!569","name":"Datenbanken","path":"\/drives\/f3028bd758552faf\/items\/F3028BD758552FAF!4690:\/Datenbanken"},"reactions":{"commentCount":0},"shared":{"owner":{"user":{"displayName":"Constanze Schulze","id":"f3028bd758552faf"}},"scope":"users"},"size":10854,"webUrl":"https:\/\/1drv.ms\/w\/s!AK8vVVjXiwLzpGw"}
DEBUG: Attempting to calculate local filesystem path for f3028bd758552faf and F3028BD758552FAF!569
DEBUG: New Item calculated full path is: OneDrive - Constanze/Datenbanken/TestWordfile.docx
DEBUG: The item we are syncing is a file
DEBUG: skip_file item to check: /OneDrive - Constanze/Datenbanken/TestWordfile.docx
DEBUG: skip_file evaluation for: /OneDrive - Constanze/Datenbanken/TestWordfile.docx
DEBUG: Result: false
DEBUG: sync_list item to check: OneDrive - Constanze/Datenbanken/TestWordfile.docx
DEBUG: Evaluation against 'sync_list' for this path: OneDrive - Constanze/Datenbanken/TestWordfile.docx
DEBUG: [S]exclude           = false
DEBUG: [S]exludeDirectMatch = false
DEBUG: [S]excludeMatched    = false
DEBUG: Evaluation against 'sync_list' entry: OneDrive - Constanze/Datenbanken/*
DEBUG: Evaluation against 'sync_list' result: wildcard pattern match
DEBUG: Evaluation against 'sync_list' entry: Datenbanken/*
DEBUG: Evaluation against 'sync_list' result: wildcard pattern match
DEBUG: [F]exclude           = false
DEBUG: [F]exludeDirectMatch = false
DEBUG: [F]excludeMatched    = false
DEBUG: Evaluation against 'sync_list' final result: included for sync
DEBUG: Flagging object as a file
DEBUG: OneDrive change is an update to an existing local item
DEBUG: Attempting to calculate local filesystem path for f3028bd758552faf and F3028BD758552FAF!569
DEBUG: Adding changed OneDrive Item to database: Item("f3028bd758552faf", "F3028BD758552FAF!4716", "TestWordfile.docx", "", file, "aRjMwMjhCRDc1ODU1MkZBRiE0NzE2LjI5", "aYzpGMzAyOEJENzU4NTUyRkFGITQ3MTYuNjQ4", 2023-Dec-14 23:25:28Z, "F3028BD758552FAF!569", "JQvK/I1JNHwmd8/DP8oyU5RZpgY=", "", "", "", "Y", "10854")
DEBUG: ------------------------------------------------------------------

@abraunegg
Copy link
Owner

@robertschulze
All times, expressed by the application at runtime are in UTC:

The local item has a different modified time 2024-Jan-19 23:36:17Z when compared to database modified time 2023-Dec-14 23:25:28Z

You need to convert 2024-Jan-19 23:36:17Z and 2023-Dec-14 23:25:28Z to your local timezone to understand what date and time is being presented.

I am wondering which date from stat is actually used?

The application does not use stat to equate any timestamp. I am using that to illustrate to you the timestamp of the files. These values are your local timezone actual timestamps:

Access: 2023-12-15 00:25:28.000000000 +0100
Modify: 2023-12-15 00:25:28.000000000 +0100
Change: 2024-01-20 00:35:17.481378300 +0100
 Birth: 2024-01-20 00:35:16.215843900 +0100

The client, when performing any timestamp comparison is only looking at the Modify: value - all others from stat can be ignored.

I upgraded to -45 but now all my local files synced by a first --sync --resync run are deleted on a second --sync --resync run.

If you were running this client version your output would also be different - as the log output specifies that the comparison timestamps are in UTC ... so you are not running that client version in your debug logs.

Consider this 'newfile.txt' that I just created locally:

  File: newfile.txt
  Size: 41              Blocks: 8          IO Block: 4096   regular file
Device: 811h/2065d      Inode: 134301271   Links: 1
Access: (0664/-rw-rw-r--)  Uid: ( 1000/    alex)   Gid: ( 1000/    alex)
Context: unconfined_u:object_r:user_home_t:s0
Access: 2024-01-20 11:33:54.992857361 +1100
Modify: 2024-01-20 11:33:54.992857361 +1100
Change: 2024-01-20 11:33:54.992857361 +1100
 Birth: 2024-01-20 11:33:54.992857361 +1100

The Modify: 2024-01-20 11:33:54.992857361 +1100 is the line the application will care about.

The initial upload JSON to OneDrive, as responded by the API

{"@microsoft.graph.downloadUrl":"https:\/\/z5hbwg.bn.files.1drv.com\/y4pxVrkU8fF2XaryA9nx6wOT6okjP0G58IXUNghN7qTgcAhaY-YH_IMON8GqcGGr1_zTY9gwPR0wI4xc-vN1a2VPDSw2MqzhQzoBIl7k8rIXVhSgkQzh55kJztRt7haKfBNQDS63HSZwHYmv_yZUZA0wucqdnziVM85u8qqLySdbfHawE1NMEkyjHcKvZ6a6PQJ692B0-5RoX730XtP4-vaPdhYTK_oMUmPA8nrttOTbizqM-NyBV5-evwP0PxrreVJ","@odata.context":"https:\/\/graph.microsoft.com\/v1.0\/$metadata#drives('66d53be8a5056eca')\/items\/$entity","cTag":"aYzo2NkQ1M0JFOEE1MDU2RUNBITM5MTMzOS4yNTc","createdBy":{"application":{"displayName":"OneDrive Client for Linux","id":"4035b959"},"user":{"displayName":"SADF ASDF","id":"66d53be8a5056eca"}},"createdDateTime":"2024-01-20T00:35:16.617Z","eTag":"aNjZENTNCRThBNTA1NkVDQSEzOTEzMzkuMQ","file":{"hashes":{"quickXorHash":"mQSjja6RSTDa6BqZLaONxQlKKRY=","sha1Hash":"A849705F2D9B34B28C64CE709631EBC74E1F72F4","sha256Hash":"481EFA8D4646887D5A4AC76C9963B2853500449FDD7EEF8B492CA602258D63D2"},"mimeType":"text\/plain"},"fileSystemInfo":{"createdDateTime":"2024-01-20T00:35:16.616Z","lastModifiedDateTime":"2024-01-20T00:33:54Z"},"id":"66D53BE8A5056ECA!391339","lastModifiedBy":{"application":{"displayName":"OneDrive Client for Linux","id":"4035b959"},"user":{"displayName":"SADF ASDF","id":"66d53be8a5056eca"}},"lastModifiedDateTime":"2024-01-20T00:35:17.123Z","name":"newfile.txt","parentReference":{"driveId":"66d53be8a5056eca","driveType":"personal","id":"66D53BE8A5056ECA!101","path":"\/drive\/root:"},"reactions":{"commentCount":0},"size":41,"webUrl":"https:\/\/1drv.ms\/t\/s!AMpuBaXoO9Vml_Er"}

The critical filesystem info aspects:

image

"fileSystemInfo": {
		"createdDateTime": "2024-01-20T00:35:16.616Z",  <-- = 2024-01-20T11:35:16.616 AEDT
		"lastModifiedDateTime": "2024-01-20T00:33:54Z"  <-- = 2024-01-20T11:33:54 AEDT 
	},

The createdDateTime is the time when the file was created online.

The lastModifiedDateTime is the time when the file was modified, and matches, based on the details provided by stat

Now, if I delete 'newfile.txt' locally, the only reference of this file exists online.

If I now run ./onedrive -s -v --resync --resync-auth --download-only the file, from online will be downloaded from the online item:

....
Processing API Response Bundle: 129 - Quantity of 'changes|items' in this bundle to process: 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
Number of items to download from OneDrive: 1
Downloading file ./newfile.txt ... done
Performing a database consistency and integrity check on locally stored data ... 
Processing DB entries for this Drive ID: 66d53be8a5056eca
Processing ~/OneDrive
The directory has not changed
Processing newfile.txt
The file has not changed

Sync with Microsoft OneDrive is complete

When stat is used to look at this new file as downloaded from OneDrive:

[alex@onedrive-client-dev OneDrive]$ rm newfile.txt 
[alex@onedrive-client-dev OneDrive]$ stat newfile.txt 
  File: newfile.txt
  Size: 41              Blocks: 8          IO Block: 4096   regular file
Device: 811h/2065d      Inode: 134301270   Links: 1
Access: (0600/-rw-------)  Uid: ( 1000/    alex)   Gid: ( 1000/    alex)
Context: unconfined_u:object_r:user_home_t:s0
Access: 2024-01-20 11:46:47.217487973 +1100
Modify: 2024-01-20 11:33:54.000000000 +1100
Change: 2024-01-20 11:46:47.215487930 +1100
 Birth: 2024-01-20 11:46:46.086463617 +1100

The 'birth' and 'change' of the file is from the local filesystem as to when the file was created on the local filesystem.

The 'modify' item (the one we care about) matches the 'fileSystemInfo' lastModifiedDateTime value.

If I touch and stat the 'newfile.txt' I get the following values:

[alex@onedrive-client-dev OneDrive]$ touch newfile.txt; stat newfile.txt; date;
  File: newfile.txt
  Size: 41              Blocks: 8          IO Block: 4096   regular file
Device: 811h/2065d      Inode: 134301270   Links: 1
Access: (0600/-rw-------)  Uid: ( 1000/    alex)   Gid: ( 1000/    alex)
Context: unconfined_u:object_r:user_home_t:s0
Access: 2024-01-20 11:50:25.818334727 +1100
Modify: 2024-01-20 11:50:25.818334727 +1100
Change: 2024-01-20 11:50:25.818334727 +1100
 Birth: 2024-01-20 11:46:46.086463617 +1100
Sat Jan 20 11:50:25 AEDT 2024
[alex@onedrive-client-dev OneDrive]$ 

If I run the command ./onedrive -s -v --resync --resync-auth --download-only again, the expectation is that the Modify: 2024-01-20 11:50:25.818334727 +1100 value will be updated to that as provided by the file online:

Processing API Response Bundle: 129 - Quantity of 'changes|items' in this bundle to process: 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: ./newfile.txt
This local file has a different modified time 2024-Jan-20 00:50:25Z (UTC) when compared to remote modified time 2024-Jan-20 00:33:54Z (UTC)
Local item has the same hash value as the item online - correcting the applicable file timestamp
The source of the incorrect timestamp was the local file - correcting timestamp locally due to --download-only
File timestamps are equal, no further action required
Performing a database consistency and integrity check on locally stored data ... 
Processing DB entries for this Drive ID: 66d53be8a5056eca
Processing ~/OneDrive
The directory has not changed

Sync with Microsoft OneDrive is complete

and the relevant debug log lines (redoing the touch as well):

DEBUG: ------------------------------------------------------------------
DEBUG: Processing OneDrive JSON item 1 of 1 as part of JSON Item Batch 1 of 1
DEBUG: Raw JSON OneDrive Item: {"@microsoft.graph.downloadUrl":"https:\/\/public.bn.files.1drv.com\/y4mcX-XYgmdNpmDp6BXHAY8Vi04UOQl1iulDqxpHJJhEOdkCSIQqenVVDebCDTThaaRHAKq-Os0izX2IjoguWDHInTBlMYDJJNeHS2MOchF46v1JCapaHsKpNRdXj9DdxW-NaoNTw50yy3tFi1JILcDwdW2MNg1BZ8GrSCOlYeyuoUnQ1P_rsCcPmrME-icH6afjmwiwg5P9S47v0DWP1bGyLKPeqvRDTSwr8FkQrDA3vCrYO422le595ro9DQRlfq9","@odata.type":"#microsoft.graph.driveItem","cTag":"aYzo2NkQ1M0JFOEE1MDU2RUNBITM5MTMzOS4yNTc","createdBy":{"application":{"id":"4035b959"},"user":{"displayName":"SADF ASDF","id":"66d53be8a5056eca"}},"createdDateTime":"2024-01-20T00:35:16.617Z","eTag":"aNjZENTNCRThBNTA1NkVDQSEzOTEzMzkuMQ","file":{"hashes":{"quickXorHash":"mQSjja6RSTDa6BqZLaONxQlKKRY=","sha1Hash":"A849705F2D9B34B28C64CE709631EBC74E1F72F4","sha256Hash":"481EFA8D4646887D5A4AC76C9963B2853500449FDD7EEF8B492CA602258D63D2"},"mimeType":"text\/plain"},"fileSystemInfo":{"createdDateTime":"2024-01-20T00:35:16.616Z","lastModifiedDateTime":"2024-01-20T00:33:54Z"},"id":"66D53BE8A5056ECA!391339","lastModifiedBy":{"application":{"id":"4035b959"},"user":{"displayName":"SADF ASDF","id":"66d53be8a5056eca"}},"lastModifiedDateTime":"2024-01-20T00:35:17.123Z","name":"newfile.txt","parentReference":{"driveId":"66d53be8a5056eca","driveType":"personal","id":"66D53BE8A5056ECA!101","name":"root:","path":"\/drive\/root:"},"reactions":{"commentCount":0},"size":41,"webUrl":"https:\/\/1drv.ms\/t\/s!AMpuBaXoO9Vml_Er"}
DEBUG: Attempting to calculate local filesystem path for 66d53be8a5056eca and 66D53BE8A5056ECA!101
DEBUG: New Item calculated full path is: ./newfile.txt
DEBUG: The item we are syncing is a file
DEBUG: skip_file item to check: /./newfile.txt
DEBUG: skip_file evaluation for: /./newfile.txt
DEBUG: Result: false
DEBUG: sync_list item to check: ./newfile.txt
DEBUG: Evaluation against 'sync_list' for this path: newfile.txt
DEBUG: [S]exclude           = false
DEBUG: [S]exludeDirectMatch = false
DEBUG: [S]excludeMatched    = false
DEBUG: Evaluation against 'sync_list' entry: !/random_25k_files/*
DEBUG: Evaluation against 'sync_list' entry: /*
DEBUG: Evaluation against 'sync_list' result: wildcard pattern match
DEBUG: [F]exclude           = false
DEBUG: [F]exludeDirectMatch = false
DEBUG: [F]excludeMatched    = false
DEBUG: Evaluation against 'sync_list' final result: included for sync
DEBUG: Flagging object as a file
DEBUG: OneDrive change is potentially a new local item
DEBUG: Path on local disk already exists
DEBUG: Local file time discrepancy detected: ./newfile.txt
DEBUG: This local file has a different modified time 2024-Jan-20 00:54:26Z (UTC) when compared to remote modified time 2024-Jan-20 00:33:54Z (UTC)
DEBUG: Local item has the same hash value as the item online - correcting the applicable file timestamp
DEBUG: The source of the incorrect timestamp was the local file - correcting timestamp locally due to --download-only
DEBUG: Calling setTimes() for this file: ./newfile.txt
DEBUG: The item to sync exists locally but is potentially not in the local database - otherwise this would be handled as changed item
DEBUG: File timestamps are equal, no further action required
DEBUG: ------------------------------------------------------------------
[alex@onedrive-client-dev OneDrive]$ stat newfile.txt 
  File: newfile.txt
  Size: 41              Blocks: 8          IO Block: 4096   regular file
Device: 811h/2065d      Inode: 134301270   Links: 1
Access: (0600/-rw-------)  Uid: ( 1000/    alex)   Gid: ( 1000/    alex)
Context: unconfined_u:object_r:user_home_t:s0
Access: 2024-01-20 11:33:54.000000000 +1100
Modify: 2024-01-20 11:33:54.000000000 +1100
Change: 2024-01-20 11:56:33.115296772 +1100
 Birth: 2024-01-20 11:46:46.086463617 +1100
[alex@onedrive-client-dev OneDrive]$ 

This proves the 'modify' timestamp of the file in question is being updated to the correct value from online data.

but now all my local files synced by a first --sync --resync run are deleted on a second --sync --resync run.

I do not see this in your log output, nor can I replicate this ... please double check what is going on as I suspect you are being caught up with something else going on a the same time.

@robertschulze
Copy link
Author

robertschulze commented Jan 20, 2024

I upgraded to -45 but now all my local files synced by a first --sync --resync run are deleted on a second --sync --resync run.

If you were running this client version your output would also be different - as the log output specifies that the comparison timestamps are in UTC ... so you are not running that client version in your debug logs.
Strange, I recompiled from Git

rm -rf onedrive
git clone https://github.com/abraunegg/onedrive.git
cd onedrive/
git fetch origin pull/2584/head:pr2584
git checkout pr2584
source ~/dlang/dmd-2.106.0/activate
./configure; make clean; make;
./onedrive --confdir='/home/robert/.config/onedrive/accounts/robert@guitaronline.de' --sync --verbose --verbose --resync > debug_output.log 2>&1

and

robert@atom:~/onedrive$ ./onedrive --version
v2.5.0-alpha-5 GitHub version: v2.4.25-45-gc8d29c8

and the log file claims

DEBUG: Application Version: v2.5.0-alpha-5 GitHub version: v2.4.25-45-gc8d29c8

What could I have done wrong? Maybe it's the wrong PR?

@abraunegg
Copy link
Owner

@robertschulze
Thats the right version, but your logs and output dont match that running version.

Maybe you have an installed older version somewhere and did not use the PR version?

@robertschulze
Copy link
Author

robertschulze commented Jan 20, 2024

@abraunegg
Just checked my .bash_history but it appears I always used the locally compiled onedrive

cat ~/.bash_history | grep accounts
./onedrive --confdir='/home/robert/.config/onedrive/accounts/robert@guitaronline.de' --synchronize --verbose --verbose --resync > debug_output.log 2>&1
./onedrive --confdir='/home/robert/.config/onedrive/accounts/robert@guitaronline.de' --sync --verbose --verbose --resync > debug_output.log 2>&1
./onedrive --confdir='/home/robert/.config/onedrive/accounts/robert@guitaronline.de' --sync --verbose --verbose > debug_output.log 2>&1
./onedrive --confdir='/home/robert/.config/onedrive/accounts/robert@guitaronline.de' --sync --verbose --verbose --resync > debug_output.log 2>&1
./onedrive --confdir='/home/robert/.config/onedrive/accounts/robert@guitaronline.de' --sync --verbose --verbose > debug_output.log 2>&1
./onedrive --confdir='/home/robert/.config/onedrive/accounts/robert@guitaronline.de' --sync --verbose --verbose --resync > debug_output.log 2>&1
./onedrive --confdir='/home/robert/.config/onedrive/accounts/robert@guitaronline.de' --sync --verbose --verbose --resync > debug_output.log 2>&1
./onedrive --confdir='/home/robert/.config/onedrive/accounts/robert@guitaronline.de' --sync --verbose --verbose --resync > debug_output.log 2>&1
./onedrive --confdir='/home/robert/.config/onedrive/accounts/robert@guitaronline.de' --sync --verbose --verbose > debug_output.log 2>&1
./onedrive --confdir='/home/robert/.config/onedrive/accounts/robert@guitaronline.de' --sync --verbose --verbose --resync > debug_output.log 2>&1
./onedrive --confdir='/home/robert/.config/onedrive/accounts/robert@guitaronline.de' --sync --verbose --verbose --resync > debug_output.log 2>&1
./onedrive --confdir='/home/robert/.config/onedrive/accounts/robert@guitaronline.de' --sync --verbose --verbose --resync > debug_output.log 2>&1
./onedrive --confdir='/home/robert/.config/onedrive/accounts/robert@guitaronline.de' --sync --verbose --verbose --resync > debug_output.log 2>&1
./onedrive --confdir='/home/robert/.config/onedrive/accounts/robert@guitaronline.de' --sync --verbose --verbose > debug_output.log 2>&1

Just to be sure, I sent two log files via wetransfer, maybe this helps to clarify?

Edited: I just also deleted my locally installed onedrive from Ubuntu and re-executed the steps, however, the behaviour stays the same and log files are identical up to crypto and (run)time strings.

@abraunegg
Copy link
Owner

@robertschulze

I just also deleted my locally installed onedrive from Ubuntu and re-executed the steps, however, the behaviour stays the same and log files are identical up to crypto and (run)time strings.

In your second logfile there is this entry:

DEBUG: WARNING: Application has been configured to cleanup local files that are not present online.
DEBUG: WARNING: Local data loss MAY occur in this scenario if you are expecting data to remain archived locally.

This means you must be setting --cleanup-local-files somewhere - if not via CLI, via 'config' file by using:

cleanup_local_files = "true"

This is why files are being deleted:

DEBUG: Removing local file as --download-only & --cleanup-local-files configured
DEBUG: Removing local file: ./OneDrive - Constanze/Datenbanken/20190815 - contacts.csv

So for all intents and purposes - at this stage, the application is operating 100% correct based on your application configuration .. however as the 'file' is technically in a shared folder, it should be also 'found', but the logs are indicating otherwise. I will run some further testing tomorrow, to ensure some other logic is correct surrounding this.

However, as this issue is now 100% different from your original problem, I am closing this issue (dates being changed online) as it is resolved.

@abraunegg
Copy link
Owner

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

Repository owner locked as resolved and limited conversation to collaborators Jan 28, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Bug Something isn't working Fixed
Projects
None yet
Development

No branches or pull requests

2 participants