Debian Bug report logs - #359717
initscripts: mountpoint: Please recognize bind mount points as mount points

version graph

Package: initscripts; Maintainer for initscripts is Debian sysvinit maintainers <pkg-sysvinit-devel@lists.alioth.debian.org>; Source for initscripts is src:sysvinit.

Reported by: Thomas Hood <jdthood@yahoo.co.uk>

Date: Tue, 28 Mar 2006 15:48:18 UTC

Severity: important

Found in versions initscripts/2.86.ds1-6, sysvinit/2.87dsf-2

Reply or subscribe to this bug.

Toggle useless messages

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to debian-bugs-dist@lists.debian.org, Debian sysvinit maintainers <pkg-sysvinit-devel@lists.alioth.debian.org>:
Bug#359717; Package initscripts. Full text and rfc822 format available.

Acknowledgement sent to Thomas Hood <jdthood@yahoo.co.uk>:
New Bug report received and forwarded. Copy sent to Debian sysvinit maintainers <pkg-sysvinit-devel@lists.alioth.debian.org>. Full text and rfc822 format available.

Message #5 received at submit@bugs.debian.org (full text, mbox):

From: Thomas Hood <jdthood@yahoo.co.uk>
To: "R.Ramkumar" <ramk@cse.iitm.ernet.in>
Cc: Henrique de Moraes Holschuh <hmh@debian.org>, 353943@bugs.debian.org
Subject: initscripts: mountpoint: Please recognize bind mount points as mount points
Date: Tue, 28 Mar 2006 17:45:52 +0200
Package: initscripts
Version: 2.86.ds1-6
Severity: wishlist

R.Ramkumar wrote:
> Not completely OK though :) , as I mentioned in the mail in which I
> sent the patch. `mountpoint` seems to have problems recognizing bind
> mounts, is this the intended behaviour, or is it a bug?


Call it a 'shortcoming'.  :)  Opening the bug report with this message.
-- 
Thomas Hood



Information forwarded to debian-bugs-dist@lists.debian.org, Debian sysvinit maintainers <pkg-sysvinit-devel@lists.alioth.debian.org>:
Bug#359717; Package initscripts. (Wed, 19 Aug 2009 09:18:06 GMT) Full text and rfc822 format available.

Acknowledgement sent to Ivan Vilata i Balaguer <ivan@selidor.net>:
Extra info received and forwarded to list. Copy sent to Debian sysvinit maintainers <pkg-sysvinit-devel@lists.alioth.debian.org>. (Wed, 19 Aug 2009 09:18:06 GMT) Full text and rfc822 format available.

Message #10 received at 359717@bugs.debian.org (full text, mbox):

From: Ivan Vilata i Balaguer <ivan@selidor.net>
To: Debian Bug Tracking System <359717@bugs.debian.org>
Subject: initscripts: Any progress?
Date: Wed, 19 Aug 2009 11:17:41 +0200
Package: initscripts
Version: 2.87dsf-2
Severity: normal


Any progress on this one?  Any comments from mainstream developers?

Thanks,

-- System Information:
Debian Release: squeeze/sid
  APT prefers unstable
  APT policy: (500, 'unstable')
Architecture: amd64 (x86_64)

Kernel: Linux 2.6.30-1-amd64 (SMP w/2 CPU cores)
Locale: LANG=ca_ES.UTF-8, LC_CTYPE=ca_ES.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/bash

Versions of packages initscripts depends on:
ii  debianutils                   3.2        Miscellaneous utilities specific t
ii  libc6                         2.9-23     GNU C Library: Shared libraries
ii  lsb-base                      3.2-23     Linux Standard Base 3.2 init scrip
ii  mount                         2.16-2.1   Tools for mounting and manipulatin
ii  sysvinit-utils                2.87dsf-2  System-V-like utilities

Versions of packages initscripts recommends:
ii  e2fsprogs                     1.41.8-2   ext2/ext3/ext4 file system utiliti
ii  psmisc                        22.8-1     utilities that use the proc file s

initscripts suggests no packages.

-- no debconf information




Information forwarded to debian-bugs-dist@lists.debian.org, Debian sysvinit maintainers <pkg-sysvinit-devel@lists.alioth.debian.org>:
Bug#359717; Package initscripts. (Sun, 25 Oct 2009 09:54:03 GMT) Full text and rfc822 format available.

