Fix for diskutil selecting wrong disk on OS X
authorAndrew Strong <andrew.david.strong@gmail.com>
Tue, 14 Apr 2015 09:11:12 +0000 (19:11 +1000)
committerAndrew Strong <andrew.david.strong@gmail.com>
Tue, 14 Apr 2015 09:11:12 +0000 (19:11 +1000)
On OS X after inserting an audio cd if a USB disk was connected
abcde will think the USB disk is the audio CD. Thanks to Richard
for the fix which closes Issue 139.

abcde
changelog

diff --git a/abcde b/abcde
index aca289d..557ea4a 100755 (executable)
--- a/abcde
+++ b/abcde
@@ -3482,7 +3482,7 @@ fi
 if [ "$CDROM" = "" ] ; then
        if [ -e /dev/cdroms/cdrom0 ]; then
                CDROM=/dev/cdroms/cdrom0
-       elif [ "$OSFLAVOUR" = "OSX" ] && [[ $(diskutil list) =~ CD_part.*(disk.)$'\n' ]]; then
+       elif [ "$OSFLAVOUR" = "OSX" ] && [[ $(diskutil list) =~ CD_part[^/]*(disk.)$'\n' ]]; then
                CDROM=/dev/${BASH_REMATCH[1]}
        elif [ -e /dev/cdrom ]; then
                CDROM=/dev/cdrom
index e2d6ae8..eabca73 100644 (file)
--- a/changelog
+++ b/changelog
@@ -1,5 +1,7 @@
 abcde 2.6.1
 
+  * Fix for diskutil selecting wrong disk on OS X. Thanks
+    to Richard for this fix which closes Issue 139.
   * Added some error checking and documentation for
     the abcde-musicbrainz-tool. Thanks yet again to
     Matthias Andree for this work! Closes issue 138.