Summary: | When saving the file, I am always warned that file has changed in disk | ||
---|---|---|---|
Product: | [Applications] KBibTeX | Reporter: | Nicolas Vaughan <nivaca> |
Component: | Loading/saving files | Assignee: | Thomas Fischer <fischer> |
Status: | RESOLVED FIXED | ||
Severity: | normal | ||
Priority: | NOR | ||
Version: | 0.8.1 | ||
Target Milestone: | --- | ||
Platform: | Arch Linux | ||
OS: | Linux | ||
Latest Commit: | https://commits.kde.org/kbibtex/f959986e4c582f24c492c96d2022c50b52cfc62b | Version Fixed In: | 0.8.2 |
Sentry Crash Report: | |||
Attachments: |
screenshot
Delay resume watching a file for modifications after saving said file Patch to part.cpp New Archi Linux PKGBUILD, modified to run patch file. |
Created attachment 113931 [details] Delay resume watching a file for modifications after saving said file I suspect the problem you observe is due to the file's location in a directory synchronized via DropBox (visible in the screenshot). This patch introduces a 500 milliseconds delay between saving a file and resuming watching it for external modifications. Please test if this patch fixes your problem. Also, try different time values to find a "sweet spot" when it starts/stops working. I recommend to apply this patch by building an ArchLinux package based on the original PKGBUILD file: https://git.archlinux.org/svntogit/community.git/tree/trunk/PKGBUILD?h=packages/kbibtex Please check the official ArchLinux documentation on how to apply a patch inside a PKGBUILD file. Hi Thomas, Thanks for your reply. The patch works perfectly. (I had some trouble patching and compiling the Arch package, but in the end everything worked fine.) (In reply to Nicolas Vaughan from comment #2) > Hi Thomas, > Thanks for your reply. The patch works perfectly. (I had some trouble > patching and compiling the Arch package, but in the end everything worked > fine.) Sounds good! One more question: my patch uses an arbitrarily chosen delay of 500ms. Does the patch work as well with a delay of, say, 50ms? Please test some vales between 5 and 500 to find the "breaking point". Created attachment 113953 [details]
Patch to part.cpp
This is Thomas' original patch for part.cpp.
Created attachment 113954 [details]
New Archi Linux PKGBUILD, modified to run patch file.
To create an Arch Linux package which incorporates the patch, do as follows: 1. Clone the Arch AUR repo: git clone https://aur.archlinux.org/kbibtex-git.git 2. CD into the directory: cd kbibtex-git 3. Replace original PKGBUILD with the one I have attached here. 4. Copy the patch file part.patch into the directory. 5. Create the package: makepkg -s (or, if you want to install it immediately: makepkg -si) 6. Install the package: sudo pacman -U kbibtex-git-r2888.5d462666-1-x86_64.pkg.tar (or whatever the resulting package name is). The changes I made in PKGBUILD are just two lines at the beginning of the prepare() function: prepare() { cd .. patch "$srcdir"/kbibtex/src/parts/part.cpp part.patch cd "$srcdir" mkdir build } Git commit f959986e4c582f24c492c96d2022c50b52cfc62b by Thomas Fischer. Committed on 18/07/2018 at 18:34. Pushed by thomasfischer into branch 'kbibtex/0.8'. DropBox-synchronized folders no longer cause 'reload' messages It is strongly suspected that when saving a file in a folder synchronized via DropBox, the DropBox client modifies(*) the file right after it was saved in KBibTeX, causing KBibTeX to ask the user if the file was to be reloaded or on-disk changes to be ignored. By delaying resuming watching a local file after it has been saved to disk by 500ms, this problem is no longer apparent. (*) The file's content does not seem to be changed, but some filesystem metadata may get touched/modified, triggering the file watching service. FIXED-IN: 0.8.2 M +12 -4 src/parts/part.cpp https://commits.kde.org/kbibtex/f959986e4c582f24c492c96d2022c50b52cfc62b Git commit acac51d20183f6b853223602f0cda4524a3502b6 by Thomas Fischer. Committed on 18/07/2018 at 18:40. Pushed by thomasfischer into branch 'master'. DropBox-synchronized folders no longer cause 'reload' messages It is strongly suspected that when saving a file in a folder synchronized via DropBox, the DropBox client modifies(*) the file right after it was saved in KBibTeX, causing KBibTeX to ask the user if the file was to be reloaded or on-disk changes to be ignored. By delaying resuming watching a local file after it has been saved to disk by 500ms, this problem is no longer apparent. (*) The file's content does not seem to be changed, but some filesystem metadata may get touched/modified, triggering the file watching service. This commit was cherry-picked from branch 'kbibtex/0.8', commit f959986e4c582f24c4. M +12 -4 src/parts/part.cpp https://commits.kde.org/kbibtex/acac51d20183f6b853223602f0cda4524a3502b6 |
Created attachment 113848 [details] screenshot Even if I have not changed the file with another application, I always get a dialogue saying that it has been changed.