Package: vorbisgain Version: 0.36-3 Severity: grave Tags: patch Vorbisgain writes updated tags to an Ogg file by first creating a temporary file, "vorbisgain.tmp" in the same directory as the Ogg file, writing the updated metadata to it, deleting the Ogg file, and renaming "vorbisgain.tmp" to the the Ogg file's name.
When two or more vorbisgain processes operate on different files in the same directory, this means that they try to use the same temporary file, and do not "discover" this until they have deleted the Ogg files, causing them to be lost. For example, executing the following (with "DON'T_RUN" removed), to achieve a speed-up on an SMP system, in a directory with many Ogg files, will cause some of them to be lost and others to be renamed, even though each vorbisgain run gets a different file on which to work: $ find -iname '*.ogg' -print0 | xaDON'T_RUNrgs -0 -P 4 -n 1 vorbisgain -s -c The attached patch to vorbis.c changes the temporary file naming scheme to use the name of the Ogg file with ".vgain.tmp" appended. -- System Information: Debian Release: lenny/sid APT prefers testing APT policy: (990, 'testing'), (500, 'unstable'), (1, 'experimental') Architecture: i386 (x86_64) Kernel: Linux 2.6.26-1-amd64 (SMP w/2 CPU cores) Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8) Shell: /bin/sh linked to /bin/dash Versions of packages vorbisgain depends on: ii libc6 2.7-15 GNU C Library: Shared libraries ii libogg0 1.1.3-4 Ogg Bitstream Library ii libvorbis0a 1.2.0.dfsg-3.1 The Vorbis General Audio Compressi ii libvorbisfile3 1.2.0.dfsg-3.1 The Vorbis General Audio Compressi vorbisgain recommends no packages. vorbisgain suggests no packages. -- no debconf information
59c59 < #define TEMP_NAME "vorbisgain.tmp" --- > #define TEMP_EXT ".vgain.tmp" 687,689c687,688 < /* Make sure temp is in same folder as file. And yes, the malloc is larger < * than necessary (and not always needed). Lets keep it simple though (at < * the expense of a few bytes)... --- > /* Construct a temporary file name by appending TEMP_EXT to > * the name of the file being modified. 691c690 < temp_name = malloc(strlen(filename) + sizeof(TEMP_NAME)); --- > temp_name = malloc(strlen(filename) + sizeof(TEMP_EXT)); 700c699 < strcpy((char *) last_path(temp_name), TEMP_NAME); --- > strcat(temp_name, TEMP_EXT); 810c809 < if (remove(TEMP_NAME) != 0) --- > if (remove(temp_name) != 0) 813c812 < TEMP_NAME); --- > temp_name);