Skip to content

Patches to run whipper on FreeBSD #686

@ulu

Description

@ulu

I tried whipper on FreeBSD but find some hard-dependencies to Linux in the implementation which lead to error messages. I used:

dvl@mybsd:~ % uname -or
FreeBSD 15.0-RELEASE-p5

(venv) dvl@mybsd:~/Music/rip % whipper --version
whipper 0.10.1.dev65+g71251a0b8

Some of the developers can use these patches which let whipper run on FreeBSD 15 :

For /whipper/common/drive.py

--- /tmp/drive.py.orig	2026-04-13 19:30:29.243000476 +0000
+++ /tmp/drive.py.new	2026-04-13 19:30:29.289000476 +0000
@@ -19,6 +19,7 @@
 # along with whipper.  If not, see <http://www.gnu.org/licenses/>.
 
 import os
+import platform
 from fcntl import ioctl
 
 import logging
@@ -93,6 +94,13 @@
     :rtype: int
     """
     fd = os.open(drive_path, os.O_RDONLY | os.O_NONBLOCK)
-    rc = ioctl(fd, 0x5326)  # AKA 'CDROM_DRIVE_STATUS'
-    os.close(fd)
+    try:
+        if platform.system() == 'Linux':
+            rc = ioctl(fd, 0x5326)  # AKA 'CDROM_DRIVE_STATUS'
+        else:
+            logger.debug('CDROM_DRIVE_STATUS ioctl not supported on this '
+                         'platform, assuming disc present')
+            rc = 0  # CDS_NO_INFO: not implemented, whipper will proceed
+    finally:
+        os.close(fd)
     return rc
--- a/whipper/program/utils.py
+++ b/whipper/program/utils.py
@@ -1,5 +1,6 @@
 import os
+import platform
 import subprocess
 
@@ -38,6 +39,9 @@
     device = os.path.realpath(device)
     logger.debug('possibly unmount real path %r', device)
-    proc = open('/proc/mounts').read()
-    if device in proc:
-        print('Device %s is mounted, unmounting' % device)
-        os.system('umount %s' % device)
+    if platform.system() == 'Linux':
+        proc = open('/proc/mounts').read()
+        if device in proc:
+            print('Device %s is mounted, unmounting' % device)
+            os.system('umount %s' % device)
+    else:
+        logger.debug('skipping unmount check, if not on Linux')

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions