patchCompact Disc Input and Control Library - Patches: patch #10174, Linux: Use getmntent/setmntent for...

 
 

patch #10174: Linux: Use getmntent/setmntent for reading mounts

Submitter:  Miguel Borges de Freitas <enen92>
Submitted:  Wed 02 Feb 2022 09:48:35 PM UTC
   
 
Category:  None Priority:  5 - Normal
Status:  None Privacy:  Public
Assigned to:  None Open/Closed:  Open
* Mandatory Fields

Add a New Comment Rich Markup
   

Wed 02 Feb 2022 09:48:35 PM UTC, original submission:  

In Kodi we use libcdio to eject/unmount disks. According to this bug report (https://github.com/xbmc/xbmc/issues/20935) kodi/libcdio fails to unmount the disk whenever the disk label contains spaces. In the /proc/mounts file spaces are octal escaped, like the example below:

/dev/sr0 /run/media/arch/Lawrence\040of\040Arabia udf ro,nosuid,nodev,relatime,uid=1000,gid=1000,iocharset=utf8 0 0

The root cause of the problem is in the way libcdio gets the mountpath - using regular file I/O. According to the linux documentation (https://man7.org/linux/man-pages/man3/getmntent.3.html) when parsing fstab/mtab/mounts getmtent and setmtent (and the mtent struct) should be used instead:

"""
Since fields in the mtab and fstab files are separated by
whitespace, octal escapes are used to represent the characters
space (\040), tab (\011), newline (\012), and backslash (\\) in those files when they occur in one of the four strings in a
mntent structure.  The routines addmntent() and getmntent() will
convert from string representation to escaped representation and
back.  When converting from escaped representation, the sequence
\134 is also converted to a backslash.
"""

Patch file attached, runtime tested.

Regards,

Miguel Borges de Freitas

Miguel Borges de Freitas <enen92>

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by enen92 (Submitted the item)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only logged-in users can vote.

     

    Follows 1 latest change.

    Date Changed by Updated Field Previous Value => Replaced by
    2022-02-02 enen92 Attached File- Added 0001-Linux-Use-getmntent-setmntent-for-reading-mounts.patch, #52795

    Back to the top

    Powered by Savane 3.13-d3ae.
    Corresponding source code