unofficial mirror of libc-alpha@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] manual: Correct argument order in mount examples (bug 27207)
@ 2021-01-21 15:57 John McCabe
  2021-01-22 18:09 ` DJ Delorie via Libc-alpha
  0 siblings, 1 reply; 4+ messages in thread
From: John McCabe @ 2021-01-21 15:57 UTC (permalink / raw)
  To: libc-alpha

[-- Attachment #1: Type: text/plain, Size: 132 bytes --]

Please find attached a patch that fixes the [minor, but 
confusion-causing] issue described in bug 27207.

Hope this helps.
John

[-- Attachment #2: 0001-manual-Correct-argument-order-in-mount-examples-bug-.patch --]
[-- Type: application/octet-stream, Size: 872 bytes --]

From 5f02c92758f396583c74888def7e4b82656bd72c Mon Sep 17 00:00:00 2001
From: John McCabe <john@mccabe.org.uk>
Date: Tue, 19 Jan 2021 18:25:25 +0000
Subject: [PATCH] manual: Correct argument order in mount examples (bug 27207)
To: libc-alpha@sourceware.org

---
 manual/sysinfo.texi | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/manual/sysinfo.texi b/manual/sysinfo.texi
index 4ca4555443..f61f5e3ad9 100644
--- a/manual/sysinfo.texi
+++ b/manual/sysinfo.texi
@@ -954,9 +954,9 @@ Example:
 @group
 #include <sys/mount.h>
 
-mount("/dev/hdb", "/cdrom", MS_MGC_VAL | MS_RDONLY | MS_NOSUID, "");
+mount("/dev/hdb", "/cdrom", "", MS_MGC_VAL | MS_RDONLY | MS_NOSUID, NULL);
 
-mount("/dev/hda2", "/mnt", MS_MGC_VAL | MS_REMOUNT, "");
+mount("/dev/hda2", "/mnt", "", MS_MGC_VAL | MS_REMOUNT, NULL);
 
 @end group
 @end smallexample
-- 
2.30.0.windows.2


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

* Re: [PATCH] manual: Correct argument order in mount examples (bug 27207)
  2021-01-21 15:57 [PATCH] manual: Correct argument order in mount examples (bug 27207) John McCabe
@ 2021-01-22 18:09 ` DJ Delorie via Libc-alpha
  2021-01-22 18:58   ` Re[2]: " John McCabe
  0 siblings, 1 reply; 4+ messages in thread
From: DJ Delorie via Libc-alpha @ 2021-01-22 18:09 UTC (permalink / raw)
  To: John McCabe; +Cc: libc-alpha

"John McCabe" <john@mccabe.org.uk> writes:
>  #include <sys/mount.h>
>  
> -mount("/dev/hdb", "/cdrom", MS_MGC_VAL | MS_RDONLY | MS_NOSUID, "");
> +mount("/dev/hdb", "/cdrom", "", MS_MGC_VAL | MS_RDONLY | MS_NOSUID, NULL);
>  
> -mount("/dev/hda2", "/mnt", MS_MGC_VAL | MS_REMOUNT, "");
> +mount("/dev/hda2", "/mnt", "", MS_MGC_VAL | MS_REMOUNT, NULL);
>  

The mount(2) man page says the last argument is:

       The data argument is interpreted by the different file systems.
       Typically it is a string of comma-separated options understood by
       this file system.  See mount(8) for details of the options
       available for each filesystem type.

and also says:

       EFAULT One of the pointer arguments points outside the user
              address space.

Based on that, I think the original "" is correct (or at least safer ;)
and that the manual was just missing the fstype argument.  I would be OK
with this patch, with that change.

But while we're here...

Also, I will point out that the options we pass are obsolete, and some
won't work in a post-2.4 world:

       The mountflags argument may have the magic number 0xC0ED
       (MS_MGC_VAL) in the top 16 bits (this was required in kernel
       versions prior to 2.4, but is no longer required and ignored if
       specified), and various mount flags in the low order 16 bits:

       MS_REMOUNT
              The following mountflags can be changed: MS_RDONLY,
              MS_SYNCHRONOUS, MS_MANDLOCK; before kernel 2.6.16, the
              following could also be changed: MS_NOATIME and
              MS_NODIRATIME; and, additionally, before kernel 2.4.10,
              the following could also be changed: MS_NOSUID, MS_NODEV,
              MS_NOEXEC.

That last paragraph is confusing; does it mean that ONLY before those
versions, or SINCE before those versions?

So we have an opportunity to update this part of our documentation, but
I won't hold back the bugfix for it.


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

* Re[2]: [PATCH] manual: Correct argument order in mount examples (bug 27207)
  2021-01-22 18:09 ` DJ Delorie via Libc-alpha
