After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 721351 - Truncates Ogg files files with multiple links when saving tags
Truncates Ogg files files with multiple links when saving tags
Status: RESOLVED FIXED
Product: easytag
Classification: Other
Component: general
master
Other Linux
: Normal normal
: 2.1
Assigned To: EasyTAG maintainer(s)
EasyTAG maintainer(s)
Depends on:
Blocks:
 
 
Reported: 2014-01-02 17:21 UTC by Mikael Magnusson
Modified: 2014-03-19 07:41 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
This patch will first write data to GMemoryOutputStream and then to file. (7.50 KB, patch)
2014-03-18 06:55 UTC, Abhinav
needs-work Details | Review
This patch will first write data to GMemoryOutputStream and then to file. (7.57 KB, patch)
2014-03-18 10:01 UTC, Abhinav
committed Details | Review

Description Mikael Magnusson 2014-01-02 17:21:20 UTC
To reproduce, make an extra hardlink of any .ogg file, edit the tags and filename (i didn't try which operation does it) in easytag and save the file, marvel at the lost data.

The resulting files have all the tags but are about 6-8kB and contain no audio data.
Comment 1 David King 2014-03-08 18:08:43 UTC
I can reproduce this in master:

1. created a hard link to an Ogg file
2. opened the directory containing both files in EasyTAG
3. edited the tags of one of the files, and saved the changes

Renaming works fine, but saving the tags causes the file to be truncated.
Comment 2 Abhinav 2014-03-18 06:55:59 UTC
Created attachment 272244 [details] [review]
This patch will first write data to GMemoryOutputStream and then to file.
Comment 3 David King 2014-03-18 07:59:15 UTC
Review of attachment 272244 [details] [review]:

Looks fine, just a couple of leaks. I have not run Valgrind with your patch applied, so it would be a good idea to do that before resubmitting.

::: src/vcedit.c
@@ +797,2 @@
     if (error == NULL || *error != NULL)
         return FALSE;

As you moved the g_object_unref() further down, you need to also unref before returning here.

@@ +817,3 @@
+       g_object_unref (ostream);
+       g_assert (error == NULL || *error != NULL);
+       return FALSE;

You also need to free "buf" here.
Comment 4 Abhinav 2014-03-18 10:01:53 UTC
Created attachment 272260 [details] [review]
This patch will first write data to GMemoryOutputStream and then to file.

Fixed two leaks.
I did run valgrind and I didn't find any memory leak related to vcedit_write.
Comment 5 David King 2014-03-19 07:40:50 UTC
Comment on attachment 272260 [details] [review]
This patch will first write data to GMemoryOutputStream and then to file.

I pushed a slightly-reformatted version of the patch to master as commit a27a8fe8cbd12dac86f0e615fbda068f8bdd4a10.