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: Local File Time Discrepancy Issue #3057

Closed
erenoglu opened this issue Jan 6, 2025 · 18 comments · Fixed by #3064
Closed

Bug: Local File Time Discrepancy Issue #3057

erenoglu opened this issue Jan 6, 2025 · 18 comments · Fixed by #3064
Labels
Bug Something isn't working Fixed
Milestone

Comments

@erenoglu
Copy link

erenoglu commented Jan 6, 2025

Describe the bug

I am doing a fresh start with an empty local folder. Then syncing one folder in my Onedrive for Business. Onedrive client downloads the file, then detects that local timestamp is different, then uploads, then complains that Microsoft has "enriched" the file, and re-downloads it. So instead of just once downloading, it's doing download-upload-download. Why would that be?

The local system is an Arch linux up to date, using BTRFS. No running file search applications so dont know who's changing the timestamp, or if Onedrive is failing to put the right timestamp, or the resolution of the timestamp in BTRFS is different etc, or it's checking a different timestamp when comparing.

Here are the error messages from verbose log:

Processing: Projeler/abc/xyz.docx
Local file time discrepancy detected: Projeler/abc/xyz.docx
The last modified timestamp has changed however the file content has not changed
The local item has the same hash value as the item online - correcting timestamp online
....
Downloading: .....
WARNING: Skipping download integrity check for: ....
Uploading: ....... 100% | DONE in 00:00:06
Uploading modified file: ... done
WARNING: Microsoft OneDrive modified your uploaded file via its SharePoint 'enrichment' feature. To keep your local and online versions consistent, the altered file will now be downloaded.
WARNING: Please refer to https://github.com/OneDrive/onedrive-api-docs/issues/935 for further details.
Downloading: ....... 0%   |  ETA    --:--:--

Operating System Details

Linux mylinuxpc 6.12.8-arch1-1 #1 SMP PREEMPT_DYNAMIC Thu, 02 Jan 2025 22:52:26 +0000 x86_64 GNU/Linux

Client Installation Method

From Source

OneDrive Account Type

Business | Office365

What is your OneDrive Application Version

onedrive v2.5.3-27-g71a71da1

What is your OneDrive Application Configuration

sync_dir = "/home/myuser/OneDrive"
dry_run = "false"
disable_download_validation = "true"
disable_upload_validation = "true"

Rest are default

sync_list file has only one line:
/Projeler

What is your 'curl' version

curl 8.11.1 (x86_64-pc-linux-gnu) libcurl/8.11.1 OpenSSL/3.4.0 zlib/1.3.1 brotli/1.1.0 zstd/1.5.6 libidn2/2.3.7 libpsl/0.21.5 libssh2/1.11.1 nghttp2/1.64.0 nghttp3/1.7.0
Release-Date: 2024-12-11
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 ws wss
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'

too many mount points due to subvolumes, but home directory is here:

/dev/mapper/arch on / type btrfs (rw,noatime,compress=zstd:3,ssd,discard=async,space_cache=v2,subvolid=258,subvol=/@/.snapshots/1/snapshot)

What are all your local file system partition types

btrfs

How do you use 'onedrive'

Onedrive on this linux system is not shared, but Microsoft's own Client is probably running online in a virtual Windows machine at work

Steps to reproduce the behaviour

Make a minimal sync_list to download a single directory from your Onedrive
use config file given above
do a --sync --resync and see the logs, various files are downloaded, then uploaded, then downloaded again

Complete Verbose Log Output

can't give due to corporate limitations, but I've given the necessary snippet above and if required I can give more logs.

Screenshots

No response

Other Log Information or Details

No response

Additional context

No response

@erenoglu erenoglu added the Bug Something isn't working label Jan 6, 2025
@erenoglu
Copy link
Author

erenoglu commented Jan 6, 2025

Now did a directory with only two files inside, one binary and one 7z file, here's the full log:

