Bug#567071: what is the purpose of fstab-decode
[ Jonathan de Boyne Pollard ] > > [Dmitry Bogatov] > > Also, reference to fstab(5) and this particular paragraph may be useful: > > Not as much as you would think. The idiosyncratic encoding applies to > more than just that 1 field, and encodes more than what is stated, but > does not generalize to octal escaping as one might guess. fstab(5) may be not perfect, but it still contains information. I believe adding fstab(5) to SEE-ALSO of fstab-decode(8) would be useful. -- Note, that I send and fetch email in batch, once every 24 hours. If matter is urgent, try https://t.me/kaction --
Bug#567071: what is the purpose of fstab-decode
Dmitry Bogatov: > Also, reference to fstab(5) and this particular paragraph may be useful: Not as much as you would think. The idiosyncratic encoding applies to more than just that 1 field, and encodes more than what is stated, but does not generalize to octal escaping as one might guess.
Bug#567071: what is the purpose of fstab-decode
[2019-02-28 15:43] Jonathan de Boyne Pollard > > What exactly is decoded? Where should I read about escaping rules? > How it is different from plain `xargs'? > > You are suffering from the notoriously poor Linux documentation. (-: Thank you. Wouderful. I believe it should find its way into upstream distribution. Also, reference to fstab(5) and this particular paragraph may be useful: The second field (fs_file). This field describes the mount point (target) for the filesys‐ tem. For swap partitions, this field should be specified as `none'. If the name of the mount point contains spaces or tabs these can be escaped as `\040' and '\011' respectively. > The manuals for fstab on the BSDs explain that the fields are encoded , > so that they can contain whitespace characters, with strvis() and must > be decoded with strunvis() when read. The BSD C library getfsent() > function does this for one. > > It is pretty much undocumented, but roughly the same in fact holds true > for Linux operating systems and their C libraries. It is not the vis > encoding scheme, and is rather an encoding scheme that is peculiar to > fstab. But the fields are encoded so that they can contain whitespace > characters, and the getfsent() library function (or, actually, the > getmntent() library function in the GNU C library) does this for one. > > If you read fstab with a program like awk, it will of course read and > process the encoded forms. To actually get hold of the decoded forms, > so that they can be passed as arguments to programs that do not expect > them to be encoded, such as unmount in the example; one has to pass them > through a decoder program. fstab-decode is simply such a decoder > program. It runs all of its arguments through the decoder, and then > execs the result. -- Note, that I send and fetch email in batch, once every 24 hours. If matter is urgent, try https://t.me/kaction --
Bug#567071: what is the purpose of fstab-decode
Dmitry Bogatov: > What exactly is decoded? Where should I read about escaping rules? How it is different from plain `xargs'? You are suffering from the notoriously poor Linux documentation. (-: The manuals for fstab on the BSDs explain that the fields are encoded , so that they can contain whitespace characters, with strvis() and must be decoded with strunvis() when read. The BSD C library getfsent() function does this for one. It is pretty much undocumented, but roughly the same in fact holds true for Linux operating systems and their C libraries. It is not the vis encoding scheme, and is rather an encoding scheme that is peculiar to fstab. But the fields are encoded so that they can contain whitespace characters, and the getfsent() library function (or, actually, the getmntent() library function in the GNU C library) does this for one. If you read fstab with a program like awk, it will of course read and process the encoded forms. To actually get hold of the decoded forms, so that they can be passed as arguments to programs that do not expect them to be encoded, such as unmount in the example; one has to pass them through a decoder program. fstab-decode is simply such a decoder program. It runs all of its arguments through the decoder, and then execs the result.
Bug#567071: what is the purpose of fstab-decode
control: reopen -1 control: tags -1 -fixed-upstream +upstream [2019-02-21 15:08] Jesse Smith > I agree, the manual page for fstab-decode is vague, at best. I will add > a paragraph explaining what it does. The updated manual page will be > included in sysvinit-2.94. Maybe it is just me, but I still do not understand purpose of fstab-decode, therefore reopening bug. Here is manual from 2.94 (by the way, there is also fstab-decode.old somewhy in release tarball): fstab-decode decodes escapes (such as newline characters) in the speci‐ fied ARGUMENTs and uses them to run COMMAND. The argument escaping uses the same rules as path escaping in /etc/fstab, /etc/mtab and /proc/mtab. In essence fstab-decode can be used anytime we want to pass multiple parameters to a command as a list of command line argments. It turns output like this: /root /mnt/remote-disk /home Into one long list of parameters, "/root /mnt/remote-disk /home". This can be useful when trying to work with multiple filesystems at once. For instance, we can use it to unmount multiple NFS shares. EXAMPLES fstab-decode umount $(awk '$3 == "vfat" { print $2 }' /etc/fstab) What exactly is decoded? Where should I read about escaping rules? How it is different from plain `xargs'? -- Note, that I send and fetch email in batch, once every 24 hours. If matter is urgent, try https://t.me/kaction --
Bug#567071: what is the purpose of fstab-decode
control: tags -1 +fixed-upstream [2019-02-21 15:08] Jesse Smith > I agree, the manual page for fstab-decode is vague, at best. I will add > a paragraph explaining what it does. The updated manual page will be > included in sysvinit-2.94. -- Note, that I send and fetch email in batch, once every 24 hours. If matter is urgent, try https://t.me/kaction --
Bug#567071: what is the purpose of fstab-decode
I agree, the manual page for fstab-decode is vague, at best. I will add a paragraph explaining what it does. The updated manual page will be included in sysvinit-2.94. - Jesse