GNU bug report logs - #25173
stat -c%m and bind mounts

Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.

Package: coreutils; Reported by: Wim Hueskes <whueskes@HIDDEN>; dated Sun, 11 Dec 2016 18:27:02 UTC; Maintainer for coreutils is bug-coreutils@HIDDEN.

Message received at submit <at> debbugs.gnu.org:


Received: (at submit) by debbugs.gnu.org; 11 Dec 2016 18:26:54 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun Dec 11 13:26:54 2016
Received: from localhost ([127.0.0.1]:38395 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1cG8pq-0003d4-Az
	for submit <at> debbugs.gnu.org; Sun, 11 Dec 2016 13:26:54 -0500
Received: from eggs.gnu.org ([208.118.235.92]:37552)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <whueskes@HIDDEN>) id 1cG8YR-0003CB-6e
 for submit <at> debbugs.gnu.org; Sun, 11 Dec 2016 13:08:55 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
 (envelope-from <whueskes@HIDDEN>) id 1cG8YK-0004rz-VI
 for submit <at> debbugs.gnu.org; Sun, 11 Dec 2016 13:08:50 -0500
X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org
X-Spam-Level: *
X-Spam-Status: No, score=1.3 required=5.0 tests=BAYES_50,FREEMAIL_FROM,
 RCVD_IN_SORBS_SPAM,T_DKIM_INVALID autolearn=disabled version=3.3.2
Received: from lists.gnu.org ([2001:4830:134:3::11]:40767)
 by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32)
 (Exim 4.71) (envelope-from <whueskes@HIDDEN>) id 1cG8YK-0004rr-RF
 for submit <at> debbugs.gnu.org; Sun, 11 Dec 2016 13:08:48 -0500
Received: from eggs.gnu.org ([2001:4830:134:3::10]:56749)
 by lists.gnu.org with esmtp (Exim 4.71)
 (envelope-from <whueskes@HIDDEN>) id 1cG8YJ-0002OD-Gq
 for bug-coreutils@HIDDEN; Sun, 11 Dec 2016 13:08:48 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
 (envelope-from <whueskes@HIDDEN>) id 1cG8YG-0004qX-Cv
 for bug-coreutils@HIDDEN; Sun, 11 Dec 2016 13:08:47 -0500
Received: from mail-qk0-f169.google.com ([209.85.220.169]:33260)
 by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16)
 (Exim 4.71) (envelope-from <whueskes@HIDDEN>) id 1cG8YG-0004kb-8H
 for bug-coreutils@HIDDEN; Sun, 11 Dec 2016 13:08:44 -0500
Received: by mail-qk0-f169.google.com with SMTP id x190so64095275qkb.0
 for <bug-coreutils@HIDDEN>; Sun, 11 Dec 2016 10:08:23 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113;
 h=mime-version:from:date:message-id:subject:to;
 bh=tLZSgRVSz/AXQ7dZGbmrQE0/pPip+MOmWG+v9k4xXKA=;
 b=aO3SlEvcL/Thg/i/YFx2thMfY1Mefy39jeXbUVTfyZZHRv+Ym6tZZEOOlJOv0QtPn6
 Z+ON/lOO72ZXZ84lFR9YECLFNS8INBaJRZuJFACTI9rvWaFu4+me6PTYCRP/UrsfZvD9
 5+060u1Lx7UnFsU6pUZI/oyGHOqS8VNuj8hGlzv0U9DIjqBcAQGMT13iRH7igZQSOAwT
 0g+bPwBgGzcpp+2ccpFbEKso+OGMYCiOZOLQPuKjfmac/+VYIVp/hUvOj1AIZYKteyL/
 kIseArO3Ljt6aTaAIF9Wu9WgDp16cLVg6TVDz2Ka1xpuNQ0fh8aQnQX6yGFubNvlEf2g
 BRWQ==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20130820;
 h=x-gm-message-state:mime-version:from:date:message-id:subject:to;
 bh=tLZSgRVSz/AXQ7dZGbmrQE0/pPip+MOmWG+v9k4xXKA=;
 b=bfVUxOVrWoT0Qt8CYJ/pQ+EVYi/EQVtWU9nbar+JpWu8/ERBoSvU0VIoYuG/HX5W/e
 makp7N9DoNuYAYXJaIDC0ZrgwJkR8L643VJRYOV+BW6cdEaENGeYg71MiD6vbHtloCji
 KwO9nUm+OVZaVyrWxO+wzc2Y69x5tDCNHWS/KfPh6xnd/BVvOIDatvHc9EMZho7UgbAs
 VbUdUNSjIi0JP0LK2sIVcx+CASvWFciYuyjIj91F3SEvVdge8haNpNzCvpWC+lJTCWKa
 1j29f455uoDLhXMdk5eSTzSB1D9lgqG7hyEW6suewMHjTAClwwUwQIiaIGeQS8uj2UyE
 bG4w==