Skipping path - excluded by sync_list config
....
Skipping path - excluded by sync_list config
....
Finished processing /delta JSON response from the OneDrive API
Processing 4 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 Microsoft OneDrive: 2
WARNING: Skipping download integrity check for: Temporary/generator.7z
Downloading file: Temporary/generator.7z ... done
WARNING: Skipping download integrity check for: Temporary/generator
Downloading file: Temporary/generator ... done
Performing a database consistency and integrity check on locally stored data
Processing DB entries for this Drive ID: abcdefghijkl.....
Processing: /home/myhome/OneDrive
The directory has not changed
Processing: Temporary
The directory has not changed
Processing: Temporary/generator.7z
Local file time discrepancy detected: Temporary/generator.7z
The last modified timestamp has changed however the file content has not changed
The local item has the same hash value as the item online - correcting timestamp online
Processing: Temporary/generator
Local file time discrepancy detected: Temporary/generator
The last modified timestamp has changed however the file content has not changed
The local item has the same hash value as the item online - correcting timestamp online
Scanning the local file system '/home/myhome/OneDrive' for new data to upload
Performing a last examination of the most recent online data within Microsoft OneDrive to complete the reconciliation process
Fetching /delta response from the OneDrive API for Drive ID: abcdefgh......
Processing API Response Bundle: 1 - Quantity of 'changes|items' in this bundle to process: 4
Including path - included by sync_list config: ./Temporary
Including file - included by sync_list config: Temporary/generator.7z
Including file - included by sync_list config: Temporary/generator
Finished processing /delta JSON response from the OneDrive API
Processing 3 applicable changes and items received from Microsoft OneDrive
Processing OneDrive JSON item batch [1/1] to ensure consistent local state

and now I added a PPTX file, and synced without --resync, here's the output, we can see download, then upload due to timestamp change, then re-download due to enrichment:

Reading configuration file: /home/myhome/.config/onedrive/accounts/myaccount/config
Configuration file successfully loaded
Using 'user' configuration path for application config and state data: /home/myhome/.config/onedrive/accounts/myaccount
Using IPv4 and IPv6 (if configured) for all network operations
Attempting to contact Microsoft OneDrive Login Service
Successfully reached Microsoft OneDrive Login Service
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:  onedrive v2.5.3-27-g71a71da1
Account Type:         business
Default Drive ID:     abcdefghi.......
Default Root ID:      01Y3SVTJN6Y2GOVW7725BZO354PWSELRRZ
Remaining Free Space: 1004.56 GB (1078633847004 bytes)
Sync Engine Initialised with new Onedrive API instance
All application operations will be performed in the configured local 'sync_dir' directory: /home/myhome/OneDrive
Fetching /delta response from the OneDrive API for Drive ID: abcdefghi.......
Processing API Response Bundle: 1 - Quantity of 'changes|items' in this bundle to process: 3
Including path - included by sync_list config: ./Temporary
Including file - included by sync_list config: Temporary/ExamplePPTXfile.pptx
Finished processing /delta JSON response from the OneDrive API
Processing 2 applicable changes and items received from Microsoft OneDrive
Processing OneDrive JSON item batch [1/1] to ensure consistent local state
WARNING: OneDrive API inconsistency - this file does not have any hash: Temporary/ExamplePPTXfile.pptx
Number of items to download from Microsoft OneDrive: 1
WARNING: Skipping download integrity check for: Temporary/ExamplePPTXfile.pptx
**Downloading file: Temporary/ExamplePPTXfile.pptx ... done**
WARNING: OneDrive API inconsistency - this file does not have any hash: Temporary/ExamplePPTXfile.pptx
Performing a database consistency and integrity check on locally stored data
Processing DB entries for this Drive ID: abcdefghi.......
Processing: /home/myhome/OneDrive
The directory has not changed
Processing: Temporary
The directory has not changed
Processing: Temporary/generator.7z
The file has not changed
Processing: Temporary/generator
The file has not changed
Processing: Temporary/ExamplePPTXfile.pptx
**Local file time discrepancy detected: Temporary/ExamplePPTXfile.pptx**
**The file content has changed locally and has a newer timestamp, thus needs to be uploaded to OneDrive**
Changed local items to upload to Microsoft OneDrive: 1
Uploading modified file: Temporary/ExamplePPTXfile.pptx ... done
WARNING: Skipping upload integrity check for: Temporary/ExamplePPTXfile.pptx
**WARNING: Microsoft OneDrive modified your uploaded file via its SharePoint 'enrichment' feature. To keep your local and online versions consistent, the altered file will now be downloaded.**
WARNING: Please refer to https://github.com/OneDrive/onedrive-api-docs/issues/935 for further details.
WARNING: Skipping download integrity check for: Temporary/ExamplePPTXfile.pptx
**Downloading file: Temporary/ExamplePPTXfile.pptx ... done**
Scanning the local file system '/home/myhome/OneDrive' for new data to upload
Performing a last examination of the most recent online data within Microsoft OneDrive to complete the reconciliation process
Fetching /delta response from the OneDrive API for Drive ID: abcdefghi.......
Processing API Response Bundle: 1 - Quantity of 'changes|items' in this bundle to process: 3
Including path - included by sync_list config: ./Temporary
Including file - included by sync_list config: Temporary/ExamplePPTXfile.pptx
Finished processing /delta JSON response from the OneDrive API
Processing 2 applicable changes and items received from Microsoft OneDrive
Processing OneDrive JSON item batch [1/1] to ensure consistent local state

