abraunegg / onedrive

OneDrive Client for Linux
https://abraunegg.github.io
GNU General Public License v3.0
10.22k stars 867 forks source link

Bug: download error of an updated file leads to file deletion in onedrive and synced devices #3015

Closed Nijco closed 4 days ago

Nijco commented 5 days ago

Describe the bug

First of all: Abraunegg, thank you so much for this awesome project!

Now to my Issue: I changed a text file on one of my devices, synced that change to onedrive. When I started onedrive on my other device, the download of that updated file failed. That seemingly caused the file to be deleted locally on that device, and this was later propagated to onedrive and my other devices.

Here is the relevant log of the device where the download failed, the relevant file is 'Edumedia/hsh/greenit/notes.md', seemingly especially relevant lines marked with '**':

2024-11-26 19:57:24,682 [onedrivegui:3057][fn=save_global_config][INFO] - All configs saved
2024-11-26 19:57:24,682 [onedrivegui:3058][fn=save_global_config][DEBUG] - {'nico': {'config_file': '/home/nijco/.config/onedrive/accounts/nico/config', 'auto_sync': 'False', 'account_type': 'Personal', 'free_space': '76.0GiB', 'onedrive': {'sync_dir': '"~/OneDrive_nico"', 'monitor_interval': '"300"', 'log_dir': '"/var/log/onedrive/"', 'drive_id': '""', 'upload_only': '"false"', 'check_nomount': '"false"', 'check_nosync': '"false"', 'download_only': '"false"', 'disable_notifications': '"false"', 'disable_upload_validation': '"false"', 'enable_logging': '"false"', '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_business_shared_items': '"false"', '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"', 'disable_download_validation': '"false"', 'connect_timeout': '"30"', 'data_timeout': '"240"', 'display_running_config': '"false"', 'ip_protocol_version': '"1"', 'threads': '"8"', 'skip_file': '"~*|.~*|*.tmp"', 'skip_dir': '""'}}}
2024-11-26 19:57:24,682 [onedrivegui:2022][fn=read_stdout][INFO] - [nico] Sync Engine Initialised with new Onedrive API instance
2024-11-26 19:57:24,682 [onedrivegui:2022][fn=read_stdout][INFO] - [nico] All application operations will be performed in the configured local 'sync_dir' directory: /home/nijco/OneDrive_nico
2024-11-26 19:57:24,682 [onedrivegui:2022][fn=read_stdout][INFO] - [nico] OneDrive synchronisation interval (seconds): 300
2024-11-26 19:57:24,682 [onedrivegui:2022][fn=read_stdout][INFO] - [nico] Maximum allowed open files:                  9223372036854775807
2024-11-26 19:57:24,682 [onedrivegui:2022][fn=read_stdout][INFO] - [nico] Maximum allowed inotify user watches:        524288
2024-11-26 19:57:24,689 [onedrivegui:2022][fn=read_stdout][INFO] - [nico] Initialising filesystem inotify monitoring ...
2024-11-26 19:57:24,689 [onedrivegui:2022][fn=read_stdout][INFO] - [nico] Monitoring directory: .
2024-11-26 19:57:24,710 [onedrivegui:2022][fn=read_stdout][INFO] - [nico] Monitoring directory: ./media
2024-11-26 19:57:24,718 [onedrivegui:2022][fn=read_stdout][INFO] - [nico] Monitoring directory: ./media/mark_uwe
[many many more Monitoring directoy infos; including the relevant directory:]
2024-11-26 19:57:26,991 [onedrivegui:2022][fn=read_stdout][INFO] - [nico] Monitoring directory: ./Edumedia/hsh/greenit
[many more msg of kind Monitoring directory; then:]
2024-11-26 19:57:27,806 [onedrivegui:2022][fn=read_stdout][INFO] - [nico] Performing initial synchronisation to ensure consistent local state ...
2024-11-26 19:57:27,806 [onedrivegui:2022][fn=read_stdout][INFO] - [nico] Attempting to contact Microsoft OneDrive Login Service
2024-11-26 19:57:28,458 [onedrivegui:2022][fn=read_stdout][INFO] - [nico] Successfully reached Microsoft OneDrive Login Service
2024-11-26 19:57:28,460 [onedrivegui:2022][fn=read_stdout][INFO] - [nico] Starting a sync with Microsoft OneDrive
2024-11-26 19:57:28,799 [onedrivegui:2022][fn=read_stdout][INFO] - [nico] Fetching /delta response from the OneDrive API for Drive ID: [*censored*]
2024-11-26 19:57:29,153 [onedrivegui:2022][fn=read_stdout][INFO] - [nico] Processing API Response Bundle: 1 - Quantity of 'changes|items' in this bundle to process: 11
2024-11-26 19:57:29,177 [onedrivegui:2022][fn=read_stdout][INFO] - [nico] Finished processing /delta JSON response from the OneDrive API
2024-11-26 19:57:29,178 [onedrivegui:2022][fn=read_stdout][INFO] - [nico] Processing 10 applicable changes and items received from Microsoft OneDrive
2024-11-26 19:57:29,178 [onedrivegui:2022][fn=read_stdout][INFO] - [nico] Processing OneDrive JSON item batch [1/1] to ensure consistent local state
2024-11-26 19:57:29,251 [onedrivegui:2022][fn=read_stdout][INFO] - [nico] Number of items to download from Microsoft OneDrive: 1
** 2024-11-26 19:57:29,862 [onedrivegui:2022][fn=read_stdout][INFO] - [nico] ERROR: Microsoft OneDrive API returned an error with the following message: **
2024-11-26 19:57:29,862 [onedrivegui:2022][fn=read_stdout][INFO] - [nico] Error Message:    HTTP request returned status code 401 (Unauthorized)
2024-11-26 19:57:29,862 [onedrivegui:2022][fn=read_stdout][INFO] - [nico] Calling Function: downloadFileItem()
** 2024-11-26 19:57:29,874 [onedrivegui:2022][fn=read_stdout][INFO] - [nico] ERROR: File failed to download. Increase logging verbosity to determine why.
** 2024-11-26 19:57:29,874 [onedrivegui:2022][fn=read_stdout][INFO] - [nico] Downloading file: Edumedia/hsh/greenit/notes.md ... failed!
** 2024-11-26 19:57:29,875 [onedrivegui:2116][fn=read_stdout][INFO] - {'file_operation': 'Downloading', 'file_path': 'Edumedia/hsh/greenit/notes.md', 'progress': '0', 'transfer_complete': False}
2024-11-26 19:57:29,875 [onedrivegui:2628][fn=event_update_progress][INFO] - {'file_operation': 'Downloading', 'file_path': 'Edumedia/hsh/greenit/notes.md', 'progress': '0', 'transfer_complete': False}
2024-11-26 19:57:29,876 [onedrivegui:2696][fn=event_update_progress][INFO] - Adding new list item for file notes.md
2024-11-26 19:57:31,032 [onedrivegui:2022][fn=read_stdout][INFO] - [nico] Performing a database consistency and integrity check on locally stored data
2024-11-26 19:57:31,081 [onedrivegui:2022][fn=read_stdout][INFO] - [nico] Processing DB entries for this Drive ID: [*censored*]
2024-11-26 19:57:31,447 [onedrivegui:2022][fn=read_stdout][INFO] - [nico] Processing: ~/OneDrive_nico
2024-11-26 19:57:31,447 [onedrivegui:2022][fn=read_stdout][INFO] - [nico] The directory has not changed
[Many more Processing of directory with no changes]
2024-11-26 19:57:59,572 [onedrivegui:2022][fn=read_stdout][INFO] - [nico] Processing: Edumedia/hsh/greenit
2024-11-26 19:57:59,572 [onedrivegui:2022][fn=read_stdout][INFO] - [nico] The directory has not changed
[Some more files in that dir not changed; and then]
** 2024-11-26 19:57:59,654 [onedrivegui:2022][fn=read_stdout][INFO] - [nico] Processing: Edumedia/hsh/greenit/notes.md
** 2024-11-26 19:57:59,654 [onedrivegui:2022][fn=read_stdout][INFO] - [nico] The file has been deleted locally
[This was the only file found to be changed; after it was done with checking for changes:]
** 2024-11-26 19:58:35,368 [onedrivegui:2022][fn=read_stdout][INFO] - [nico] Deleted local items to delete on Microsoft OneDrive: 1
2024-11-26 19:58:35,368 [onedrivegui:2022][fn=read_stdout][INFO] - [nico] Deleting item from Microsoft OneDrive: Edumedia/hsh/greenit/notes.md
2024-11-26 19:58:35,368 [onedrivegui:2116][fn=read_stdout][INFO] - {'file_operation': 'Deleting', 'file_path': 'Edumedia/hsh/greenit/notes.md', 'progress': '0', 'transfer_complete': True}
2024-11-26 19:58:35,368 [onedrivegui:2628][fn=event_update_progress][INFO] - {'file_operation': 'Deleting', 'file_path': 'Edumedia/hsh/greenit/notes.md', 'progress': '0', 'transfer_complete': True}
2024-11-26 19:58:35,369 [onedrivegui:2659][fn=event_update_progress][INFO] - Updating list item
2024-11-26 19:58:35,369 [onedrivegui:2692][fn=event_update_progress][INFO] - List item updated for file notes.md
2024-11-26 19:58:35,591 [onedrivegui:2022][fn=read_stdout][INFO] - [nico] Scanning the local file system '~/OneDrive_nico' for new data to upload
2024-11-26 19:58:35,887 [onedrivegui:2022][fn=read_stdout][INFO] - [nico] Skipping file - excluded by skip_dir config: ./Edumedia/fhac/[*some file*]
[*a few skipped files*]
2024-11-26 19:58:36,692 [onedrivegui:2022][fn=read_stdout][INFO] - [nico] New items to upload to Microsoft OneDrive: 1
2024-11-26 19:58:36,692 [onedrivegui:2022][fn=read_stdout][INFO] - [nico] Total New Data to Upload:        436 MB
2024-11-26 19:58:36,970 [onedrivegui:2022][fn=read_stdout][INFO] - [nico] The file we are attempting to upload as a new file already exists on Microsoft OneDrive: ./media/eprix_b_r1.zip.partial
2024-11-26 19:58:42,155 [onedrivegui:2022][fn=read_stdout][INFO] - [nico] Performing a last examination of the most recent online data within Microsoft OneDrive to complete the reconciliation process
2024-11-26 19:58:42,155 [onedrivegui:2022][fn=read_stdout][INFO] - [nico] Fetching /delta response from the OneDrive API for Drive ID: [*censored*]
2024-11-26 19:58:45,519 [onedrivegui:2022][fn=read_stdout][INFO] - [nico] Processing API Response Bundle: 1 - Quantity of 'changes|items' in this bundle to process: 2
2024-11-26 19:58:45,521 [onedrivegui:2022][fn=read_stdout][INFO] - [nico] Finished processing /delta JSON response from the OneDrive API
2024-11-26 19:58:45,522 [onedrivegui:2022][fn=read_stdout][INFO] - [nico] No changes or items that can be applied were discovered while processing the data received from Microsoft OneDrive
2024-11-26 19:58:45,568 [onedrivegui:2022][fn=read_stdout][INFO] - [nico] Failed items to download to/from Microsoft OneDrive: 1
** 2024-11-26 19:58:45,568 [onedrivegui:2022][fn=read_stdout][INFO] - [nico] Failed to download: Edumedia/hsh/greenit/notes.md
2024-11-26 19:58:45,569 [onedrivegui:2022][fn=read_stdout][INFO] - [nico] Sync with Microsoft OneDrive has completed, however there are items that failed to sync.
2024-11-26 19:58:45,569 [onedrivegui:2022][fn=read_stdout][INFO] - [nico] To fix any download failures you may need to perform a --resync to ensure this system is correctly synced with your Microsoft OneDrive Account
2024-11-26 20:01:44,809 [onedrivegui:1956][fn=stop_worker][INFO] - [nico] Waiting for worker to finish...
2024-11-26 20:01:44,825 [onedrivegui:1960][fn=stop_worker][INFO] - [nico] Quitting thread
2024-11-26 20:01:45,825 [onedrivegui:1963][fn=stop_worker][INFO] - [nico] Removing thread info

