-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Package: abcde
Version: 2.3.99-$Revision: 223 $
While playing with abcde, I noticed the range processing code is pretty
ugly, and kind of broken.
If you give abcde a "backwards" range (ie: abcde 3-1), it still counts
up, getting into a nearly endless loop.
The patch provided fixes this behavior (matching the original seq
behavior of silently dropping improper range specifications):
"Reverse" ranges are ignored
If the LHS is missing, it is assumed to be one
If the RHS is missing, the range is ignored
If there are multiple dashes, they are "collapsed"
ie:
1--234-3 is the same as 1-3 = 1 2 3
-1-234-3 is the same as -3 is the same as 1-3 = 1 2 3
1-234-3- is the same as 1- is the same as 1-0 = ignored
- --
Charles Steinkuehler
[EMAIL PROTECTED]
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.4 (MingW32)
iD8DBQFFHApUenk4xp+mH40RAjaqAJ9BIsAzVpLgcs7QDW86d359gvk6PACgv2XA
GbCvPSSnpjfg+ZKClat5LgY=
=xGka
-----END PGP SIGNATURE-----
--- abcde.svn.toc 2006-09-28 11:44:28.203700281 -0500
+++ abcde.svn.range 2006-09-28 12:43:05.189844508 -0500
@@ -3287,14 +3287,17 @@
else
while [ $# -gt 0 ]; do
# Range parsing code courtesy of Vincent Ho
- RSTART=$(echo $1 | cut -f1 -d-)
- REND=$(echo $1 | cut -f2 -d-)
- if [ "$RSTART" = "$REND" ]; then
- NEWTRACKS="$RSTART"
+ # Cleaned up to use shell built-ins by Charles Steinkuehler
+ if [ "${1#*[^0-9-]}" != "$1" ]; then
+ log error "syntax error while processing track numbers"
else
- NEWTRACKS=$(f_seq_line $RSTART $REND)
+ RSTART=${1%%-*}
+ REND=${1##*-}
+ while [ ${RSTART:=1} -le ${REND:=0} ] ; do
+ TRACKQUEUE="$TRACKQUEUE $RSTART"
+ RSTART=$(( $RSTART + 1 ))
+ done
fi
- TRACKQUEUE=$(echo "$TRACKQUEUE" "$NEWTRACKS")
shift
done
fi