@ 2021-01-22 18:58   ` John McCabe
  2021-01-22 19:23     ` DJ Delorie via Libc-alpha
  0 siblings, 1 reply; 4+ messages in thread
From: John McCabe @ 2021-01-22 18:58 UTC (permalink / raw)
  To: DJ Delorie; +Cc: libc-alpha

[-- Attachment #1: Type: text/plain, Size: 2860 bytes --]

Thank you for that; that's a fair point.

For what it's worth, I suspect it actually invalidates the first mount 
command in the examples in the patch; while the filesystemtype is 
ignored when MS_REMOUNT is specified, it isn't ignored for MS_RDONLY and 
MS_NOSUID, so I suspect something like the attached update would be more 
appropriate (done using an "amend last commit";  would I be better to 
re-do the thing?)

As for your additional observations, I'm happy for them to be dealt with 
separately :-)

John

------ Original Message ------
From: "DJ Delorie" <dj@redhat.com>
To: "John McCabe" <john@mccabe.org.uk>
Cc: libc-alpha@sourceware.org
Sent: 22/01/2021 18:09:29
Subject: Re: [PATCH] manual: Correct argument order in mount examples 
(bug 27207)

>"John McCabe" <john@mccabe.org.uk> writes:
>>   #include <sys/mount.h>
>>
>>  -mount("/dev/hdb", "/cdrom", MS_MGC_VAL | MS_RDONLY | MS_NOSUID, "");
>>  +mount("/dev/hdb", "/cdrom", "", MS_MGC_VAL | MS_RDONLY | MS_NOSUID, NULL);
>>
>>  -mount("/dev/hda2", "/mnt", MS_MGC_VAL | MS_REMOUNT, "");
>>  +mount("/dev/hda2", "/mnt", "", MS_MGC_VAL | MS_REMOUNT, NULL);
>>
>
>The mount(2) man page says the last argument is:
>
>        The data argument is interpreted by the different file systems.
>        Typically it is a string of comma-separated options understood by
>        this file system.  See mount(8) for details of the options
>        available for each filesystem type.
>
>and also says:
>
>        EFAULT One of the pointer arguments points outside the user
>               address space.
>
>Based on that, I think the original "" is correct (or at least safer ;)
>and that the manual was just missing the fstype argument.  I would be OK
>with this patch, with that change.
>
>But while we're here...
>
>Also, I will point out that the options we pass are obsolete, and some
>won't work in a post-2.4 world:
>
>        The mountflags argument may have the magic number 0xC0ED
>        (MS_MGC_VAL) in the top 16 bits (this was required in kernel
>        versions prior to 2.4, but is no longer required and ignored if
>        specified), and various mount flags in the low order 16 bits:
>
>        MS_REMOUNT
>               The following mountflags can be changed: MS_RDONLY,
>               MS_SYNCHRONOUS, MS_MANDLOCK; before kernel 2.6.16, the
>               following could also be changed: MS_NOATIME and
>               MS_NODIRATIME; and, additionally, before kernel 2.4.10,
>               the following could also be changed: MS_NOSUID, MS_NODEV,
>               MS_NOEXEC.
>
>That last paragraph is confusing; does it mean that ONLY before those
>versions, or SINCE before those versions?
>
>So we have an opportunity to update this part of our documentation, but
>I won't hold back the bugfix for it.
>