A few hours later I synced with my other device, and the file was deleted:

[normal startup; then:]
2024-11-27 00:45:57,697 [onedrivegui:2022][fn=read_stdout][INFO] - [nigo] Sync Engine Initialised with new Onedrive API instance
2024-11-27 00:45:57,697 [onedrivegui:2022][fn=read_stdout][INFO] - [nigo] All application operations will be performed in the configured local 'sync_dir' directory: /home/nigo/OneDrive_nigo
2024-11-27 00:45:57,699 [onedrivegui:2022][fn=read_stdout][INFO] - [nigo] OneDrive synchronisation interval (seconds): 300
2024-11-27 00:45:57,699 [onedrivegui:2022][fn=read_stdout][INFO] - [nigo] Maximum allowed open files:                  9223372036854775807
2024-11-27 00:45:57,699 [onedrivegui:2022][fn=read_stdout][INFO] - [nigo] Maximum allowed inotify user watches:        524288
2024-11-27 00:45:57,699 [onedrivegui:2022][fn=read_stdout][INFO] - [nigo] Initialising filesystem inotify monitoring ...
2024-11-27 00:45:57,699 [onedrivegui:2022][fn=read_stdout][INFO] - [nigo] Monitoring directory: .
[Much more Monitoring of directory messages; nothing changed; then:]
2024-11-27 00:45:57,786 [onedrivegui:2022][fn=read_stdout][INFO] - [nigo] Performing initial synchronisation to ensure consistent local state ...
2024-11-27 00:45:57,786 [onedrivegui:2022][fn=read_stdout][INFO] - [nigo] Attempting to contact Microsoft OneDrive Login Service
2024-11-27 00:45:57,974 [onedrivegui:2022][fn=read_stdout][INFO] - [nigo] Successfully reached Microsoft OneDrive Login Service
2024-11-27 00:45:57,976 [onedrivegui:2022][fn=read_stdout][INFO] - [nigo] Starting a sync with Microsoft OneDrive
2024-11-27 00:45:58,216 [onedrivegui:2022][fn=read_stdout][INFO] - [nigo] Fetching /delta response from the OneDrive API for Drive ID: [* censored *]
2024-11-27 00:45:58,427 [onedrivegui:2022][fn=read_stdout][INFO] - [nigo] Processing API Response Bundle: 1 - Quantity of 'changes|items' in this bundle to process: 5
2024-11-27 00:45:58,428 [onedrivegui:2022][fn=read_stdout][INFO] - [nigo] Including path - included by sync_list config: ./Edumedia
2024-11-27 00:45:58,429 [onedrivegui:2022][fn=read_stdout][INFO] - [nigo] Including path - included by sync_list config: Edumedia/hsh
2024-11-27 00:45:58,430 [onedrivegui:2022][fn=read_stdout][INFO] - [nigo] Including path - included by sync_list config: Edumedia/hsh/greenit
2024-11-27 00:45:58,432 [onedrivegui:2022][fn=read_stdout][INFO] - [nigo] Finished processing /delta JSON response from the OneDrive API
2024-11-27 00:45:58,432 [onedrivegui:2022][fn=read_stdout][INFO] - [nigo] Processing 3 applicable changes and items received from Microsoft OneDrive
2024-11-27 00:45:58,432 [onedrivegui:2022][fn=read_stdout][INFO] - [nigo] Processing OneDrive JSON item batch [1/1] to ensure consistent local state
** 2024-11-27 00:45:58,436 [onedrivegui:2022][fn=read_stdout][INFO] - [nigo] Items to potentially delete locally: 1
** 2024-11-27 00:45:58,437 [onedrivegui:2022][fn=read_stdout][INFO] - [nigo] Trying to delete local file: Edumedia/hsh/greenit/notes.md
** 2024-11-27 00:45:58,438 [onedrivegui:2022][fn=read_stdout][INFO] - [nigo] Deleting local file: Edumedia/hsh/greenit/notes.md
2024-11-27 00:45:59,476 [onedrivegui:2022][fn=read_stdout][INFO] - [nigo] Performing a database consistency and integrity check on locally stored data
2024-11-27 00:45:59,483 [onedrivegui:2022][fn=read_stdout][INFO] - [nigo] Processing DB entries for this Drive ID: a5c820ea59169ecd
2024-11-27 00:45:59,829 [onedrivegui:2022][fn=read_stdout][INFO] - [nigo] Processing: ~/OneDrive_nigo
2024-11-27 00:45:59,829 [onedrivegui:2022][fn=read_stdout][INFO] - [nigo] The directory has not changed
[checking for file changes again; doesn't find any changes, and then]
2024-11-27 00:46:03,546 [onedrivegui:2022][fn=read_stdout][INFO] - [nigo] Sync with Microsoft OneDrive is complete

I really hope this is enough info to track down the problem. Thank you.

Operating System Details

What is your OS: 'Linux Manjaro 6.6.54-2-MANJARO #1 SMP PREEMPT_DYNAMIC Tue Oct  8 03:11:08 UTC 2024 x86_64 GNU/Linux'
lsb_release -a: 
'
LSB Version:    n/a
Distributor ID: ManjaroLinux
Description:    Manjaro Linux
Release:    24.1.2
Codename:   Xahea
'

Client Installation Method

From 3rd Party Source (PPA, OpenSuSE Build Service etc)

OneDrive Account Type

Personal

What is your OneDrive Application Version

onedrive v2.5.3

What is your OneDrive Application Configuration

Application version                          = onedrive v2.5.3
Compiled with                                = DMD 2109
Curl version                                 = libcurl/8.10.1 OpenSSL/3.3.2 zlib/1.3.1 brotli/1.1.0 zstd/1.5.6 libidn2/2.3.7 libpsl/0.21.5 libssh2/1.11.0 nghttp2/1.63.0 nghttp3/1.5.0
User Application Config path                 = /home/nijco/.config/onedrive
System Application Config path               = /etc/onedrive
Applicable Application 'config' location     = /home/nijco/.config/onedrive/config
Configuration file found in config location  = false - using application defaults
Applicable 'sync_list' location              = /home/nijco/.config/onedrive/sync_list
Applicable 'items.sqlite3' location          = /home/nijco/.config/onedrive/items.sqlite3
Config option 'drive_id'                     = 
Config option 'sync_dir'                     = ~/OneDrive
Config option 'enable_logging'               = false
Config option 'log_dir'                      = /var/log/onedrive
Config option 'disable_notifications'        = false
Config option 'skip_dir'                     = 
Config option 'skip_dir_strict_match'        = false
Config option 'skip_file'                    = ~*|.~*|*.tmp|*.swp|*.partial
Config option 'skip_dotfiles'                = false
Config option 'skip_symlinks'                = false
Config option 'monitor_interval'             = 300
Config option 'monitor_log_frequency'        = 12
Config option 'monitor_fullscan_frequency'   = 12
Config option 'read_only_auth_scope'         = false
Config option 'dry_run'                      = false
Config option 'upload_only'                  = false
Config option 'download_only'                = false
Config option 'local_first'                  = false
Config option 'check_nosync'                 = false
Config option 'check_nomount'                = false
Config option 'resync'                       = false
Config option 'resync_auth'                  = false
Config option 'cleanup_local_files'          = false
Config option 'classify_as_big_delete'       = 1000
Config option 'disable_upload_validation'    = false
Config option 'disable_download_validation'  = false
Config option 'bypass_data_preservation'     = false
Config option 'no_remote_delete'             = false
Config option 'remove_source_files'          = false
Config option 'sync_dir_permissions'         = 700
Config option 'sync_file_permissions'        = 600
Config option 'space_reservation'            = 52428800
Config option 'application_id'               = d50ca740-c83f-4d1b-b616-12c519384f0c
Config option 'azure_ad_endpoint'            = 
Config option 'azure_tenant_id'              = 
Config option 'user_agent'                   = ISV|abraunegg|OneDrive Client for Linux/v2.5.3
Config option 'force_http_11'                = false
Config option 'debug_https'                  = false
Config option 'rate_limit'                   = 0
Config option 'operation_timeout'            = 3600
Config option 'dns_timeout'                  = 60
Config option 'connect_timeout'              = 10
Config option 'data_timeout'                 = 60
Config option 'ip_protocol_version'          = 0
Config option 'threads'                      = 8
Config option 'max_curl_idle'                = 120
Environment var 'XDG_RUNTIME_DIR'            = true
Environment var 'DBUS_SESSION_BUS_ADDRESS'   = true
Config option 'notify_file_actions'          = false

Selective sync 'sync_list' configured        = false

Config option 'sync_business_shared_items'   = false

Config option 'webhook_enabled'              = false

What is your 'curl' version

curl 8.10.1 (x86_64-pc-linux-gnu) libcurl/8.10.1 OpenSSL/3.3.2 zlib/1.3.1 brotli/1.1.0 zstd/1.5.6 libidn2/2.3.7 libpsl/0.21.5 libssh2/1.11.0 nghttp2/1.63.0 nghttp3/1.5.0
Release-Date: 2024-09-18
Protocols: dict file ftp ftps gopher gophers http https imap imaps ipfs ipns mqtt pop3 pop3s rtsp scp sftp smb smbs smtp smtps telnet tftp
Features: alt-svc AsynchDNS brotli GSS-API HSTS HTTP2 HTTP3 HTTPS-proxy IDN IPv6 Kerberos Largefile libz NTLM PSL SPNEGO SSL threadsafe TLS-SRP UnixSockets zstd

Where is your 'sync_dir' located

Local

What are all your system 'mount points'

proc on /proc type proc (rw,nosuid,nodev,noexec,relatime)
sys on /sys type sysfs (rw,nosuid,nodev,noexec,relatime)
dev on /dev type devtmpfs (rw,nosuid,relatime,size=8143656k,nr_inodes=2035914,mode=755,inode64)
run on /run type tmpfs (rw,nosuid,nodev,relatime,mode=755,inode64)
efivarfs on /sys/firmware/efi/efivars type efivarfs (rw,nosuid,nodev,noexec,relatime)
/dev/sdb5 on / type ext4 (rw,noatime,discard)
securityfs on /sys/kernel/security type securityfs (rw,nosuid,nodev,noexec,relatime)
tmpfs on /dev/shm type tmpfs (rw,nosuid,nodev,inode64)
devpts on /dev/pts type devpts (rw,nosuid,noexec,relatime,gid=5,mode=620,ptmxmode=000)
cgroup2 on /sys/fs/cgroup type cgroup2 (rw,nosuid,nodev,noexec,relatime,nsdelegate,memory_recursiveprot)
pstore on /sys/fs/pstore type pstore (rw,nosuid,nodev,noexec,relatime)
bpf on /sys/fs/bpf type bpf (rw,nosuid,nodev,noexec,relatime,mode=700)
systemd-1 on /proc/sys/fs/binfmt_misc type autofs (rw,relatime,fd=39,pgrp=1,timeout=0,minproto=5,maxproto=5,direct,pipe_ino=7215)
mqueue on /dev/mqueue type mqueue (rw,nosuid,nodev,noexec,relatime)
debugfs on /sys/kernel/debug type debugfs (rw,nosuid,nodev,noexec,relatime)
hugetlbfs on /dev/hugepages type hugetlbfs (rw,nosuid,nodev,relatime,pagesize=2M)
tracefs on /sys/kernel/tracing type tracefs (rw,nosuid,nodev,noexec,relatime)
tmpfs on /run/credentials/systemd-journald.service type tmpfs (ro,nosuid,nodev,noexec,relatime,nosymfollow,size=1024k,nr_inodes=1024,mode=700,inode64,noswap)
tmpfs on /run/credentials/systemd-udev-load-credentials.service type tmpfs (ro,nosuid,nodev,noexec,relatime,nosymfollow,size=1024k,nr_inodes=1024,mode=700,inode64,noswap)
tmpfs on /run/credentials/systemd-tmpfiles-setup-dev-early.service type tmpfs (ro,nosuid,nodev,noexec,relatime,nosymfollow,size=1024k,nr_inodes=1024,mode=700,inode64,noswap)
fusectl on /sys/fs/fuse/connections type fusectl (rw,nosuid,nodev,noexec,relatime)
configfs on /sys/kernel/config type configfs (rw,nosuid,nodev,noexec,relatime)
tmpfs on /run/credentials/systemd-tmpfiles-setup-dev.service type tmpfs (ro,nosuid,nodev,noexec,relatime,nosymfollow,size=1024k,nr_inodes=1024,mode=700,inode64,noswap)
tmpfs on /run/credentials/systemd-vconsole-setup.service type tmpfs (ro,nosuid,nodev,noexec,relatime,nosymfollow,size=1024k,nr_inodes=1024,mode=700,inode64,noswap)
/var/lib/snapd/snaps/hello-world_29.snap on /var/lib/snapd/snap/hello-world/29 type squashfs (ro,nodev,relatime,errors=continue,threads=single,x-gdu.hide,x-gvfs-hide)
/var/lib/snapd/snaps/bare_5.snap on /var/lib/snapd/snap/bare/5 type squashfs (ro,nodev,relatime,errors=continue,threads=single,x-gdu.hide,x-gvfs-hide)
/var/lib/snapd/snaps/core18_2829.snap on /var/lib/snapd/snap/core18/2829 type squashfs (ro,nodev,relatime,errors=continue,threads=single,x-gdu.hide,x-gvfs-hide)
/var/lib/snapd/snaps/mesa-2404_143.snap on /var/lib/snapd/snap/mesa-2404/143 type squashfs (ro,nodev,relatime,errors=continue,threads=single,x-gdu.hide,x-gvfs-hide)
/var/lib/snapd/snaps/openjfx_1350.snap on /var/lib/snapd/snap/openjfx/1350 type squashfs (ro,nodev,relatime,errors=continue,threads=single,x-gdu.hide,x-gvfs-hide)
/var/lib/snapd/snaps/upscayl_38.snap on /var/lib/snapd/snap/upscayl/38 type squashfs (ro,nodev,relatime,errors=continue,threads=single,x-gdu.hide,x-gvfs-hide)
/var/lib/snapd/snaps/openjfx_1378.snap on /var/lib/snapd/snap/openjfx/1378 type squashfs (ro,nodev,relatime,errors=continue,threads=single,x-gdu.hide,x-gvfs-hide)
/var/lib/snapd/snaps/snapd_23258.snap on /var/lib/snapd/snap/snapd/23258 type squashfs (ro,nodev,relatime,errors=continue,threads=single,x-gdu.hide,x-gvfs-hide)
/var/lib/snapd/snaps/gnome-42-2204_176.snap on /var/lib/snapd/snap/gnome-42-2204/176 type squashfs (ro,nodev,relatime,errors=continue,threads=single,x-gdu.hide,x-gvfs-hide)
/var/lib/snapd/snaps/gtk-common-themes_1535.snap on /var/lib/snapd/snap/gtk-common-themes/1535 type squashfs (ro,nodev,relatime,errors=continue,threads=single,x-gdu.hide,x-gvfs-hide)
/var/lib/snapd/snaps/telegram-desktop_6357.snap on /var/lib/snapd/snap/telegram-desktop/6357 type squashfs (ro,nodev,relatime,errors=continue,threads=single,x-gdu.hide,x-gvfs-hide)
/var/lib/snapd/snaps/snapd_21759.snap on /var/lib/snapd/snap/snapd/21759 type squashfs (ro,nodev,relatime,errors=continue,threads=single,x-gdu.hide,x-gvfs-hide)
/var/lib/snapd/snaps/gnome-3-28-1804_198.snap on /var/lib/snapd/snap/gnome-3-28-1804/198 type squashfs (ro,nodev,relatime,errors=continue,threads=single,x-gdu.hide,x-gvfs-hide)
/var/lib/snapd/snaps/core24_490.snap on /var/lib/snapd/snap/core24/490 type squashfs (ro,nodev,relatime,errors=continue,threads=single,x-gdu.hide,x-gvfs-hide)
/var/lib/snapd/snaps/core20_2434.snap on /var/lib/snapd/snap/core20/2434 type squashfs (ro,nodev,relatime,errors=continue,threads=single,x-gdu.hide,x-gvfs-hide)
/var/lib/snapd/snaps/core_17200.snap on /var/lib/snapd/snap/core/17200 type squashfs (ro,nodev,relatime,errors=continue,threads=single,x-gdu.hide,x-gvfs-hide)
/var/lib/snapd/snaps/upscayl_37.snap on /var/lib/snapd/snap/upscayl/37 type squashfs (ro,nodev,relatime,errors=continue,threads=single,x-gdu.hide,x-gvfs-hide)
/var/lib/snapd/snaps/core18_2846.snap on /var/lib/snapd/snap/core18/2846 type squashfs (ro,nodev,relatime,errors=continue,threads=single,x-gdu.hide,x-gvfs-hide)
/var/lib/snapd/snaps/whatsdesk_28.snap on /var/lib/snapd/snap/whatsdesk/28 type squashfs (ro,nodev,relatime,errors=continue,threads=single,x-gdu.hide,x-gvfs-hide)
/var/lib/snapd/snaps/drawio_228.snap on /var/lib/snapd/snap/drawio/228 type squashfs (ro,nodev,relatime,errors=continue,threads=single,x-gdu.hide,x-gvfs-hide)
/var/lib/snapd/snaps/gnome-46-2404_48.snap on /var/lib/snapd/snap/gnome-46-2404/48 type squashfs (ro,nodev,relatime,errors=continue,threads=single,x-gdu.hide,x-gvfs-hide)
/var/lib/snapd/snaps/core_16928.snap on /var/lib/snapd/snap/core/16928 type squashfs (ro,nodev,relatime,errors=continue,threads=single,x-gdu.hide,x-gvfs-hide)
/var/lib/snapd/snaps/gnome-2048_56.snap on /var/lib/snapd/snap/gnome-2048/56 type squashfs (ro,nodev,relatime,errors=continue,threads=single,x-gdu.hide,x-gvfs-hide)
/var/lib/snapd/snaps/discord_218.snap on /var/lib/snapd/snap/discord/218 type squashfs (ro,nodev,relatime,errors=continue,threads=single,x-gdu.hide,x-gvfs-hide)
/var/lib/snapd/snaps/discord_217.snap on /var/lib/snapd/snap/discord/217 type squashfs (ro,nodev,relatime,errors=continue,threads=single,x-gdu.hide,x-gvfs-hide)
/var/lib/snapd/snaps/onenote-desktop_20.snap on /var/lib/snapd/snap/onenote-desktop/20 type squashfs (ro,nodev,relatime,errors=continue,threads=single,x-gdu.hide,x-gvfs-hide)
/var/lib/snapd/snaps/gnome-46-2404_42.snap on /var/lib/snapd/snap/gnome-46-2404/42 type squashfs (ro,nodev,relatime,errors=continue,threads=single,x-gdu.hide,x-gvfs-hide)
/var/lib/snapd/snaps/telegram-desktop_6336.snap on /var/lib/snapd/snap/telegram-desktop/6336 type squashfs (ro,nodev,relatime,errors=continue,threads=single,x-gdu.hide,x-gvfs-hide)
/var/lib/snapd/snaps/core24_609.snap on /var/lib/snapd/snap/core24/609 type squashfs (ro,nodev,relatime,errors=continue,threads=single,x-gdu.hide,x-gvfs-hide)
/var/lib/snapd/snaps/core22_1621.snap on /var/lib/snapd/snap/core22/1621 type squashfs (ro,nodev,relatime,errors=continue,threads=single,x-gdu.hide,x-gvfs-hide)
/var/lib/snapd/snaps/core22_1663.snap on /var/lib/snapd/snap/core22/1663 type squashfs (ro,nodev,relatime,errors=continue,threads=single,x-gdu.hide,x-gvfs-hide)
/var/lib/snapd/snaps/core20_2379.snap on /var/lib/snapd/snap/core20/2379 type squashfs (ro,nodev,relatime,errors=continue,threads=single,x-gdu.hide,x-gvfs-hide)
/var/lib/snapd/snaps/drawio_226.snap on /var/lib/snapd/snap/drawio/226 type squashfs (ro,nodev,relatime,errors=continue,threads=single,x-gdu.hide,x-gvfs-hide)
/var/lib/snapd/snaps/mesa-2404_44.snap on /var/lib/snapd/snap/mesa-2404/44 type squashfs (ro,nodev,relatime,errors=continue,threads=single,x-gdu.hide,x-gvfs-hide)
tmpfs on /tmp type tmpfs (rw,noatime,inode64)
/dev/sda4 on /home type ext4 (rw,noatime)
/dev/sda2 on /boot/efi type vfat (rw,noatime,fmask=0022,dmask=0022,codepage=437,iocharset=ascii,shortname=mixed,utf8,errors=remount-ro)
tmpfs on /run/credentials/systemd-tmpfiles-setup.service type tmpfs (ro,nosuid,nodev,noexec,relatime,nosymfollow,size=1024k,nr_inodes=1024,mode=700,inode64,noswap)
tmpfs on /run/credentials/systemd-sysctl.service type tmpfs (ro,nosuid,nodev,noexec,relatime,nosymfollow,size=1024k,nr_inodes=1024,mode=700,inode64,noswap)
binfmt_misc on /proc/sys/fs/binfmt_misc type binfmt_misc (rw,nosuid,nodev,noexec,relatime)
tmpfs on /run/user/1000 type tmpfs (rw,nosuid,nodev,relatime,size=1630464k,nr_inodes=407616,mode=700,uid=1000,gid=1000,inode64)
gvfsd-fuse on /run/user/1000/gvfs type fuse.gvfsd-fuse (rw,nosuid,nodev,relatime,user_id=1000,group_id=1000)
portal on /run/user/1000/doc type fuse.portal (rw,nosuid,nodev,relatime,user_id=1000,group_id=1000)
run on /run/snapd/ns type tmpfs (rw,nosuid,nodev,relatime,mode=755,inode64)
nsfs on /run/snapd/ns/telegram-desktop.mnt type nsfs (rw)
nsfs on /run/snapd/ns/whatsdesk.mnt type nsfs (rw)

What are all your local file system partition types

NAME FSTYPE FSVER LABEL             UUID                                 FSAVAIL FSUSE% MOUNTPOINTS
loop0
                                                                               0   100% /var/lib/snapd/snap/core/17200
loop1
                                                                               0   100% /var/lib/snapd/snap/core/16928
loop2
                                                                               0   100% /var/lib/snapd/snap/core18/2829
loop3
                                                                               0   100% /var/lib/snapd/snap/bare/5
loop4
                                                                               0   100% /var/lib/snapd/snap/core18/2846
loop5
                                                                               0   100% /var/lib/snapd/snap/core20/2379
loop6
                                                                               0   100% /var/lib/snapd/snap/core20/2434
loop7
                                                                               0   100% /var/lib/snapd/snap/core22/1621
loop8
                                                                               0   100% /var/lib/snapd/snap/core22/1663
loop9
                                                                               0   100% /var/lib/snapd/snap/core24/490
loop10
                                                                               0   100% /var/lib/snapd/snap/core24/609
loop11
                                                                               0   100% /var/lib/snapd/snap/discord/217
loop12
                                                                               0   100% /var/lib/snapd/snap/discord/218
loop13
                                                                               0   100% /var/lib/snapd/snap/drawio/226
loop14
                                                                               0   100% /var/lib/snapd/snap/drawio/228
loop15
                                                                               0   100% /var/lib/snapd/snap/gnome-2048/56
loop16
                                                                               0   100% /var/lib/snapd/snap/gnome-3-28-1804/198
loop17
                                                                               0   100% /var/lib/snapd/snap/gnome-42-2204/176
loop18
                                                                               0   100% /var/lib/snapd/snap/gnome-46-2404/42
loop19
                                                                               0   100% /var/lib/snapd/snap/gnome-46-2404/48
loop20
                                                                               0   100% /var/lib/snapd/snap/gtk-common-themes/1535
loop21
                                                                               0   100% /var/lib/snapd/snap/hello-world/29
loop22
                                                                               0   100% /var/lib/snapd/snap/mesa-2404/44
loop23
                                                                               0   100% /var/lib/snapd/snap/mesa-2404/143
loop24
                                                                               0   100% /var/lib/snapd/snap/onenote-desktop/20
loop25
                                                                               0   100% /var/lib/snapd/snap/openjfx/1350
loop26
                                                                               0   100% /var/lib/snapd/snap/openjfx/1378
loop27
                                                                               0   100% /var/lib/snapd/snap/snapd/21759
loop28
                                                                               0   100% /var/lib/snapd/snap/snapd/23258
loop29
                                                                               0   100% /var/lib/snapd/snap/telegram-desktop/6336
loop30
                                                                               0   100% /var/lib/snapd/snap/upscayl/37
loop31
                                                                               0   100% /var/lib/snapd/snap/upscayl/38
loop32
                                                                               0   100% /var/lib/snapd/snap/telegram-desktop/6357
loop33
                                                                               0   100% /var/lib/snapd/snap/whatsdesk/28
sda                                                                                     
├─sda1
│    ntfs         Wiederherstellung [*omitted*]                                    
├─sda2
│    vfat   FAT32                   [*omitted*]                             69,4M    27% /boot/efi
├─sda3
│    ntfs         Volume            [*omitted*]                                   
├─sda4
│    ext4   1.0                     [*omitted*]                         8,8G    92% /home
└─sda5
     swap   1                       [*omitted*]                             [SWAP]
sdb                                                                                     
├─sdb1
│                                                                                       
├─sdb2
│    vfat   FAT32                   [*omitted*]                                           
├─sdb3
│    ntfs                           [*omitted*]                                     
├─sdb4
│    ntfs                           [*omitted*]                                     
└─sdb5
     ext4   1.0                     [*omitted*]                         8,8G    83% /
nvme0n1
│                                                                                       
├─nvme0n1p1
│                                                                                       
└─nvme0n1p2
     ntfs         Volume            [*omitted*]

How do you use 'onedrive'

I use onedrive one to Linux PCs, both with the same setup:

Steps to reproduce the behaviour

I don't know why the download of the file failed, which lead to this. As far as I can tell, OneDrive API wanted me to login again? And gave my a 401 because of that?

Complete Verbose Log Output

Unfortunately, I cannot reproduce Microsoft giving my a 401 after login.

Screenshots

No response

Other Log Information or Details

No response

Additional context

No response

abraunegg commented 5 days ago

@Nijco Thanks for the feedback and bug report.

Looking at the code, based on the provided output, it certainly looks like a slight logic error.

Whilst I can correct this, I am unsure of you or me being able to actually reproduce this in a consistent manner to validate the fix.

If you are able to reproduce this consistently, please let me know otherwise I will bug fix straight to 'master'

abraunegg commented 4 days ago

@Nijco If you are able to reproduce this consistently, please can you test PR #3017 to resolve your issue.

NOTE: You will need to run this PR on all your devices to ensure this bug is not being re-introduced elsewhere by running multiple versions.

First install all the require platform dependencies to build the client on your respective platforms. Please read https://github.com/abraunegg/onedrive/blob/master/docs/install.md#building-from-source---high-level-requirements and then follow correctly for your platform.

Once this is done, to clone the PR to resolve your issue, you can use a script like the following:

#!/bin/bash

PR=3017

rm -rf ./onedrive-pr${PR}
git clone https://github.com/abraunegg/onedrive.git onedrive-pr${PR}
cd onedrive-pr${PR}
git fetch origin pull/${PR}/head:pr${PR}
git checkout pr${PR}

# Configure and Build
./configure --enable-debug --enable-notifications; make clean; make;
./onedrive --version

This script will create a local folder called onedrive-pr3017 with the PR version.

To run the PR, you need to run the client from the PR build directory:

./onedrive <any other options needed>

To install the PR, you will need to perform sudo make install to install the PR version to your system.

When running the PR, your version should be: onedrive v2.5.3-14-g60403f8 or greater.

Nijco commented 4 days ago

Thank you for the quick fix! I was able to reproduce the situation by running mitmproxy and having a script that throws a 401 for a specific file id.

2024-11-28 12:49:38,349 [onedrivegui:2022][fn=read_stdout][INFO] - [nico] Performing a last examination of the most recent online data within Microsoft OneDrive to complete the reconciliation process
2024-11-28 12:49:38,349 [onedrivegui:2022][fn=read_stdout][INFO] - [nico] Fetching /delta response from the OneDrive API for Drive ID: [**]
2024-11-28 12:49:38,488 [onedrivegui:2022][fn=read_stdout][INFO] - [nico] Processing API Response Bundle: 1 - Quantity of 'changes|items' in this bundle to process: 0
2024-11-28 12:49:38,490 [onedrivegui:2022][fn=read_stdout][INFO] - [nico] Finished processing /delta JSON response from the OneDrive API
2024-11-28 12:49:38,491 [onedrivegui:2022][fn=read_stdout][INFO] - [nico] No changes or items that can be applied were discovered while processing the data received from Microsoft OneDrive
2024-11-28 12:49:38,493 [onedrivegui:2022][fn=read_stdout][INFO] - [nico] Failed items to download to/from Microsoft OneDrive: 1
** 2024-11-28 12:49:38,493 [onedrivegui:2022][fn=read_stdout][INFO] - [nico] Failed to download: Hörbücher/my-text.txt
2024-11-28 12:49:38,493 [onedrivegui:2022][fn=read_stdout][INFO] - [nico] Sync with Microsoft OneDrive has completed, however there are items that failed to sync.
2024-11-28 12:49:38,494 [onedrivegui:2022][fn=read_stdout][INFO] - [nico] To fix any download failures you may need to perform a --resync to ensure this system is correctly synced with your Microsoft OneDrive Account

The file is not deleted online anymore :tada: When syncing again on the same machine, it is also not downloaded again, but when the file download error occurs the output here says resync might be necessary and the gui gives a warning, so I guess this is fixed. :)

abraunegg commented 4 days ago

@Nijco Thanks for the confirmation - will mark this as fixed and merge into 'master'