Acknowledgement sent to Giuseppe Sacco <giuseppe@eppesuigoccas.homedns.org>:
Extra info received and forwarded to list. Copy sent to Debian sysvinit maintainers <pkg-sysvinit-devel@lists.alioth.debian.org>. (Sun, 25 Oct 2009 09:54:03 GMT) Full text and rfc822 format available.

Message #15 received at 359717@bugs.debian.org (full text, mbox):

From: Giuseppe Sacco <giuseppe@eppesuigoccas.homedns.org>
To: control@bugs.debian.org
Cc: 359717@bugs.debian.org, Debian sysvinit maintainers <pkg-sysvinit-devel@lists.alioth.debian.org>
Subject: mountpoint command fail to identify mount points on same device
Date: Sun, 25 Oct 2009 10:24:40 +0100
severity 359717 important
thanks

Hi all,
while checking hylafax bugs #551566 and #551443, I found a problem with
mountpoint command. Browsing initscripts bugs, it seems this is already
reported as #359717.

I checked mountpoint source code and found that it does an stats() of
the supposed mount point and its parent directory. If both stats()
report the same block device, then mountpoint think this is not a mount
point, otherwise it says it is a mount point.

So, if a system has its root file system mounted from device /dev/sda1,
and a second mount point is created with "bind" option, i.e., without
having an underneath block device, then, when mountpoint is invoked, it
does not find the correct nature of second mount point.

For fixing this bug I wonder if it possible to scan /etc/mtab and
identify all possibile mount points. An alternative could be
use /proc/mounts, but I suppose this is not always available since
probably it is Linux related and won't work on *bsd or hurd kernels.
Of course, current behaviour could be left unchanged for systems where
no /etc/mtab is present.

As a side note, hurd might use /etc/mtab, as I found here: 
http://www.gnu.org/software/hurd/community/gsoc/project_ideas/mtab.html

Bye,
Giuseppe





Severity set to 'important' from 'wishlist' Request was from Giuseppe Sacco <giuseppe@eppesuigoccas.homedns.org> to control@bugs.debian.org. (Sun, 25 Oct 2009 09:54:08 GMT) Full text and rfc822 format available.

Information forwarded to debian-bugs-dist@lists.debian.org, Debian sysvinit maintainers <pkg-sysvinit-devel@lists.alioth.debian.org>:
Bug#359717; Package initscripts. (Sat, 02 Apr 2011 07:45:12 GMT) Full text and rfc822 format available.

Acknowledgement sent to Elliott Mitchell <ehem@m5p.com>:
Extra info received and forwarded to list. Copy sent to Debian sysvinit maintainers <pkg-sysvinit-devel@lists.alioth.debian.org>. (Sat, 02 Apr 2011 07:45:12 GMT) Full text and rfc822 format available.

Message #22 received at 359717@bugs.debian.org (full text, mbox):

From: Elliott Mitchell <ehem@m5p.com>
To: 359717@bugs.debian.org
Subject: Binding Mount to Itself Breaks Things
Date: Sat, 2 Apr 2011 00:23:53 -0700 (PDT)
Might I suggest pondering returning bug #359717 to wishlist severity and
taging it "wontfix"?

The problem is binding mounts *will* break things if used improperly (or
properly depending on POV and how sadistic you are). The steps used by
`mountpoint` are absolutely correct from Unix traditions, that /should/
detect a mount point.

Bind mounting a filesystem will break many programs that assume
traditional Unix behavior. By the standards, you're never supposed to see
a given device:inode pair recur multiple times, but binding mounts
violate this.

For an example, take a look at sysdeps/posix/getcwd.c from the libc6
source package, again, by the standards that code should be able to
successfully identify the current directory. Yet, if a filesystem is bind
mounted onto itself that code can be made to fail. getcwd() continues to
work only because Linux has a getcwd() system call, because getcwd() is
fairly expensive to implement in userspace and it is used by many
programs.

On one hand I'm of the opinion that bind mounts are the breakage here. On
the other hand one could call `mountpoint` a system utility, which should
deal with oddball conditions like this.


-- 
(\___(\___(\______          --=> 8-) EHM <=--          ______/)___/)___/)
 \BS (    |         EHeM@gremlin.m5p.com PGP F6B23DE0         |    )   /
  \_CS\   |  _____  -O #include <stddisclaimer.h> O-   _____  |   /  _/
