Subject: pkg/13526: Bug in pkgsrc/audio/shorten
To: None <gnats-bugs@gnats.netbsd.org>
From: None <entropy@tappedin.com>
List: netbsd-bugs
Date: 07/21/2001 14:53:57
>Number:         13526
>Category:       pkg
>Synopsis:       shorten will truncate output filenames when extracting
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    pkg-manager
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sat Jul 21 11:51:00 PDT 2001
>Closed-Date:
>Last-Modified:
>Originator:     maximum entropy
>Release:        <NetBSD-current source date>20010720
>Organization:
entropy -- it's not just a good idea, it's the second law.
>Environment:
	
System: NetBSD zippy.local 1.5W NetBSD 1.5W (ZIPPY) #2: Tue Jul 17 01:30:03 EDT 2001 entropy@zippy.local:/usr/src/sys/arch/i386/compile/ZIPPY i386
Architecture: i386
Machine: i386
>Description:
	

When shorten extracts an audio file, it generates an output filename based on
the inout filename.  There are two cases:
filename.shn -> filename.wav
filename.wav.shn -> filename.wav

The logic goes like this:

Take the input filename:  filename.shn

Remove 4 characters (the length of ".shn") from the filename.
This produces:  filename

Does the new name end in ".wav"?
If so, do nothing.
If not, first remove 4 characters (the length of ".wav") from the filename.
This produces:  file
Second, append ".wav" to the filename.
This produces: file.wav

Clearly this is wrong, and the second truncation by 4 characters shouldn't be
performed.  all that's needed to correctly produce "filename.wav" from
"filename" is to just tack the ".wav" onto the end.


>How-To-Repeat:
	

$ shorten -x filename.shn
# ls -l

Then notice that file.wav is produced instead of filename.wav

>Fix:
	

Add a new package patchfile to remove the offending truncation:

Index: distinfo
===================================================================
RCS file: /cvsroot/pkgsrc/audio/shorten/distinfo,v
retrieving revision 1.2
diff -u -u -r1.2 distinfo
--- distinfo	2001/04/18 12:14:37	1.2
+++ distinfo	2001/07/21 18:35:58
@@ -5,3 +5,4 @@
 SHA1 (patch-aa) = eeb637249df8eb5a28018ada92a7e270c8c40ba7
 SHA1 (patch-ab) = ed8ce4a276bf6250600cb6e5559400295d14ed7e
 SHA1 (patch-ac) = c82529b4c1824a1be80834d018782b70dfa17f0d
+SHA1 (patch-ad) = a7adfbfd24c4f214739e2a07f7df8f03ab026c2a
--- /dev/null	Sat Jul 21 14:33:38 2001
+++ patches/patch-ad	Sat Jul 21 14:25:19 2001
@@ -0,0 +1,12 @@
+$NetBSD$
+
+--- shorten.c.orig	Tue Oct 10 13:14:47 2000
++++ shorten.c	Sat Jul 21 14:24:39 2001
+@@ -669,7 +669,6 @@
+       	  if(strcasecmp(filenamei + newfilelen, WAVESUFFIX))
+ 	#endif
+           {
+-            tmpfilename[newfilelen] = '\0';
+ 	    strcat(tmpfilename,".wav");
+           }
+     	}
>Release-Note:
>Audit-Trail:
>Unformatted: