Bug#1033630: debian-installer: should fstab swap entries use "sw" as option?

2023-04-05 Thread Christoph Anton Mitterer
Hey.

Just for the records and those who stumble over this and are interested
in the outcome.

upstream clarified fstab syntax in:
https://github.com/util-linux/util-linux/commit/43a6b183d8945cc91307f21adc8070254eb925b5

- whether the 4th field is mandatory is now in kind of a limbo... the
  manpage says it's not for mount(8)/swapon(8) but implies that it
  might be needed for other parsers
- it's further clarified what "defaults" actually means and that the
  previously given "rw, suid, dev, exec, auto, nouser, and async" is 
  just the typical meaning for many filesystems.

So my conclusion from that would be that the cosmetically proper swap
entry would be any of:

   none swap defaults 0 0
   none swap defaults
   none swap

(from which I'd think the first one is the one that most people will
likely find familiar)

unlike Debian's:

   none swap sw 0 0

which works of course but uses the undocumented/legacy? "sw" option.
Since the bug was already rejected I think it's pointless to provide a
PR that switches from "sw" to "defaults".


Cheers,
Chris.



Bug#1033630: debian-installer: should fstab swap entries use "sw" as option?

2023-03-29 Thread Christoph Anton Mitterer
On Wed, 2023-03-29 at 15:46 +0200, Cyril Brulebois wrote:
> Closing as not a bug. If you want an actual bug to get fixed, please
> file a specific bug report, describing what's not working correctly.

Well you could call usage of a non-documented option a bug, but if
improvement is apparently not desired, fine for me.

Cheers,
Chris.



Bug#1033630: debian-installer: should fstab swap entries use "sw" as option?

2023-03-29 Thread Christoph Anton Mitterer
On Wed, 2023-03-29 at 03:38 +, David wrote:
> I think the formal specification of the fstab format would be
> 'man 3 getfsent' because that is the canonical method to
> parse /etc/fstab.

Uhm, but that doesn't really describe which fields are necessary
either. So it would be the actual code which would be the definition...
but that's typically a bad idea to use as a standard.

Nevertheless, getfsent(3) still mentions "sw" and even "xx" and "rq".


> Perhaps 'sw' in field 4 became obsolete. What does it achieve?
> 
> It does seem redundant to have to specify both 'swap' and 'sw'
> for every swap partition. And if we have to specify 'sw' in field 4,
> how is it an "option"?

Well I guess it's an indication for the 4th field *not* being optional
and "defaults" not being considered (or even present back in BSD) for
swap.


> Anyway, just to be clear, I'm not the person advocating change here.

Sure, me neither. :-)

Just trying to find out what would be the "best" value (from a cosmetic
PoV).

For that purpose I posted at util-linux mailing list, asking for their
opinion and whether fstab(5) could be clarified accordingly:
https://lore.kernel.org/util-linux/45fc7a385b006d734011a11487fbfdda4333644e.ca...@christoph.anton.mitterer.name/T/#u


I think this issue here can be put on hold, until things have been
clarified there.


> I am simply sharing the fact that I have configured swap in
> /etc/fstab
> with blank field 4,5 and 6, as I showed previously, for as long as I
> can
> remember, without experiencing any problem. And I have explained
> my reasoning about that, when requested.

Sure,.. but for that purpose, "sw" could be simply kept either (it also
works). :-)

This issue was really just from the cosmetic PoV, about what is
considered to be the "canonical" way of doing it (if there's any).


Thanks,
Chris.



Bug#1033630: debian-installer: should fstab swap entries use "sw" as option?

2023-03-28 Thread David
On Wed, 29 Mar 2023 at 02:49, Christoph Anton Mitterer
 wrote:
> On Wed, 2023-03-29 at 02:25 +, David wrote:

> > My thought process is as follows:
> > Field 4 is for mount options. This is just the same as providing
> > options to the 'mount' command issued at the command line.
> > And it is ok to use the 'mount' command without options.
>
> Well that's clear and it probably just works like that in the end.
>
> But still, if the manpage is considered the "formal specification" of
> the fstab format, than 4th field seems to be needed.
> That even says: "contains at least the type of mount (ro or rw)", which
> would be fulfilled by default (as that implies rw).
>
> That's what I've meant by strictly speaking before... parsers of fstab
> could in principle rely on that.

I think the formal specification of the fstab format would be
'man 3 getfsent' because that is the canonical method to
parse /etc/fstab.

I agree that reading the manpage like a lawyer probably
isn't helpful.

Perhaps 'sw' in field 4 became obsolete. What does it achieve?

It does seem redundant to have to specify both 'swap' and 'sw'
for every swap partition. And if we have to specify 'sw' in field 4,
how is it an "option"?

Perhaps it is a historic artifact that does nothing. Perhaps it
predates 'swap' being recognised in field 3, and then documentation
of 'sw' wasn't removed when 'swap' was introduced.
I don't know the history.

If codesearch doesn't show anything using FSTAB_SW then
perhaps it just does not matter.

Anyway, just to be clear, I'm not the person advocating change here.

I am simply sharing the fact that I have configured swap in /etc/fstab
with blank field 4,5 and 6, as I showed previously, for as long as I can
remember, without experiencing any problem. And I have explained
my reasoning about that, when requested.

I hope that helps :)



Bug#1033630: debian-installer: should fstab swap entries use "sw" as option?

2023-03-28 Thread Christoph Anton Mitterer
On Wed, 2023-03-29 at 02:25 +, David wrote:
> My thought process is as follows:
> Field 4 is for mount options. This is just the same as providing
> options to the 'mount' command issued at the command line.
> And it is ok to use the 'mount' command without options.

Well that's clear and it probably just works like that in the end.

But still, if the manpage is considered the "formal specification" of
the fstab format, than 4th field seems to be needed.
That even says: "contains at least the type of mount (ro or rw)", which
would be fulfilled by default (as that implies rw).

That's what I've meant by strictly speaking before... parsers of fstab
could in principle rely on that.


I guess a simpler way might be to use:
… rw,auto,nouser 0 0

cause that what it effectively seems to be.


Or... improve the fstab manpage... because it doesn't make sense IMO to
say that it "contains at least the type of mount (ro or rw)" while
leaving auto/noauto optional (with a default).



Cheers,
Chris.



Bug#1033630: debian-installer: should fstab swap entries use "sw" as option?

2023-03-28 Thread David
On Wed, 29 Mar 2023 at 01:56, Christoph Anton Mitterer
 wrote:
> On Wed, 2023-03-29 at 01:41 +, David wrote:

> > Yes, for many years using Debian stable, my swap lines in
> > /etc/fstab look like this:
> >   none  swap
>
> Hmm, I'm not sure whether strictly speaking it's allowed to skip the
> 4th field.
> The manpage explicitly documents so for the 5th and the 6th, but not
> for the 4th.
>
> So it's questionable if all possible tools which may parse fstab really
> deal with that gracefully.
> Plus users might be confused and expect 6 fields.

My thought process is as follows:
Field 4 is for mount options. This is just the same as providing
options to the 'mount' command issued at the command line.
And it is ok to use the 'mount' command without options.

Regarding omitting 'sw', I'm not seeing any problem.
This might be a good starting point to investigate whether
anything uses it:
  https://codesearch.debian.net/search?q=FSTAB_SW&literal=1



Bug#1033630: debian-installer: should fstab swap entries use "sw" as option?

2023-03-28 Thread Christoph Anton Mitterer
On Wed, 2023-03-29 at 01:41 +, David wrote:
> Yes, for many years using Debian stable, my swap lines in
> /etc/fstab look like this:
>   none  swap

Hmm, I'm not sure whether strictly speaking it's allowed to skip the
4th field.
The manpage explicitly documents so for the 5th and the 6th, but not
for the 4th.

So it's questionable if all possible tools which may parse fstab really
deal with that gracefully.
Plus users might be confused and expect 6 fields.


Cheers,
Chris.



Bug#1033630: debian-installer: should fstab swap entries use "sw" as option?

2023-03-28 Thread David
On Wed, 29 Mar 2023 at 00:54, Christoph Anton Mitterer
 wrote:
> On Wed, 2023-03-29 at 00:49 +, David wrote:

> > In that situation, field 4 has to be non-blank, which is when setting
> > it to "defaults" becomes useful.
> >
> > Otherwise, putting "defaults" in field 4 achieves nothing, because
> > defaults are defaults so there is no reason to specify them.
>
> Does that imply you'd simply skip fields 4 to 6 for swap entries?

Yes, for many years using Debian stable, my swap lines in
/etc/fstab look like this:
  none  swap



Bug#1033630: debian-installer: should fstab swap entries use "sw" as option?

2023-03-28 Thread Christoph Anton Mitterer
On Wed, 2023-03-29 at 00:49 +, David wrote:
> In that situation, field 4 has to be non-blank, which is when setting
> it
> to "defaults" becomes useful.
> 
> Otherwise, putting "defaults" in field 4 achieves nothing, because
> defaults
> are defaults so there is no reason to specify them.

Does that imply you'd simply skip fields 4 to 6 for swap entries?



Bug#1033630: debian-installer: should fstab swap entries use "sw" as option?

2023-03-28 Thread David
On Wed, 29 Mar 2023 at 00:33, Christoph Anton Mitterer
 wrote:

> Anyway... maybe it makes sense to use some other value, most likely
> "defaults" then...

Hi, the only time that "defaults" should be used in field 4 of /etc/fstab is
when a value to the right of it (field 5 or 6) are required to be non-empty
AND no non-default options are required.

In that situation, field 4 has to be non-blank, which is when setting it
to "defaults" becomes useful.

Otherwise, putting "defaults" in field 4 achieves nothing, because defaults
are defaults so there is no reason to specify them.



Bug#1033630: debian-installer: should fstab swap entries use "sw" as option?

2023-03-28 Thread Christoph Anton Mitterer
Source: debian-installer
Version: 20230217
Severity: minor


Hey.

In the end this is probably anyway completely ignored, so consider this
just a cosmetic issue:


AFAICS, the installer cretes swap entries in fstab as:
 none swap sw 0 0

https://salsa.debian.org/installer-team/partman-basicfilesystems/-/blob/master/fstab.d/basic#L32
and also at least there:
https://salsa.debian.org/installer-team/partman-swapfile/-/blob/master/finish.d/fstab_swapfile#L10

I wondered whether "sw" is still the "canonical" value for the 4th field.

fstab(5) describes the appropriate values for swap for fields 1 to 3
(inclusive).
But it gives nothing about the 4th.
Neither do e.g. the manpages mount(8) or swapon(8).

I briefly tried to track down where the "sw" actually came from, seems
it might be from BDS times?


Anyway... maybe it makes sense to use some other value, most likely
"defaults" then... or perhaps "auto,nouser"?
"defaults" would be a bit misleading as its documented to be:
   defaults
   use default options: rw, suid, dev, exec, auto, nouser, and async.
which most make no sense for swap.
So perhaps "auto,nouser" would be the most reasonable ones?


Alternatively, this should perhaps be reassigned to mount, with the request
that "sw" is documented somehow, and if it's just that it's ignored for
entries of type swap.
Sidenote: It doesn't seem as if the 4th field would be generally ignored
for swap, e.g. nofail, noauto are considered.


Cheers,
Chris.