2477\___\_|_/DC21 03A0 5D61 985B <-PGP-> F2BE 6526 ABD2 F6B2\_|_/___/3DE0






Information forwarded to debian-bugs-dist@lists.debian.org, Debian sysvinit maintainers <pkg-sysvinit-devel@lists.alioth.debian.org>:
Bug#359717; Package initscripts. (Wed, 27 Mar 2013 23:15:04 GMT) Full text and rfc822 format available.

Acknowledgement sent to Askar Safin <safinaskar@mail.ru>:
Extra info received and forwarded to list. Copy sent to Debian sysvinit maintainers <pkg-sysvinit-devel@lists.alioth.debian.org>. (Wed, 27 Mar 2013 23:15:04 GMT) Full text and rfc822 format available.

Message #27 received at 359717@bugs.debian.org (full text, mbox):

From: Askar Safin <safinaskar@mail.ru>
To: 359717@bugs.debian.org
Cc: Elliott Mitchell <ehem@m5p.com>
Subject: Re: Binding Mount to Itself Breaks Things
Date: Thu, 28 Mar 2013 03:10:47 +0400
> The problem is binding mounts *will* break things if used improperly
No, I completely disagree with you.
If you really think that bind mounts are bad, then go to kernel developers and tell them to remove bind mount support.
Bind mount are present in kernel. People use them. So, Debian should fully support them.
Debian should not force any policy to users. If users want to use bind mounts, let them use it. And Debian's "mountpoint" should respect users and should show bind mounts.
Yes, this is not UNIX-way. But modern GNU/Linux is not old UNIX. GNU/Linux is modern OS with a lot of not-UNIX features:
* bind mounts (also rbind mounts etc)
* FUS (file system in user space). FUS can potentially be infinite, for example, say, /sshfs/some-host/some-port/remote-fs/sshfs/some-host/some-port/remote-fs/...
* Linux containers (also OPENVZ), this includes PID namespaces, mount namespaces, etc
* Even minimal GNU/Linux installation has infinite fs, for example, /proc/1/root/proc/1/root/proc/1/root...
* System capabilities (man 7 capabilities)
* ...
Do you want to go back to past? Of course, no. So, please agree with modern GNU/Linux features. We should support them as more as we can. Of course, there are a lot of programs, which still assume old UNIX system. But in core programs (such as mountpoint) we should be very close to kernel and should write unportable but right code. Yes, low-level programs should be unportable, they, of course, should depend on kernels. So, they may contain a lot of #ifdefs and they should support all features that kernel gives.

Askar Safin

Information forwarded to debian-bugs-dist@lists.debian.org, Debian sysvinit maintainers <pkg-sysvinit-devel@lists.alioth.debian.org>:
Bug#359717; Package initscripts. (Wed, 31 Jul 2013 01:21:04 GMT) Full text and rfc822 format available.

Acknowledgement sent to Zenaan Harkness <zen@freedbms.net>:
Extra info received and forwarded to list. Copy sent to Debian sysvinit maintainers <pkg-sysvinit-devel@lists.alioth.debian.org>. (Wed, 31 Jul 2013 01:21:04 GMT) Full text and rfc822 format available.

Message #32 received at 359717@bugs.debian.org (full text, mbox):

From: Zenaan Harkness <zen@freedbms.net>
To: 359717@bugs.debian.org
Subject: /bin/mountpoint bug: mount -o bind /dir /dir, creates a mountpoint for which /bin/mountpoint is unsuccessful
Date: Wed, 31 Jul 2013 11:13:13 +1000
Sent this in 2010 as email to pkg-sysvinit-devel... :

PS: now I'm on sid, the following was from 2010:

To use 'mount --make-rshared' on say /media or /mnt, requires that
I first run:
mount -o bind /media /media
to create a mountpoint at /media, so that subsequently I can successfully run:
mount --make-rshared /media

This is useful when using chroots, as I do.

I was using "mountpoint -q $DIR" to determine if an arbitrary
directory was mounted or not, in my chroot u/mount script.
Unfortunately this broke when I started using "mount -o bind /media
/media".

So since /bin/mountpoint does not work, I am instead now using:
if mount | grep "on ${DIR} type" > /dev/null; then ...; fi

