Bug 473937

Summary: Kid3 3.9.4 MacOS (universal build): Udate of flac files on Network drive leads to deletion of some files
Product: [Applications] kid3 Reporter: dm.bitbucket
Component: generalAssignee: Urs Fleisch <ufleisch>
Status: RESOLVED NOT A BUG    
Severity: normal    
Priority: NOR    
Version: 3.9.x   
Target Milestone: ---   
Platform: Other   
OS: macOS   
Latest Commit: Version Fixed In:
Sentry Crash Report:
Attachments: short video on issue

Description dm.bitbucket 2023-08-30 10:50:40 UTC
SUMMARY
***
Using Kid3 v. 3.9.4 for MacOs (universal build) and trying to change tags for flac files on a network drive (eg. Files lying on a NAS) then when saving the changes, Kid3 does delete some of the files in the updating process.
Please verify this behaviour. (I also observed this with the specific ARM build version)
I have gone back to 3.9.3 where files on a network folder are updated correctly without deletions
***


STEPS TO REPRODUCE
1. MacOS (Ventura 13.5.1): Open Folder with flac music files on Network drive. Open Kid3
2. Drag flac files into Kid3 (from Finder) and do changes/updates to Tag 2 settings
3. Save the changes in KID3

OBSERVED RESULT
In the KID3 tag update process of the flac files on the network folder (when they are accessed) some of them will eventually get deleted

EXPECTED RESULT
No files should get deleted through upating tag information on the network folder.
Updating flac files on the local ssd drive get tagged correctly without deletions

SOFTWARE/OS VERSIONS
Windows: 
macOS: Venture 13.5.1
Linux/KDE Plasma: 
(available in About System)
KDE Plasma Version: 
KDE Frameworks Version: 
Qt Version: 

ADDITIONAL INFORMATION
Comment 1 Urs Fleisch 2023-08-30 13:30:09 UTC
FLAC is supported by both libFLAC++ and TagLib. Which one is used depends on the metadata plugins used. If you go to the "Plugins" tab in the preferences, is "OggFlacMetadata" checked and above "TaglibMetadata"? In this case libFLAC++ is used, otherwise, TagLib is used (if "TaglibMetadata" is checked). Could you tell me which library was used and try if the problems also happen with the other library?
Comment 2 dm.bitbucket 2023-08-30 19:46:57 UTC
(In reply to Urs Fleisch from comment #1)
> FLAC is supported by both libFLAC++ and TagLib. Which one is used depends on
> the metadata plugins used. If you go to the "Plugins" tab in the
> preferences, is "OggFlacMetadata" checked and above "TaglibMetadata"? In
> this case libFLAC++ is used, otherwise, TagLib is used (if "TaglibMetadata"
> is checked). Could you tell me which library was used and try if the
> problems also happen with the other library?

Hi Urs,
I didn't chance anything here. So the default (?) settings were used, so it is both checkmarks for "OggFlacMetadata" and "TaglibMetadata" are active.
I did install 3.9.4 again (kid3-3.9.4-Darwin-amd64.dmg) and recorded a video, which I have attached.
It does show that from 11 files after a tag update only 8 do remain.
Comment 3 dm.bitbucket 2023-08-30 19:54:21 UTC
Created attachment 161291 [details]
short video on issue

short video on issue
Comment 4 Urs Fleisch 2023-08-31 09:34:29 UTC
Thanks for the video. As you can see in it, the files which are deleted are temporarily renamed to a file with a ".metadata_edit" suffix, but not restored afterwards. The code doing this is not in Kid3, but in libflac, see https://github.com/xiph/flac/blob/31ccd3df31f912bac76e669c2fbf347adf2bf235/src/libFLAC/metadata_iterators.c#L3402C41-L3402C54. I also did not change the FLAC code between version 3.9.3 and 3.9.4, only updated libflac from version 1.3.4 to 1.4.2 and build it without asserts to avoid aborting the application when an assert fails in libflac. So it is possible that this bug was introduced in libflac. Could you try to check if the problem also occurs when using `metaflac`, which is a command line program which comes which libflac. If it also happens there, you should report a bug for libflac.

Concerning working with FLAC files using Kid3: Could you please check if it works if you uncheck "OggFlacMetadata" and then restart Kid3? In this case, TagLib is used for FLAC files.
Comment 5 dm.bitbucket 2023-09-05 10:49:44 UTC
Hi Urs, I did try with unchecked "OggFlacMetadata" only with "TaglibMetadata" and it did work. 
However, I have also been retesting with "OggFlacMetadata" flagged and I could not reproduce the error again (this time)
Either way, I think you can close the issue as you said it's not Kid3's fault but rather one of libflac.