X-Gm-Message-State: AKaTC03AG7SfDrKMbr5EibgJ+4qY7p5KPPkLOguznjQ2dyx7JIWHeo0yA/AqjPBx/tR6X8lzZZ0tSDu+nvEknw==
X-Received: by 10.55.143.199 with SMTP id r190mr85921587qkd.72.1481479642331; 
 Sun, 11 Dec 2016 10:07:22 -0800 (PST)
MIME-Version: 1.0
Received: by 10.12.137.179 with HTTP; Sun, 11 Dec 2016 10:07:21 -0800 (PST)
From: Wim Hueskes <whueskes@HIDDEN>
Date: Sun, 11 Dec 2016 19:07:21 +0100
Message-ID: <CACVOuYJZUg_NYz0G-746iHwoF5bv62SyLCNtCitvTuWLVQd3dA@HIDDEN>
Subject: stat -c%m and bind mounts
To: bug-coreutils@HIDDEN
Content-Type: text/plain; charset=UTF-8
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic]
 [fuzzy]
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x
X-Received-From: 2001:4830:134:3::11
X-Spam-Score: -3.5 (---)
X-Debbugs-Envelope-To: submit
X-Mailman-Approved-At: Sun, 11 Dec 2016 13:26:53 -0500
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.5 (---)

stat -c%m does not seem to work correctly with bind mounts.
I have tested the following on Debian Jessie:

# mkdir /home/root ; touch /home/zero
# mount -o bind /root /home/root
# mount -o bind /dev/zero /home/zero
# mount -o bind /tmp /tmp
# ./src/df -P /home/root /home/zero /tmp
Filesystem     1024-blocks    Used Available Capacity Mounted on
/dev/sda1          7736784 2431152   4889584      34% /home/root
udev                 10240       0     10240       0% /home/zero
/dev/sda1          7736784 2431152   4889584      34% /tmp
# ./src/stat -c%m /home/root /home/zero /tmp
/
/
/
# ./src/stat --version
stat (GNU coreutils) 8.26.4-ca52f


The documentation explains:

stat outputs the alias for a bind mounted file, rather than the
initial mount point of its backing device. One can recursively call
stat until there is no change in output, to get the current base mount
point
(https://www.gnu.org/software/coreutils/manual/html_node/stat-invocation.html#index-bind-mount-1)

At least the documentation does not match the result. Note that the
documented behaviour would not work for /tmp bind mounted to itself.

But I also would expect to see /dev as the mount point of /home/zero
in the example above.

Related: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=6555#76
-- 
Best regards,
Wim




Acknowledgement sent to Wim Hueskes <whueskes@HIDDEN>:
New bug report received and forwarded. Copy sent to bug-coreutils@HIDDEN. Full text available.
Report forwarded to bug-coreutils@HIDDEN:
bug#25173; Package coreutils. Full text available.
Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.
Last modified: Mon, 25 Nov 2019 12:00:02 UTC

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