Sync with Microsoft OneDrive is complete
Attempting to perform a database vacuum to optimise database
Database vacuum is complete

@abraunegg
Copy link
Owner

@erenoglu

This is not a bug - sorry. This is how this client operates to deal with Microsoft SharePoint and the issues it creates.

So instead of just once downloading, it's doing download-upload-download. Why would that be?

This is because of a 'feature' (a bug) with Microsoft SharePoint.

As per the application output, please read: OneDrive/onedrive-api-docs#935

Microsoft will modify all files (except certain file types such as .txt) and change the file post upload - so the file you have locally is no longer the same file as the file online.

As you are using a OneDrive Business Account, please complain to Microsoft about why their SharePoint product willfully modifies your files post upload, breaking all notion of expected file integrity.

@abraunegg abraunegg added Not a bug and removed Bug Something isn't working labels Jan 6, 2025
@erenoglu
Copy link
Author

erenoglu commented Jan 7, 2025

Yes I understand the issue on upload and it's OK.
but why does it upload at first place? It shall only download and set the timestamp to be equal to remote file. Why does the local timestamp not match right after download, forcing an upload as a result?

@abraunegg
Copy link
Owner

The answer lies in the application output you provided.

Your API response from your SharePoint system is not providing the full details for a file - this is an API inconsistency - ie a bug with Microsoft OneDrive itself.

Because the API data is incomplete, the 'onedrive' application has no reference as to what is stored online, to correctly determine the state, thus it is uploaded.

All of this is beyond the control of this client. Raise a bug report with Microsoft if this is an issue for you.

@erenoglu
Copy link
Author

erenoglu commented Jan 7, 2025

Thanks. Thinking about your message and considering that this was a new PPTX file i uploaded, I thought Onedrive did not yet "enrich" it or add necessary full details, so I decided to give it another shot this morning. Now I see different behavior.
The timestamp issue is still there. New behaviour is that it downloads, then finds out that local timestamp differs from online timestamp, and updates online timestamp. This makes us lose the modified timestamp data, as it's now "current sync time".

Queestion is, Why does the local timestamp for a just downloaded file differ from the online version, which triggers a timestamp update for online verrsion?

