After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 134276 - cdda-method.c does not build under NetBSD
cdda-method.c does not build under NetBSD
Product: gnome-vfs
Classification: Deprecated
Component: Build
cvs (head)
Other All
: High major
: ---
Assigned To: gnome-vfs maintainers
gnome-vfs maintainers
Depends on:
Reported: 2004-02-13 00:04 UTC by Julio Merino
Modified: 2006-04-21 14:10 UTC
See Also:
GNOME target: ---
GNOME version: 2.11/2.12

Sample patch for cdda-method.c (1.23 KB, patch)
2004-02-13 00:04 UTC, Julio Merino
needs-work Details | Review
Updated patch (1.55 KB, patch)
2005-10-02 18:42 UTC, Julio Merino
none Details | Review
Patch to automatically detect FreeBSD-specific cdparanoia changes (3.68 KB, patch)
2006-03-31 10:54 UTC, Julio Merino
none Details | Review

Description Julio Merino 2004-02-13 00:04:10 UTC
cdda-method.c has a (preprocessor) conditional that checks for Linux and 
for FreeBSD.  If the system is anything else, the build will fail (this 
includes NetBSD and others), as it will find an unbalanced if/else. 
Inspecting cdparanoia's headers, I found this in the cdrom_drive 
#ifndef __FreeBSD__ 
  char *cdda_device_name; 
  char *ioctl_device_name; 
  int cdda_fd; 
  int drive_type; 
  struct cam_device *dev; 
  union ccb *ccb; 
Therefore, the code in gnome-vfs' cdda-method.c must check for FreeBSD, 
but fallback to the other block in all other scenarios, not just Linux. 
The fix is simple: revert the conditional order, checking for __FreeBSD__ 
first, and defaulting to the other block with an #else.  Note that this 
happens twice in the code.
Comment 1 Julio Merino 2004-02-13 00:04:48 UTC
Created attachment 24374 [details] [review]
Sample patch for cdda-method.c
Comment 2 Christophe Fergeau 2004-03-07 20:08:38 UTC
Which cdparanoia version do you have ? I don't have this #ifndef in
/usr/include/cdda_interface.h here.
Comment 3 Julio Merino 2004-09-09 11:01:18 UTC
"Ooops".  Sorry for the long, long delay.  I didn't have time to verify and
reply at the moment when you sent the message, and forgot since then.

Well, I've just checked what's happening.  The FreeBSD support in the
cdda_interface.h is _not_ in cdparanoia's mainstream version.  That file is
actually patched by FreeBSD's ports system, as you can see in the following link:

In NetBSD's pkgsrc, we use the same patch to let cdparanoia build in FreeBSD
(you know, pkgsrc is portable to several systems ;).  But note that NetBSD does
_not_ require this patch to get cdparanoia working; it could work the same way
without the patch.

So, gnome-vfs' cdda-method.c file actually has a workaround for a
FreeBSD-specific change.  I don't say it shouldn't be there; the problem is just
that it's incorrectly done because it will make all non-Linux and non-FreeBSD
systems fail.  (It's clear that it'll be broken because of incorrectly balanced

Hope this clarifies the problem...
Comment 4 Sebastien Bacher 2005-01-06 22:12:25 UTC
new comment with details, reopening
Comment 5 Christian Neumair 2005-05-10 17:35:55 UTC
Thanks for your efforts Julio!
Maybe you could update your patch against HEAD? The code sections you're trying
to patch were recently modified to match against more FreeBSD flavor systems.
Comment 6 Julio Merino 2005-10-02 18:42:33 UTC
Created attachment 52942 [details] [review]
Updated patch

Sorry again for the long delay.  The new patch applies correctly against
2.12.0. Hope it helps now.
Comment 7 Julio Merino 2006-03-31 10:08:12 UTC
Just to let you know: the attached patch still applies to CVS HEAD, which is 2.14.0 at the moment (modules/cdda-method.c is at revision 1.24).
Comment 8 Julio Merino 2006-03-31 10:53:35 UTC
Thinking a bit more about this issue, it seems dangerous to me to rely on FreeBSD (or DragonFly) applying custom, non-standard patches to cdparanoia's code.  gnome-vfs can (and should) do a better work in detecting if those patches were applied, instead of just assuming that some operating systems have them (that is, avoiding the ugly #ifdef __FreeBSD__ machinery).

I'm updating the patch with one that adds a new check to to detect if cdparanoia contains the FreeBSD-specific patch.  The advantage of this approach is that if some other system ever applies the cdparanoia patch too (because, e.g., they import libcam), gnome-vfs will not need to be fixed.  In fact, this happened when DragonFly appeared, needing to extend the #ifdef conditionals in the code.
Comment 9 Julio Merino 2006-03-31 10:54:49 UTC
Created attachment 62452 [details] [review]
Patch to automatically detect FreeBSD-specific cdparanoia changes
Comment 10 Christian Neumair 2006-03-31 13:46:53 UTC
Thanks for your efforts, I like this patch. Maybe you could submit it to the GnomeVFS mailing list [1] for review?

Comment 11 Alexander Larsson 2006-04-21 14:10:12 UTC