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: Any time I save a text file with Geany it will soon say the copy on the disk is newer than the one in the buffer and ask if I want to re-read it. #3124

Closed
adventuretc opened this issue Feb 19, 2025 · 6 comments

Comments

@adventuretc
Copy link

adventuretc commented Feb 19, 2025

Describe the bug

Any time I save a text file with Geany it will soon say the copy on the disk is newer than the one in the buffer and (Geany) asks whether I want to re-read it or overwrite it.
Geany works by saving the file to a dummy file e.g. ".goutputstream-ABC1234" and then rename it to the original file name or something like that, to my understanding.

Operating System Details

Linux NN 5.15.0-131-generic #141~20.04.1-Ubuntu SMP Thu Jan 16 18:38:51 UTC 2025 x86_64 x86_64 x86_64 GNU/Linux

Distributor ID:	Ubuntu
Description:	Ubuntu 20.04.6 LTS
Release:	20.04
Codename:	focal

Client Installation Method

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

OneDrive Account Type

Business | Office365

What is your OneDrive Application Version

onedrive v2.5.4-1+np1+1.1

What is your OneDrive Application Configuration

User Application Config path                 = /home/xy/.config/onedrive
System Application Config path               = /etc/onedrive
Applicable Application 'config' location     = /home/xy/.config/onedrive/config
Configuration file found in config location  = true - using 'config' file values to override application defaults
Applicable 'sync_list' location              = /home/xy/.config/onedrive/sync_list
Applicable 'items.sqlite3' location          = /home/xy/.config/onedrive/items.sqlite3
Config option 'drive_id'                     = 
Config option 'sync_dir'                     = /home/xy/Dokumentumok/GDE
Config option 'enable_logging'               = true
Config option 'log_dir'                      = /dev/shm/onedrive logs/
Config option 'disable_notifications'        = true
Config option 'skip_dir'                     = .hg|.git|.git*|.idea
Config option 'skip_dir_strict_match'        = false
Config option 'skip_file'                    = ~*|.~*|*.tmp
Config option 'skip_dotfiles'                = false
Config option 'skip_symlinks'                = true
Config option 'monitor_interval'             = 600
Config option 'monitor_log_frequency'        = 12
Config option 'monitor_fullscan_frequency'   = 48
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'                 = true
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'            = 10485760000
Config option 'permanent_delete'             = false
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.4-1+np1+1.1
Config option 'force_http_11'                = true
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'          = 1
Config option 'threads'                      = 8
Config option 'max_curl_idle'                = 120
Environment var 'XDG_RUNTIME_DIR'            = false
Environment var 'DBUS_SESSION_BUS_ADDRESS'   = false
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 7.68.0 (x86_64-pc-linux-gnu) libcurl/7.68.0 OpenSSL/1.1.1f zlib/1.2.11 brotli/1.0.7 libidn2/2.2.0 libpsl/0.21.0 (+libidn2/2.2.0) libssh/0.9.3/openssl/zlib nghttp2/1.40.0 librtmp/2.3
Release-Date: 2020-01-08
Protocols: dict file ftp ftps gopher http https imap imaps ldap ldaps pop3 pop3s rtmp rtsp scp sftp smb smbs smtp smtps telnet tftp 
Features: AsynchDNS brotli GSS-API HTTP2 HTTPS-proxy IDN IPv6 Kerberos Largefile libz NTLM NTLM_WB PSL SPNEGO SSL TLS-SRP UnixSockets

Where is your 'sync_dir' located

Local

What are all your system 'mount points'

sysfs on /sys type sysfs (rw,nosuid,nodev,noexec,relatime)
proc on /proc type proc (rw,nosuid,nodev,noexec,relatime)
udev on /dev type devtmpfs (rw,nosuid,noexec,relatime,size=8004996k,nr_inodes=2001249,mode=755,inode64)
devpts on /dev/pts type devpts (rw,nosuid,noexec,relatime,gid=5,mode=620,ptmxmode=000)
tmpfs on /run type tmpfs (rw,nosuid,nodev,noexec,relatime,size=1610864k,mode=755,inode64)
/dev/sda2 on / type ext4 (rw,relatime,errors=remount-ro,stripe=32725)
securityfs on /sys/kernel/security type securityfs (rw,nosuid,nodev,noexec,relatime)
tmpfs on /dev/shm type tmpfs (rw,nosuid,nodev,inode64)
tmpfs on /run/lock type tmpfs (rw,nosuid,nodev,noexec,relatime,size=5120k,inode64)
tmpfs on /sys/fs/cgroup type tmpfs (ro,nosuid,nodev,noexec,mode=755,inode64)
cgroup2 on /sys/fs/cgroup/unified type cgroup2 (rw,nosuid,nodev,noexec,relatime,nsdelegate)
cgroup on /sys/fs/cgroup/systemd type cgroup (rw,nosuid,nodev,noexec,relatime,xattr,name=systemd)
pstore on /sys/fs/pstore type pstore (rw,nosuid,nodev,noexec,relatime)
efivarfs on /sys/firmware/efi/efivars type efivarfs (rw,nosuid,nodev,noexec,relatime)
bpf on /sys/fs/bpf type bpf (rw,nosuid,nodev,noexec,relatime,mode=700)
cgroup on /sys/fs/cgroup/cpu,cpuacct type cgroup (rw,nosuid,nodev,noexec,relatime,cpu,cpuacct)
cgroup on /sys/fs/cgroup/pids type cgroup (rw,nosuid,nodev,noexec,relatime,pids)
cgroup on /sys/fs/cgroup/devices type cgroup (rw,nosuid,nodev,noexec,relatime,devices)
cgroup on /sys/fs/cgroup/blkio type cgroup (rw,nosuid,nodev,noexec,relatime,blkio)
cgroup on /sys/fs/cgroup/hugetlb type cgroup (rw,nosuid,nodev,noexec,relatime,hugetlb)
cgroup on /sys/fs/cgroup/misc type cgroup (rw,nosuid,nodev,noexec,relatime,misc)
cgroup on /sys/fs/cgroup/rdma type cgroup (rw,nosuid,nodev,noexec,relatime,rdma)
cgroup on /sys/fs/cgroup/freezer type cgroup (rw,nosuid,nodev,noexec,relatime,freezer)
cgroup on /sys/fs/cgroup/net_cls,net_prio type cgroup (rw,nosuid,nodev,noexec,relatime,net_cls,net_prio)
cgroup on /sys/fs/cgroup/perf_event type cgroup (rw,nosuid,nodev,noexec,relatime,perf_event)
cgroup on /sys/fs/cgroup/memory type cgroup (rw,nosuid,nodev,noexec,relatime,memory)
cgroup on /sys/fs/cgroup/cpuset type cgroup (rw,nosuid,nodev,noexec,relatime,cpuset)
systemd-1 on /proc/sys/fs/binfmt_misc type autofs (rw,relatime,fd=28,pgrp=1,timeout=0,minproto=5,maxproto=5,direct,pipe_ino=19703)
hugetlbfs on /dev/hugepages type hugetlbfs (rw,relatime,pagesize=2M)
mqueue on /dev/mqueue type mqueue (rw,nosuid,nodev,noexec,relatime)
debugfs on /sys/kernel/debug type debugfs (rw,nosuid,nodev,noexec,relatime)
tracefs on /sys/kernel/tracing type tracefs (rw,nosuid,nodev,noexec,relatime)
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)
/var/lib/snapd/snaps/termdown_8.snap on /snap/termdown/8 type squashfs (ro,nodev,relatime,errors=continue,x-gdu.hide)
binfmt_misc on /proc/sys/fs/binfmt_misc type binfmt_misc (rw,nosuid,nodev,noexec,relatime)
/dev/sda3 on /boot/efi type vfat (rw,relatime,fmask=0077,dmask=0077,codepage=437,iocharset=iso8859-1,shortname=mixed,errors=remount-ro)
/dev/sda1 on /home type ext4 (rw,relatime,stripe=32743)

What are all your local file system partition types

