Util-Linux Archive on lore.kernel.org
 help / Atom feed
* [PATCH] mount: Do not call mnt_pretty_path() on net file systems.
@ 2019-02-05 22:57 Stanislav Brabec
  2019-02-05 23:07 ` Stanislav Brabec
  0 siblings, 1 reply; 3+ messages in thread
From: Stanislav Brabec @ 2019-02-05 22:57 UTC (permalink / raw)
  To: util-linux

Calling mnt_pretty_path() on network file systems can cause mangling of
the output:

nfs.example.com:/home on /home type nfs4 ...
/root/nfs.example.com:/home on /home type nfs4 ...

Signed-off-by: Stanislav Brabec <sbrabec@suse.cz>
---
 sys-utils/mount.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys-utils/mount.c b/sys-utils/mount.c
index f4a387b8a..b91d4779a 100644
--- a/sys-utils/mount.c
+++ b/sys-utils/mount.c
@@ -143,7 +143,7 @@ static void print_all(struct libmnt_context *cxt, char *pattern, int show_label)
 		if (type && pattern && !mnt_match_fstype(type, pattern))
 			continue;
 
-		if (!mnt_fs_is_pseudofs(fs))
+		if (!mnt_fs_is_pseudofs(fs) && !mnt_fs_is_netfs(fs))
 			xsrc = mnt_pretty_path(src, cache);
 		printf ("%s on ", xsrc ? xsrc : src);
 		safe_fputs(mnt_fs_get_target(fs));
-- 
2.20.1

-- 
Best Regards / S pozdravem,

Stanislav Brabec
software developer
---------------------------------------------------------------------
SUSE LINUX, s. r. o.                         e-mail: sbrabec@suse.com
Køi¾íkova 148/34 (Corso IIa)                    tel: +420 284 084 060
186 00 Praha 8-Karlín                          fax:  +420 284 084 001
Czech Republic                                    http://www.suse.cz/
PGP: 830B 40D5 9E05 35D8 5E27 6FA3 717C 209F A04F CD76

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH] mount: Do not call mnt_pretty_path() on net file systems.
  2019-02-05 22:57 [PATCH] mount: Do not call mnt_pretty_path() on net file systems Stanislav Brabec
@ 2019-02-05 23:07 ` Stanislav Brabec
  2019-02-06 10:58   ` Karel Zak
  0 siblings, 1 reply; 3+ messages in thread
From: Stanislav Brabec @ 2019-02-05 23:07 UTC (permalink / raw)
  To: util-linux

Calling mnt_pretty_path() on network file systems can cause mangling of
the output:
root# mount | grep nfs
nfs.example.com:/home on /home type nfs4 ...
root# mkdir -p nfs.example.com:/home
root# mount | grep nfs
/root/nfs.example.com:/home on /home type nfs4 ...

Signed-off-by: Stanislav Brabec <sbrabec@suse.cz>
---
 sys-utils/mount.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys-utils/mount.c b/sys-utils/mount.c
index f4a387b8a..b91d4779a 100644
--- a/sys-utils/mount.c
+++ b/sys-utils/mount.c
@@ -143,7 +143,7 @@ static void print_all(struct libmnt_context *cxt, char *pattern, int show_label)
 		if (type && pattern && !mnt_match_fstype(type, pattern))
 			continue;
 
-		if (!mnt_fs_is_pseudofs(fs))
+		if (!mnt_fs_is_pseudofs(fs) && !mnt_fs_is_netfs(fs))
 			xsrc = mnt_pretty_path(src, cache);
 		printf ("%s on ", xsrc ? xsrc : src);
 		safe_fputs(mnt_fs_get_target(fs));
-- 
2.20.1

-- 
Best Regards / S pozdravem,

Stanislav Brabec
software developer
---------------------------------------------------------------------
SUSE LINUX, s. r. o.                         e-mail: sbrabec@suse.com
Køi¾íkova 148/34 (Corso IIa)                    tel: +420 284 084 060
186 00 Praha 8-Karlín                          fax:  +420 284 084 001
Czech Republic                                    http://www.suse.cz/
PGP: 830B 40D5 9E05 35D8 5E27 6FA3 717C 209F A04F CD76

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] mount: Do not call mnt_pretty_path() on net file systems.
  2019-02-05 23:07 ` Stanislav Brabec
@ 2019-02-06 10:58   ` Karel Zak
  0 siblings, 0 replies; 3+ messages in thread
From: Karel Zak @ 2019-02-06 10:58 UTC (permalink / raw)
  To: Stanislav Brabec; +Cc: util-linux

On Wed, Feb 06, 2019 at 12:07:54AM +0100, Stanislav Brabec wrote:
>  sys-utils/mount.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

Applied, thanks!

Please, send also updates for the mnt_fstype_is_pseudofs().

    Karel

-- 
 Karel Zak  <kzak@redhat.com>
 http://karelzak.blogspot.com

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, back to index

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-02-05 22:57 [PATCH] mount: Do not call mnt_pretty_path() on net file systems Stanislav Brabec
2019-02-05 23:07 ` Stanislav Brabec
2019-02-06 10:58   ` Karel Zak

Util-Linux Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/util-linux/0 util-linux/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 util-linux util-linux/ https://lore.kernel.org/util-linux \
		util-linux@vger.kernel.org util-linux@archiver.kernel.org
	public-inbox-index util-linux


Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.util-linux


AGPL code for this site: git clone https://public-inbox.org/ public-inbox