[-- Attachment #2: 0001-manual-Correct-argument-order-in-mount-examples-bug-.patch --]
[-- Type: application/octet-stream, Size: 877 bytes --]

From 5023682c339b4113feb05688080c5984654462b6 Mon Sep 17 00:00:00 2001
From: John McCabe <jmccabe@kirintec.com>
Date: Tue, 19 Jan 2021 18:25:25 +0000
Subject: [PATCH] manual: Correct argument order in mount examples (bug 27207)
To: libc-alpha@sourceware.org

---
 manual/sysinfo.texi | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/manual/sysinfo.texi b/manual/sysinfo.texi
index 4ca4555443..1ca77adc7e 100644
--- a/manual/sysinfo.texi
+++ b/manual/sysinfo.texi
@@ -954,9 +954,9 @@ Example:
 @group
 #include <sys/mount.h>
 
-mount("/dev/hdb", "/cdrom", MS_MGC_VAL | MS_RDONLY | MS_NOSUID, "");
+mount("/dev/hdb", "/cdrom", "iso9660", MS_MGC_VAL | MS_RDONLY | MS_NOSUID, "");
 
-mount("/dev/hda2", "/mnt", MS_MGC_VAL | MS_REMOUNT, "");
+mount("/dev/hda2", "/mnt", "", MS_MGC_VAL | MS_REMOUNT, "");
 
 @end group
 @end smallexample
-- 
2.30.0.windows.2


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

* Re: [PATCH] manual: Correct argument order in mount examples (bug 27207)
  2021-01-22 18:58   ` Re[2]: " John McCabe
@ 2021-01-22 19:23     ` DJ Delorie via Libc-alpha
  0 siblings, 0 replies; 4+ messages in thread
From: DJ Delorie via Libc-alpha @ 2021-01-22 19:23 UTC (permalink / raw)
  To: John McCabe; +Cc: libc-alpha

"John McCabe" <john@mccabe.org.uk> writes:
> For what it's worth, I suspect it actually invalidates the first mount 
> command in the examples in the patch; while the filesystemtype is 
> ignored when MS_REMOUNT is specified, it isn't ignored for MS_RDONLY and 
> MS_NOSUID, so I suspect something like the attached update would be more 
> appropriate

Sure, it's just an example so "better example is better" :-)

> (done using an "amend last commit";  would I be better to 
> re-do the thing?)

Nah, the "don't rewrite history" rule doesn't kick in until it's
comitted somewhere public.  Besides, the hash changes when I add my
reviewed-by anyway, I think.

> As for your additional observations, I'm happy for them to be dealt with 
> separately :-)

So be it :-)


> -mount("/dev/hdb", "/cdrom", MS_MGC_VAL | MS_RDONLY | MS_NOSUID, "");
> +mount("/dev/hdb", "/cdrom", "iso9660", MS_MGC_VAL | MS_RDONLY | MS_NOSUID, "");
>  
> -mount("/dev/hda2", "/mnt", MS_MGC_VAL | MS_REMOUNT, "");
> +mount("/dev/hda2", "/mnt", "", MS_MGC_VAL | MS_REMOUNT, "");

LGTM.

Reviewed-by: DJ Delorie <dj@redhat.com>

Committed too :-)


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

end of thread, other threads:[~2021-01-22 19:23 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-01-21 15:57 [PATCH] manual: Correct argument order in mount examples (bug 27207) John McCabe
2021-01-22 18:09 ` DJ Delorie via Libc-alpha
2021-01-22 18:58   ` Re[2]: " John McCabe
2021-01-22 19:23     ` DJ Delorie via Libc-alpha

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).