Rethinking fsinfo()
Rethinking fsinfo()
Posted Aug 26, 2020 14:09 UTC (Wed) by flussence (guest, #85566)In reply to: Rethinking fsinfo() by zyga
Parent article: Rethinking fsinfo()
Anything that requires more than about half a kb of bash-builtins parsing code to deal with is too complicated, IMHO.
Posted Aug 26, 2020 19:36 UTC (Wed)
by unilynx (guest, #114305)
[Link]
Posted Aug 27, 2020 12:08 UTC (Thu)
by zyga (subscriber, #81533)
[Link] (3 responses)
As for parsing, please show me a correct /proc/self/mountinfo parser in shell. I'll wait. As another poster commented, jq handles that for shell scripts in a single-line correct and simple manner. The moment we step out of custom formats the kernel forces on us, the moment we start to have really rich set of tools for processing data.
And it doesn't have to be JSON. It should just not be ad-hoc, per-file convention with custom, brittle parser.
Posted Aug 27, 2020 13:10 UTC (Thu)
by kpfleming (subscriber, #23250)
[Link] (1 responses)
Posted Aug 28, 2020 13:13 UTC (Fri)
by mathstuf (subscriber, #69389)
[Link]
Don't forget that some parsers have baked in the extension proposals(!) in, so you have to pay attention to things like accidentally generating merge keys ("<<").
Posted Aug 28, 2020 12:13 UTC (Fri)
by mvdwege (guest, #113583)
[Link]
Best solution: discard the dogmatic adherence to 'it must be text'. If the primary consumer of the information is not a sysadmin at the console, use binary data and cut out the redundant parsing step. Yes, 'everything is an ASCII stream' makes things easily readable for humans, and it is great if you have text tools to write ad-hoc parsers for it. The problem is that you keep writing ad-hoc parsers. A little more pragmatism on this old UNIX dogma would be appreciated. I'm speaking as a sysadmin/developer who ran into this when I wanted to verify if my local MTA had successfully sent (aka received a 250 reply) an email. The only way to do that was to parse fscking syslog. In 2018. When tools like D-Bus notification already had existed for over a decade.
Rethinking fsinfo()
Rethinking fsinfo()
Rethinking fsinfo()
Rethinking fsinfo()
Rethinking fsinfo()