Created attachment 200871 [details]
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.
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).
(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).
A commit references this bug:
Date: Tue Jan 8 21:50:22 UTC 2019
New revision: 489743
Use statfs(2) instead of getfsfile(3) to get device name from a mount point.
Submitted by: tijl
Thanks for those precisions.
I've committed the patch, thanks again!