Skipping path - excluded by sync_list config: .....
Finished processing /delta JSON response from the OneDrive API
Processing 6 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 Microsoft OneDrive: 3
WARNING: Skipping download integrity check for: Temporary/ExamplePPTXfile.pptx
Downloading file: Temporary/ExamplePPTXfile.pptx ... done
WARNING: Skipping download integrity check for: Temporary/example-binary.7z
Downloading file: Temporary/example-binary.7z ... done
WARNING: Skipping download integrity check for: Temporary/example-binary
Downloading file: Temporary/example-binary ... done
Performing a database consistency and integrity check on locally stored data
Processing DB entries for this Drive ID: abcdef.......
Processing: /home/emre/OneDrive
The directory has not changed
Processing: Temporary
The directory has not changed
Processing: Temporary/ExamplePPTXfile.pptx
Local file time discrepancy detected: Temporary/ExamplePPTXfile.pptx
The last modified timestamp has changed however the file content has not changed
The local item has the same hash value as the item online - correcting timestamp online
Processing: Temporary/example-binary.7z
Local file time discrepancy detected: Temporary/example-binary.7z
The last modified timestamp has changed however the file content has not changed
The local item has the same hash value as the item online - correcting timestamp online

Processing: Temporary/example-binary
Local file time discrepancy detected: Temporary/example-binary
The last modified timestamp has changed however the file content has not changed
The local item has the same hash value as the item online - correcting timestamp online

Scanning the local file system '/home/emre/OneDrive' for new data to upload
Performing a last examination of the most recent online data within Microsoft OneDrive to complete the reconciliation process
Fetching /delta response from the OneDrive API for Drive ID: abcdef.......
Processing API Response Bundle: 1 - Quantity of 'changes|items' in this bundle to process: 5
Including path - included by sync_list config: ./Temporary
Including file - included by sync_list config: Temporary/example-binary.7z
Including file - included by sync_list config: Temporary/example-binary
Including file - included by sync_list config: Temporary/ExamplePPTXfile.pptx
Finished processing /delta JSON response from the OneDrive API
Processing 4 applicable changes and items received from Microsoft OneDrive
Processing OneDrive JSON item batch [1/1] to ensure consistent local state

Sync with Microsoft OneDrive is complete
Attempting to perform a database vacuum to optimise database
Database vacuum is complete

@abraunegg
Copy link
Owner

@erenoglu
Please wrap your log output with 3 x backticks at the start / end to make things easier to read.

To help you understand what your system is doing enable debug logging using --verbose --verbose - this will show you what is happening and more importantly why.

Also ask yourself this question - are you using any file indexer on your system?

File indexers like Baloo and others track that they have indexed a file by modifying the filestamp post indexing. This particular issue has cropped up before ... so please ensure you disable all file indexers is you are using any.

@erenoglu
Copy link
Author

erenoglu commented Jan 7, 2025

Thanks. I'm not using any trackers or indexers, baloo is disabled & not running (checked with ps). Even if there was such app, I dont see it misbehave, as all of my files just keep their modified times intact except when used with Onedrive.

This round, I've kept only one pptx file in OneDrive and synced that directory now with a re-sync after deleting the database. I can still see timestamp issues in the logs. I see below interesting lines. I have full log if required but relevant extract is below.

**DEBUG: Downloading file: Temporary/ExamplePPTXfile.pptx ... done**
DEBUG: saveItem - creating DB item from this JSON: {"@odata.etag":"\"{31B4671B-B598-4346-8537-2B1AD9FFDB1D},9\"","@odata.type":"#microsoft.graph.driveItem","cTag":"\"c:{31B4671B-B598-4346-8537-2B1AD9FFDB1D},3\"","eTag":"\"{31B4671B-B598-4346-8537-2B1AD9FFDB1D},9\"","file":{"hashes":{"quickXorHash":"jeMRLWSVRO2cm1RYb5HDYe4S3dg="},"mimeType":"application\/vnd.openxmlformats-officedocument.presentationml.presentation"},"fileSystemInfo":{"createdDateTime":"2025-01-06T18:03:33Z","**lastModifiedDateTime":"2025-01-07T14:52:56Z"**},"id":"01Y3SVTJI3M62DDGFVIZBYKNZLDLM77WY5","name":"ExamplePPTXfile.pptx","parentReference":{"driveId":"b!sIsio2cLB0uFSXBzgAnLut-WmSm0fgdDjza9jGNENgE-DHr4-94gQor4P4sATA3d","driveType":"business","id":"01Y3SVTJOH4Z2ARZLTAFALYGQKSDBBSD6T","path":"\/drives\/b!sIsio2cLB0uFSXBzgAnLut-WmSm0fgdDjza9jGNENgE-DHr4-94gQor4P4sATA3d\/root:\/Temporary","siteId":"a3228bb0-0b67-4b07-8549-70738009cbba"},"size":370942}
DEBUG: Flagging object as a file
DEBUG: Attempting to perform a database checkpoint to merge temporary data
DEBUG: Counting open SQL statements
DEBUG: Database checkpoint is complete
DEBUG: Updating completed deltaLink for driveID b!sIsio2cLB0uFSXBzgAnLut-WmSm0fgdDjza9jGNENgE-DHr4-94gQor4P4sATA3d in DB to: https://graph.microsoft.com/v1.0/drives/b!sIsio2cLB0uFSXBzgAnLut-WmSm0fgdDjza9jGNENgE-DHr4-94gQor4P4sATA3d/items/01Y3SVTJN6Y2GOVW7725BZO354PWSELRRZ/delta?select=id,name,eTag,cTag,deleted,file,folder,root,fileSystemInfo,remoteItem,parentReference,size&token=NDslMjM0OyUyMzE7MztmODdhMGMzZS1kZWZiLTQyMjAtOGFmOC0zZjhiMDA0YzBkZGQ7NjM4NzE4NjE3NDUxMzcwMDAwOzkwNzI4NDIzMDslMjM7JTIzOyUyMzA7JTIz
DEBUG: Added new latestDeltaLink entry: b!sIsio2cLB0uFSXBzgAnLut-WmSm0fgdDjza9jGNENgE-DHr4-94gQor4P4sATA3d -> https://graph.microsoft.com/v1.0/drives/b!sIsio2cLB0uFSXBzgAnLut-WmSm0fgdDjza9jGNENgE-DHr4-94gQor4P4sATA3d/items/01Y3SVTJN6Y2GOVW7725BZO354PWSELRRZ/delta?select=id,name,eTag,cTag,deleted,file,folder,root,fileSystemInfo,remoteItem,parentReference,size&token=NDslMjM0OyUyMzE7MztmODdhMGMzZS1kZWZiLTQyMjAtOGFmOC0zZjhiMDA0YzBkZGQ7NjM4NzE4NjE3NDUxMzcwMDAwOzkwNzI4NDIzMDslMjM7JTIzOyUyMzA7JTIz
DEBUG: Performing a database consistency and integrity check on locally stored data
DEBUG: CurlEngine getCurlInstance() called
DEBUG: CurlEngine curlEnginePool current size: 3
DEBUG: CurlEngine OUV8XL9adpuJkGTC time since last use: 11 ms, 700 μs, and 3 hnsecs
DEBUG: CurlEngine was in a valid state - returning existing CurlEngine instance
DEBUG: Using CurlEngine instance ID: OUV8XL9adpuJkGTC
DEBUG: Read token from appConfig
DEBUG: Authorised State: true
DEBUG: Seeking available quota for this drive id: b!sIsio2cLB0uFSXBzgAnLut-WmSm0fgdDjza9jGNENgE-DHr4-94gQor4P4sATA3d
DEBUG: Request URL = https://graph.microsoft.com/v1.0/drives/b!sIsio2cLB0uFSXBzgAnLut-WmSm0fgdDjza9jGNENgE-DHr4-94gQor4P4sATA3d/?select=quota
DEBUG: Existing Microsoft OneDrive Access Token Expires: 2025-Jan-07 20:49:03.7650876
DEBUG: CurlEngine cleanup() called on instance id: OUV8XL9adpuJkGTC
DEBUG: OneDrive API releaseCurlEngine() Called
DEBUG: CurlEngine releaseEngine() called on instance id: OUV8XL9adpuJkGTC
DEBUG: CurlEngine curlEnginePool size before release: 2
DEBUG: Release Timestamp for CurlEngine OUV8XL9adpuJkGTC: 2025-Jan-07 15:49:31.6938874Z
DEBUG: CurlEngine cleanup() called on instance id: OUV8XL9adpuJkGTC
DEBUG: CurlEngine curlEnginePool size after release: 3
DEBUG: Quota Details: {"@odata.context":"https:\/\/graph.microsoft.com\/v1.0\/$metadata#drives\/$entity","quota":{"deleted":59371365,"remaining":1078537511921,"state":"normal","total":1099511627776,"used":20914744490}}
DEBUG: Reported Available Online Quota for driveID 'b!sIsio2cLB0uFSXBzgAnLut-WmSm0fgdDjza9jGNENgE-DHr4-94gQor4P4sATA3d': 1078537511921
DEBUG: onlineDriveDetails: ["b!sIsio2cLB0uFSXBzgAnLut-WmSm0fgdDjza9jGNENgE-DHr4-94gQor4P4sATA3d":DriveDetailsCache("b!sIsio2cLB0uFSXBzgAnLut-WmSm0fgdDjza9jGNENgE-DHr4-94gQor4P4sATA3d", false, true, 1078537511921)]
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 b!sIsio2cLB0uFSXBzgAnLut-WmSm0fgdDjza9jGNENgE-DHr4-94gQor4P4sATA3d and 01Y3SVTJN6Y2GOVW7725BZO354PWSELRRZ
DEBUG: Attempting to calculate local filesystem path for b!sIsio2cLB0uFSXBzgAnLut-WmSm0fgdDjza9jGNENgE-DHr4-94gQor4P4sATA3d and 01Y3SVTJOH4Z2ARZLTAFALYGQKSDBBSD6T
DEBUG: Attempting to calculate local filesystem path for b!sIsio2cLB0uFSXBzgAnLut-WmSm0fgdDjza9jGNENgE-DHr4-94gQor4P4sATA3d and 01Y3SVTJI3M62DDGFVIZBYKNZLDLM77WY5
**DEBUG: This local file has a different modified time 2025-Jan-07 15:49:31Z (UTC) when compared to database modified time 2025-Jan-07 14:52:56Z (UTC)**

