Package: mp3rename
Version: 0.6-9
Severity: normal
Tags: patch

For some reason mp3rename opens files RDWR. I don't see why it does
this, as it is not going to change the content of a file.

open("www.archive.org_download_gd70_01_02.early_late.sbd.cotsman.18120.sbeok.shnf_gd70_01_02d1t01_vbr.mp3",
 O_RDWR) = 3
fstat(3, {st_mode=S_IFREG|0644, st_size=1633024, ...}) = 0
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 
0x7fde14544000
read(3, "ID3\3\0\0\0\0\0xTIT2\0\0\0\31\0\0\0Zarathustra"..., 4096) = 4096
fstat(3, {st_mode=S_IFREG|0644, st_size=1633024, ...}) = 0
lseek(3, 1630208, SEEK_SET)             = 1630208
read(3, 
"3\243\31(\342\3210X=\332\10\341\16(Y\250\247\0t\372\320stW\276=\377\10\33n\251Y"...,
 4096) = 2816
fstat(3, {st_mode=S_IFREG|0644, st_size=1633024, ...}) = 0
lseek(3, 1633024, SEEK_SET)             = 1633024
fstat(3, {st_mode=S_IFREG|0644, st_size=1633024, ...}) = 0
lseek(3, 1633024, SEEK_SET)             = 1633024
close(3)                                = 0
munmap(0x7fde14544000, 4096)            = 0
rename("www.archive.org_download_gd70_01_02.early_late.sbd.cotsman.18120.sbeok.shnf_gd70_01_02d1t01_vbr.mp3",
 "(Grateful Dead)-Zarathustra introduction.mp3") = 0

This is particularly annoying when using git-annex, or I suppose
anything else that removes the write bit from files.

Ok, seems that -f and -a modify the file to add a new tag.
So, I suggest this patch:

diff -ur x/mp3rename-0.6/mp3rename.c mp3rename-0.6/mp3rename.c
--- x/mp3rename-0.6/mp3rename.c 2014-12-05 22:02:10.000000000 -0400
+++ mp3rename-0.6/mp3rename.c   2014-12-05 21:59:19.509943882 -0400
@@ -99,7 +99,12 @@
  char title[31]="", artist[31]="", album[31]="", year[5]="", comment[31]="", 
fbuf[4], 
newfilename[160]="",nieuw[150]="",dir[150]="",dirsource[200],fullline[228]="", 
burnname[29]="", track; 
   plaatsen = 0;
 
-  if ( !( fp=fopen(*argv,"rb+") ) )    /* If the file doesn exist */
+  char mode[4];
+  if ((forced) || (all))
+    sprintf(mode, "rb+");
+  else
+    sprintf(mode, "rb");
+  if ( !( fp=fopen(*argv,mode) ) )    /* If the file doesn exist */
   {
      perror("Error opening file");
      ++argv;                         /* Prepare for the next file */ 

Attachment: signature.asc
Description: Digital signature

Reply via email to