I just checked initscripts in a Ubuntu 10.04 chroot guest (initscripts
"Version: 2.87dsf-4ubuntu17"),
on my Ubuntu 8.04 host, and /bin/mountpoint there displays the same bug.
My Ubuntu 8.04 uname -a:
Linux ip61 2.6.24-28-generic #1 SMP Sat Oct 16 17:46:03 UTC 2010 i686 GNU/Linux
Initscripts Version: 2.86.ds1-14.1ubuntu45.1

Hope the above is useful,
Zenaan

-- 
Free Australia: www.UPMART.org
Please respect the confidentiality of this email as sensibly warranted.



Information forwarded to debian-bugs-dist@lists.debian.org, Debian sysvinit maintainers <pkg-sysvinit-devel@lists.alioth.debian.org>:
Bug#359717; Package initscripts. (Wed, 31 Jul 2013 01:27:04 GMT) Full text and rfc822 format available.

Acknowledgement sent to Zenaan Harkness <zen@freedbms.net>:
Extra info received and forwarded to list. Copy sent to Debian sysvinit maintainers <pkg-sysvinit-devel@lists.alioth.debian.org>. (Wed, 31 Jul 2013 01:27:04 GMT) Full text and rfc822 format available.

Message #37 received at 359717@bugs.debian.org (full text, mbox):

From: Zenaan Harkness <zen@freedbms.net>
To: 359717@bugs.debian.org
Subject: 622595 appears to be a duplicate of this bug
Date: Wed, 31 Jul 2013 11:13:57 +1000
622595 appears to be a duplicate of this bug



Information forwarded to debian-bugs-dist@lists.debian.org, Debian sysvinit maintainers <pkg-sysvinit-devel@lists.alioth.debian.org>:
Bug#359717; Package initscripts. (Wed, 31 Jul 2013 01:27:07 GMT) Full text and rfc822 format available.

Acknowledgement sent to Zenaan Harkness <zen@freedbms.net>:
Extra info received and forwarded to list. Copy sent to Debian sysvinit maintainers <pkg-sysvinit-devel@lists.alioth.debian.org>. (Wed, 31 Jul 2013 01:27:07 GMT) Full text and rfc822 format available.

Message #42 received at 359717@bugs.debian.org (full text, mbox):

From: Zenaan Harkness <zen@freedbms.net>
To: 359717@bugs.debian.org
Subject: bash workaround
Date: Wed, 31 Jul 2013 11:24:50 +1000
If using bash, this is what I've come to in my local bashlib,
over the last few years:

isMounted () {
   # make sure a target/ arg is passed in:
   [ -z "$1" ] && return 1
   # turn target into fully qualified filename/ location
   # (not doing so can cause problems with some of the tests I've tried,
   # eg perhaps the one currently used see below):
   DIR=`readlink -f "$1"`

   # Option 1, from: http://arstechnica.com/civis//viewtopic.php?f=16&t=1174539
   #
   #grep -q "$DIR" /proc/mounts
   #[ $? -eq 0 ] && return 0 # Alternatively: "return $?", I guess
   # or alt alternative, make sure no other commands like echo follow :)
   # From url: "For more robust bash scripting, using $? is preferred as it
   # allows you to detect extra error conditions (like the command not
   # existing, or you gave it syntactically invalid arguments, etc.)"

   # Option 2:
   #
   # The following seemed unsophisticated, and clunky, when the /bin/mountpoint
   # command is installed by default, thus option 3 below.  But as can be seen
   # with option 3, the "sophisticated" option is in fact buggy. I emailed
   # this bug to initscripts maintainer, debian and ubuntu, on 20101029.
   # See also: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=359717
   # See also: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=622595
   # See also: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=460898
   #mount | grep "on ${DIR} type" > /dev/null && return 0
   #mount | grep -q "on ${DIR} type" && return 0
   mount | grep -q "on ${DIR} type"

   # Option 3:
   #
   # The following (off the web, and a standard command in debian)
   # fails for a directory mounted on itself,
   # which is needed prior to mount --make-rshared /directory.
   #mountpoint -q ${DIR}
}





Send a report that this bug log contains spam.


Debian bug tracking system administrator <owner@bugs.debian.org>. Last modified: Thu Apr 17 04:47:27 2014; Machine Name: beach.debian.org

Debian Bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.