sda                                                                                     
├─sda1 ext4     perHOME             dc4c181d-9af6-41a7-8df5-08faf9a20d33   78.4G    85% /home
├─sda2 ext4     lubuntu             53bb6f3e-cfe3-487a-a625-3dec949622ba   24.9G    76% /
├─sda3 vfat     ESP                 9EDC-8870                             543.9M     1% /boot/efi
└─sda4 ntfs     Windows_Linux_Kozos 7AA7DE113FEBFBA7                       13.9G    38% /home/xy/Dokumentumok/GDEv2
sdb                                                                                     
├─sdb1 ext4     250GB-os SSD OS     0699e041-825d-496d-b449-22bc526e8aae                
├─sdb2 ntfs                         CC00ACDF00ACD1AE                                    
├─sdb3 vfat                         612B-99E1                                           
├─sdb4 ext4                         0d8cc466-20a8-470f-916e-f4124591147d                
├─sdb5 ntfs     windows10           C692C2BE92C2B1EB                                    
└─sdb6 vfat     ESP                 B056-3328

How do you use 'onedrive'

I use onedrive on my Linux desktop computer.

Steps to reproduce the behaviour

Create a text file. Modify it with Geany. Then, open the text file from a file manager again. The problem should appear.
The bug doesn't arise when onedrive is not running.

Complete Verbose Log Output

[2025-Feb-19 10:17:17.8441499] Sync with Microsoft OneDrive is complete
[2025-Feb-19 10:24:31.1694741] [M] Local item moved: Tantárgyak, Előrehaladásom/.goutputstream-4RS912 -> Tantárgyak, Előrehaladásom/szakértelem a NMS-ből való tananyaglementésről.d
[2025-Feb-19 10:24:31.1695418] Moving Tantárgyak, Előrehaladásom/.goutputstream-4RS912 to Tantárgyak, Előrehaladásom/szakértelem a NMS-ből való tananyaglementésről.d
[2025-Feb-19 10:24:31.1701479] Moved local item was not in-sync with local database - uploading as new item
[2025-Feb-19 10:24:31.1707655] [M] Local file changed: Tantárgyak, Előrehaladásom/szakértelem a NMS-ből való tananyaglementésről.d
[2025-Feb-19 10:24:32.0288929] Uploading modified file: Tantárgyak, Előrehaladásom/szakértelem a NMS-ből való tananyaglementésről.d ... done
[2025-Feb-19 10:24:32.0475586] [M] Total number of local file(s) added or changed: 1

Screenshots

No response

Other Log Information or Details

Additional context

No response

@adventuretc adventuretc added the Bug Something isn't working label Feb 19, 2025
@abraunegg abraunegg added Not a bug and removed Bug Something isn't working labels Feb 19, 2025
@abraunegg
Copy link
Owner

@adventuretc
FYI - this is the same as #3110

This is technically not a bug - sorry.

When you upload data to Microsoft OneDrive, the Microsoft API changes your file including timestamp.

To ensure that what is online, is what is local, and to ensure values align this is why the local file timestamp is updated to reflect that online.

That your application reports the file has changed is probably the actual issue. The content has not changed, the timestamp has ....

Please raise a bug against 'Geany' as they need to implement a better method of file modification detection.

@adventuretc
Copy link
Author

adventuretc commented Feb 19, 2025

@abraunegg

When you upload data to Microsoft OneDrive, the Microsoft API changes your file including timestamp.

I disagree with how this is implemented in the client. The local file should be left as is and considered equivalent to the one online if the timestamp is within the whatever range Microsoft decides to modify it. No need to age the disk or change files, from my understanding. Am I missing something?
Thanks.

@adventuretc
Copy link
Author

To ensure that what is online, is what is local, and to ensure values align this is why the local file timestamp is updated to reflect that online.

When the files are the same by their contents, what is online is already what is local by your definition of modification checking that you want Geany to set up to.

@abraunegg
Copy link
Owner

abraunegg commented Feb 19, 2025

I disagree with how this is implemented in the client. The local file should be left as is and considered equivalent to the one online if the timestamp is within the whatever range Microsoft decides to modify it. No need to age the disk or change files, from my understanding. Am I missing something?

Lets break this question down.

You are using 'Business | Office365' which means by default your account type when running the application should be 'business' - the API derives this. You can also validate this by the length of your default driveId. If this is 16 characters in length then this is a 'personal' account type and not a 'business' account type. The account type is super important here. You can run the client in verbose mode --verbose to see all of these extended information values.

