[CentOS] Need fstab-decode for CentOS 8

Mon Feb 28 14:46:28 UTC 2022
Robert Nichols <rnicholsNOSPAM at comcast.net>

On 2/28/22 1:22 AM, centos at niob.at wrote:
> Am 28.02.22 um 05:45 schrieb Robert Nichols:
>> On 2/27/22 12:26 PM, centos at niob.at wrote:
>>> Am 27.02.22 um 04:33 schrieb Robert Nichols:
>>>> Does anything for CentOS 8 provide the function of the fstab-decode utility?
>>>> Entries in /proc/mounts and /etc/fstab can have escape sequences for certain special characters, and I need to decode that. 
>>> Preface: Never heard of fstab-decode before. Researching the command made me really wonder why it was invented. Especially since I have never seen an /etc/fstab with "escape sequences" or "special characters" since at least 1990 (If I am wrong: Please show me such a fstab file).
>>> So why not just use:
>>>      umount $(awk '$3 == "vfat" {print $2}' /etc/fstab)
>>> instead of the seemingly canonical use of fstab-decode
>>>      fstab-decode umount $(awk '$3 == "vfat" { print $2 }' /etc/fstab)
>> Those samples break if the mount point directory name contains spaces, tabs, or whatever other characters I don't know about that also get represented by escape sequences. I'm not actually using it with /etc/fstab, but with /proc/mounts which uses the same convention. I can control /etc/fstab and avoid the problem, but I cannot control how some auto-mounted foreign filesystem might be named. I have a script that needs to be robust in the face of such names.
> Get creative! Unix administration is a creative job. Having said this:
> Using white space within mount points is asking for trouble anyway. If you really want this in the most generic way, then do the unquoting with something like this:
>      awk '$3 == "vfat" {print $2}' /etc/fstab | perl -pl000 -e 's/\\([0-7]{3})/chr(oct($1))/eg' | xargs -0 -n 1 -r umount
> This seems to be the unixy way to do this.

Yes, white space in mount points is asking for trouble, but if someone automounts a USB flash drive filesystem which has a label that includes white space (e.g.: "USB DISK", like the VFAT preformat on some that I have bought) or other "funny" characters, that label gets used as the mount point directory.

Indeed, I can re-invent the wheel if that wheel is lost in the sands of time.

Bob Nichols     "NOSPAM" is really part of my email address.
                 Do NOT delete it.