diff mbox

[BZ,19108] paths: use /proc/mounts instead of mtab

Message ID 1447857002-9791-1-git-send-email-Jason@zx2c4.com
State New
Headers show

Commit Message

Jason A. Donenfeld Nov. 18, 2015, 2:30 p.m. UTC
A related commit adjusting the texinfo documentation will have to be
provided, but this commit changes the relevant path per the bug report.

Entering the 21st century.

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
---
 ChangeLog                       | 6 ++++++
 sysdeps/unix/sysv/linux/paths.h | 2 +-
 2 files changed, 7 insertions(+), 1 deletion(-)

Comments

Florian Weimer Dec. 11, 2015, 12:36 p.m. UTC | #1
On 11/18/2015 03:30 PM, Jason A. Donenfeld wrote:
> -#define	_PATH_MOUNTED	"/etc/mtab"
> +#define	_PATH_MOUNTED	"/proc/mounts"

Why not /proc/self/mounts?  I don't know if there is a difference;
readlink on paths under /proc often does not provide accurate information.

I suspect a better way is for distributions to make /etc/mtab a symbolic
link to whatever location they need.  Fedora uses /proc/self/mounts, for
instance.

Florian
Jason A. Donenfeld Dec. 11, 2015, 1:03 p.m. UTC | #2
I'm not really part of their camp, but the systemd people write this
in their release notes:

https://github.com/systemd/systemd/blob/master/NEWS

> Any reference to /etc/mtab has been dropped from
> systemd. The file has been obsolete since a while, but
> systemd refused to work on systems where it was incorrectly
> set up (it should be a symlink or non-existent). Please make
> sure to update to util-linux 2.27.1 or newer in conjunction
> with this systemd release, which also drops any reference to
> /etc/mtab. If you maintain a distribution make sure that no
> software you package still references it, as this is a
> likely source of bugs. There's also a glibc bug pending,
> asking for removal of any reference to this obsolete file:
> https://sourceware.org/bugzilla/show_bug.cgi?id=19108
Florian Weimer Dec. 14, 2015, 2:14 p.m. UTC | #3
On 12/11/2015 02:03 PM, Jason A. Donenfeld wrote:
> I'm not really part of their camp, but the systemd people write this
> in their release notes:
> 
> https://github.com/systemd/systemd/blob/master/NEWS
> 
>> Any reference to /etc/mtab has been dropped from
>> systemd. The file has been obsolete since a while, but
>> systemd refused to work on systems where it was incorrectly
>> set up (it should be a symlink or non-existent). Please make
>> sure to update to util-linux 2.27.1 or newer in conjunction
>> with this systemd release, which also drops any reference to
>> /etc/mtab. If you maintain a distribution make sure that no
>> software you package still references it, as this is a
>> likely source of bugs. There's also a glibc bug pending,
>> asking for removal of any reference to this obsolete file:
>> https://sourceware.org/bugzilla/show_bug.cgi?id=19108

/etc/mtab is part of the ABI, so I don't think the above can be quite right.

In fact, I would rather prefer if glibc keeps using /etc/mtab, as a
reminder that you can't possibly remove the file without breaking
backwards compatibility.  Yes, the separately maintained list of mounts
in /etc/mtab (as a regular file) is obsolete, but that does not mean you
can remove the file, you need to keep the compatibility symbolic link.

Florian
diff mbox

Patch

diff --git a/ChangeLog b/ChangeLog
index a915653..08143ab 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@ 
+2015-11-18  Jason A. Donenfeld  <Jason@zx2c4.com>
+
+	[BZ #19108]
+	* sysdeps/unix/sysv/linux/paths.h: Update to using /proc/mounts
+	instead of /etc/mtab.
+
 2015-11-17  Siddhesh Poyarekar  <siddhesh.poyarekar@linaro.org>
 
 	* sysdeps/ieee754/dbl-64/s_sin.c (__sin)[IN_SINCOS]: Mark function
diff --git a/sysdeps/unix/sysv/linux/paths.h b/sysdeps/unix/sysv/linux/paths.h
index 1342ab3..ec342fe 100644
--- a/sysdeps/unix/sysv/linux/paths.h
+++ b/sysdeps/unix/sysv/linux/paths.h
@@ -52,7 +52,7 @@ 
 #define	_PATH_MAN	"/usr/share/man"
 #define	_PATH_MEM	"/dev/mem"
 #define	_PATH_MNTTAB	"/etc/fstab"
-#define	_PATH_MOUNTED	"/etc/mtab"
+#define	_PATH_MOUNTED	"/proc/mounts"
 #define	_PATH_NOLOGIN	"/etc/nologin"
 #define	_PATH_PRESERVE	"/var/lib"
 #define	_PATH_RWHODIR	"/var/spool/rwho"