Bug 234694

Summary: multimedia/libdvdread: improve opening of a DVD mount point
Product: Ports & Packages Reporter: Tijl Coosemans <tijl>
Component: Individual Port(s)Assignee: Ganael LAPLANCHE <martymac>
Status: Closed FIXED    
Severity: Affects Only Me Keywords: patch
Priority: --- Flags: bugzilla: maintainer-feedback? (martymac)
Version: Latest   
Hardware: Any   
OS: Any   
Attachments:
Description Flags
patch none

Description Tijl Coosemans freebsd_committer freebsd_triage 2019-01-07 17:17:19 UTC
Created attachment 200871 [details]
patch

libdvdread can open a device node like /dev/cd0, but it can also open a mount point like /media/SOME_DVD_LABEL.  It will lookup the device node for that mount point then.  This appears to be used by GNOME.  Currently libdvdread uses getfsfile(3) for this which means the device node has to be in /etc/fstab.  This is normally not the case for removable media.  This patch changes libdvdread to use statfs(2) instead.
Comment 1 Ganael LAPLANCHE freebsd_committer freebsd_triage 2019-01-08 11:17:36 UTC
Hi Tijl,

Thanks for the patch, it looks good. Anyway, I have a question : using statfs(2) implies to have the DVD mounted, while it is not strictly the case when using getfsfile(3).

Do you know if that part of the code is presuming the DVD to be mounted over its mount point ? Or is the path only used to guess the device node ?

The code suggests that the DVD *has* to be mounted but I am not 100% sure about that (and getfsfile(3) does not enforce that requirement).

Best regards,

Ganael.
Comment 2 Tijl Coosemans freebsd_committer freebsd_triage 2019-01-08 12:42:39 UTC
(In reply to Ganael LAPLANCHE from comment #1)
The various non-BSD implementations also assume the DVD is mounted, e.g. on Linux libdvdread checks /etc/mtab which lists only mounted file systems and for MacOSX it uses getfsstat(2) which returns a list of mounted file systems (they could just use statfs(2) BTW).
Comment 3 commit-hook freebsd_committer freebsd_triage 2019-01-08 21:50:37 UTC
A commit references this bug:

Author: martymac
Date: Tue Jan  8 21:50:22 UTC 2019
New revision: 489743
URL: https://svnweb.freebsd.org/changeset/ports/489743

Log:
  Use statfs(2) instead of getfsfile(3) to get device name from a mount point.

  PR:		234694
  Submitted by:	tijl

Changes:
  head/multimedia/libdvdread/Makefile
  head/multimedia/libdvdread/distinfo
  head/multimedia/libdvdread/files/patch-src-dvd_reader.c
Comment 4 Ganael LAPLANCHE freebsd_committer freebsd_triage 2019-01-08 21:52:56 UTC
Thanks for those precisions.

I've committed the patch, thanks again!

Best regards,

Ganael.