@abraunegg
Copy link
Owner

@erenoglu
Thanks - will look at this a little deeper as the call to set the local.timestamp is not occuring

@abraunegg abraunegg reopened this Jan 7, 2025
@abraunegg abraunegg added Bug Something isn't working Investigating and removed Not a bug labels Jan 7, 2025
@abraunegg
Copy link
Owner

@erenoglu
As I am also sitting on a beach, it will be next week before this is looked at any further.

@erenoglu
Copy link
Author

erenoglu commented Jan 8, 2025

Thanks, enjoy the beach! :)

@MightyMirko
Copy link

MightyMirko commented Jan 9, 2025

I assume this "feature" is also responsible to claim new files under my name on sharepoint? Those files have been upped by a colleague, my client downloaded it and put my name on it:
grafik

grafik

abraunegg added a commit that referenced this issue Jan 11, 2025
* When --disable-download-validation is used, we still need to set the file timestamp correctly to avoid integrity checking issues
* Implement setFileTimestamp() as a common function so that when setting a file timestamp this is done in a consistent manner
@abraunegg abraunegg added this to the v2.5.4 milestone Jan 11, 2025
@abraunegg
Copy link
Owner

@erenoglu

Please can you test the PR below.

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=3064

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-pr3064 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-29-g2483cb3 or greater.

@abraunegg
Copy link
Owner

abraunegg commented Jan 11, 2025

@MightyMirko

I assume this "feature" is also responsible to claim new files under my name on sharepoint? Those files have been upped by a colleague, my client downloaded it and put my name on it:

Your 'issue' could be 100% different here ...

