Package: abcde
Version: 2.5.1-1

The fix for upstream issue 27 unfortunately broke one of the most
endearing features of abcde and the fact it's written in shell---that
it lets you define shell functions in the configuration file and
use them the sub-programs.  For example, until recently, I was able to
do this in my .abcde.conf:

CDDBTOOL=cddb-tool-nogenre
cddb-tool-nogenre () { cddb-tool "$@" | grep -v ^CDGENRE; }

Which lets me throw away the whole idea of genre so metaflac (in my
case I only rip to flac) doesn't bother with it (because really, genre
is a stupid concept that nobody agrees on anyway).


Now, obviously this is an upstream bug, but I refuse to use an issue
tracker that requires a google account.  I've attached a patch for the
problem.  Note that the Debian package hint logic in checkexec() is
fundamentally broken in a few ways (there's no such file as
/etc/debian_release, $MISSING_PACKAGE ends up undefined for all but 3
programs, etc.) but this patch makes no attempt to fix that (becuase
honestly, the best fix is just to remove all the hint logic entirely,
the concept is unmaintainable; but that's a completely different issue).

-- 
Jamie Heilman                     http://audible.transient.net/~jamie/
--- abcde.orig	2012-05-18 09:36:21.083695541 +0000
+++ abcde	2012-05-18 11:17:03.153289133 +0000
@@ -339,12 +339,12 @@
 
 new_checkexec ()
 {
-	if [ ! "$@" = "" ]; then
-		# Cut off any command-line option we added in
-		X=$(echo $@ | cut -d' ' -f2)
-		if [ "$(which $X)" = "" ]; then
+	local X
+	if [ "X$1" != 'X' ]; then
+		X=`command -v "$1" 2>/dev/null`
+		if [ "X$X" = 'X' ]; then
 			return 1
-		elif [ ! -x $(which $X) ]; then
+		elif [ `expr "X$X" : 'X/'` -eq 2 ] && [ ! -x "$X" ]; then
 			return 2
 		fi
 	fi
@@ -353,23 +353,21 @@
 
 checkexec ()
 {
-	if [ ! "$@" = "" ]; then
-		# Cut off any command-line option we added in
-		X=$(echo $@ | cut -d' ' -f2)
-		# Test for built-in abcde.function
-		[ "$X" != "${X#abcde.}" ] && type $X >/dev/null 2>&1 && return
-		if [ "$(which $X)" = "" ]; then
-			log error "$X is not in your path." >&2
+	local X
+	if [ "X$1" != 'X' ]; then
+		X=`command -v "$1" 2>/dev/null`
+		if [ "X$X" = 'X' ]; then
+			log error "$1 is not in your path." >&2
 			log info  "Define the full path to the executable if it exists on your system." >&2
 			if [ -e /etc/debian_release ] ; then
-				case $X in
+				case $1 in
 					oggenc) 	MISSING_PACKAGE=vorbis-tools ;;
-					lame|flac)	MISSING_PACKAGE=$X ;;
+					lame|flac)	MISSING_PACKAGE=$1 ;;
 				esac
 				log info "Hint: apt-get install $MISSING_PACKAGE" >&2
 			fi
 			exit 1
-		elif [ ! -x "$(which $X)" ]; then
+		elif [ `expr "X$X" : 'X/'` -eq 2 ] && [ ! -x "$X" ]; then
 			log error "$X is not executable." >&2
 			exit 1
 		fi

Reply via email to