Bug 234694 - multimedia/libdvdread: improve opening of a DVD mount point
Summary: multimedia/libdvdread: improve opening of a DVD mount point
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Only Me
Assignee: Ganael LAPLANCHE
URL:
Keywords: patch
Depends on:
Blocks:
 
Reported: 2019-01-07 17:17 UTC by Tijl Coosemans
Modified: 2019-01-08 21:52 UTC (History)
0 users

See Also:
bugzilla: maintainer-feedback? (martymac)


Attachments
patch (2.72 KB, patch)
2019-01-07 17:17 UTC, Tijl Coosemans
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Tijl Coosemans freebsd_committer 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 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 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 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 2019-01-08 21:52:56 UTC
Thanks for those precisions.

I've committed the patch, thanks again!

Best regards,

Ganael.