This issue (#3057) specifically deals with a bug where setting the timestamp of a downloaded file was not being performed when a very specific option is being used (--disable-download-validation) which causes the file to then be re-uploaded to Microsoft OneDrive.

The images you have provided, you were the last person to 'change' that file ... now ... why did that occur?

  1. SharePoint has some pretty bad 'features' this client attempts to work around
  2. These features make it nearly impossible to maintain the integrity of your data
  3. In v2.5.3 and below, there are a number of bugs (including Bug: Local File Time Discrepancy Issue #3057) and regressions relating to SharePoint - these have been fixed post v2.5.3 release
  4. You are running some sort of local file indexing application that is changing the files ..

Actions for you

  1. Ensure you are running v2.5.3 or the latest client version from 'master'
  2. Do not run file indexers on your OneDrive data

@erenoglu
Copy link
Author

erenoglu commented Jan 12, 2025

Hi @abraunegg , I tested the PR and it seems to work fine. The downloaded file was kept and timestamp matched. No additional uploads. After a few file additions on both remote and local and syncing again, it seems fine as well.

As usual, if I add a local file with an old timestamp, it gets uploaded but gets a new modified timestamp (I guess Onedrive is doing this), then due to "enhancement", file is downloaded again and thus the local timestamp is lost.
Is there any way to preserve the old timestamp on the local file and remote file, ie change remote timestamp one more time after all upload download is done, ie:

  1. local file is detected, and uploaded to onedrive, timestamp cached to memory for preservation
  2. file gets a new timestamp by Onedrive
  3. file gets enhanced with onedrive "feature", still keeping new timestamp
  4. file is downloaded and overwrites the local file, local file gets new timestamp
    5)** local original timestamp is written back to the local file from cache and then onedrive is updated
    Result is local and remote files are identical using original timestamp

Not sure what the behavior of Windows Onedrive client is when uploading, I will test.

@abraunegg
Copy link
Owner

@erenoglu

As usual, if I add a local file with an old timestamp, it gets uploaded but gets a new modified timestamp (I guess Onedrive is doing this), then due to "enhancement", file is downloaded again and thus the local timestamp is lost.

Correct. Please complain to Microsoft for their 'feature'

Is there any way to preserve the old timestamp on the local file and remote file, ie change remote timestamp one more time after all upload download is done, ie:

Not really .. when you use Microsoft SharePoint as a back end, all notion of file integrity is lost because of their 'feature' to enrich the file and change it. The timestamp for the online file & its associated metadata (etag, ctag, timestamp) are also intertwined. This is why the online file is downloaded and your local file is replaced with the enriched online version, so that when the API provides all data for online, it matches what is known to be local.

Not sure what the behavior of Windows Onedrive client is when uploading, I will test.

Please let me know ..

@erenoglu
Copy link
Author

Thanks. I tested with Onedrive Windows client and the Web interface.

  1. Onedrive Windows Client: It preserves the timestamp. I synced this folder to my Windows PC and then moved an old file to the same folder. Windows explorer showed old timestamp. It synced, Web interface also showed old timestamp. Timestamp is preserved. Not sure how the Windows client is managing this.

  2. Web Interface: I uploded another old file using the web interface to my Onedrive online folder. The file lost its timestamp and got assigned a new timestamp.

I found this as well:
https://techcommunity.microsoft.com/discussions/microsoft-365/onedrive-file-timestamps/2227483

@abraunegg
Copy link
Owner

@erenoglu

I tested with Onedrive Windows client and the Web interface.

Thanks for testing. Based on this testing, I am going to leave the behavior as it is - sorry.

I will merge this PR into 'master' and mark this as fixed.

abraunegg added a commit that referenced this issue Jan 12, 2025
…oad-validation (#3064)

* When --disable-download-validation is used, we still need to set the file timestamp correctly to avoid integrity checking issues
* Implement setFileTimestamp() as a common function so that when setting a file timestamp this is done in a consistent manner
* Update debug logging to be more agnostic to support either file or directory use
* Use same function for files and directories to ensure consistency
* Update function to detail what is being set, when it is set, and when it is successful
@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 20, 2025
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
3 participants