Microsoft, in their wisdom, back end all 'business' accounts with Microsoft SharePoint. This technology stack has an awesome 'feature' (bug) that modifies your file post upload - and there is zero capability to disable this. To help you understand this 'feature' please read OneDrive/onedrive-api-docs#935 . In this situation your 'file' is 100% different online to local.

Now, if your account type is 'personal' (again, you may think you are business | office365 .. but what does the API report it as) ... at least you are not forced with the above SharePoint 'feature', however the way that the graph API works for 'personal' accounts is that when a file is uploaded a new 'version' of the file is created, and, that creation process makes the new file with your data have a new timestamp.

Now .. depending on how the file is uploaded, the upload mechanism is different. For small files (<4Mb) you must use the simple upload method. For files >4 you must upload via a session:

When you use the simple method, the expectation is that the file that you upload, is stored by the Microsoft OneDrive platform - and it is, but a new version is created, with a new timestamp.

When you use the session method, you can provide the timestamp to use, and the client does this, however, when a new file version is created, the Microsoft OneDrive platform again changes the timestamp provided.

In the response JSON from Microsoft OneDrive, this then provides both the new hash of the file online + the new online timestamp.

The client then evaluates this data and makes a number of decisions:

  • Change local time stamp if required
  • Download the enriched file if required

The client does this to ensure that your data locally matches what is online, so that the client, when reading the Graph API data to determine if anything has changed, can accurately process online changes to bring down to your system.

Without doing this, the client will always assume your local files are out-of-date or are potentially older that is what stored online .. thus you may get into a data loss scenario which is not something anyone would like.

Whilst you may find this to be annoying - it is the application you are using to edit your files that is being overly sensitive on how it detects changed files. If you are using a 'business' account and your application is looking at metadata for change - then yes maybe this is actually factually correct due to the SharePoint feature you cannot turn off .... or .. it is simply watching the changed timestamp which is going to be problematic.

You can also disable integrity checking to disable how the client handles these online features. Please read:

[2025-Feb-19 10:17:17.8441499] Sync with Microsoft OneDrive is complete
[2025-Feb-19 10:24:31.1694741] [M] Local item moved: Tantárgyak, Előrehaladásom/.goutputstream-4RS912 -> Tantárgyak, Előrehaladásom/szakértelem a NMS-ből való tananyaglementésről.d
[2025-Feb-19 10:24:31.1695418] Moving Tantárgyak, Előrehaladásom/.goutputstream-4RS912 to Tantárgyak, Előrehaladásom/szakértelem a NMS-ből való tananyaglementésről.d
[2025-Feb-19 10:24:31.1701479] Moved local item was not in-sync with local database - uploading as new item
[2025-Feb-19 10:24:31.1707655] [M] Local file changed: Tantárgyak, Előrehaladásom/szakértelem a NMS-ből való tananyaglementésről.d
[2025-Feb-19 10:24:32.0288929] Uploading modified file: Tantárgyak, Előrehaladásom/szakértelem a NMS-ből való tananyaglementésről.d ... done
[2025-Feb-19 10:24:32.0475586] [M] Total number of local file(s) added or changed: 1

Firstly I would see if your application can use /tmp or similar for temporary files

If this is not possible, then configure a 'skip_file' rule to skip these temporary file types if possible.

When the files are the same by their contents, what is online is already what is local by your definition of modification checking that you want Geany to set up to.

You need to ensure that 'Geany' is doing some sort of hash check rather than a timestamp check.

@adventuretc
Copy link
Author

Thank you. Now I understand.
I indeed have a business type drive ID but it must have been the timestamp that I "noticed".
By the way, have you considered circumventing the enrichment via the upload-then-rename method mentioned in OneDrive/onedrive-api-docs#935 ?

@abraunegg
Copy link
Owner

Thank you. Now I understand. I indeed have a business type drive ID but it must have been the timestamp that I "noticed". By the way, have you considered circumventing the enrichment via the upload-then-rename method mentioned in OneDrive/onedrive-api-docs#935 ?

Unfortunately you cannot circumvent that SharePoint feature. If you walk through what happens to your file on SharePoint you will understand why circumvention is not possible.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants