Friday, May 3, 2024
 Popular · Latest · Hot · Upcoming
82
rated 0 times [  82] [ 0]  / answers: 1 / hits: 3919  / 2 Years ago, thu, october 6, 2022, 8:20:34

This is more like a general Linux / programming question, but I've been programming for a while, and I'm used to using a format such as XML or JSON on any file which is used for configuration purposes.



Being new to Linux, I realized that the first configuration file I bumped into (/etc/fstab) uses some sort of table format. So why not XML or JSON?


More From » fstab

 Answers
3

/etc/fstab is much older than XML and JSON, and as quite a lot of programs use it changing its format would be a nightmare.



Besides this /etc/fstab needs to be parsed before there is a functional system as it is used to mount all essential file systems. Hence the format of /etc/fstab should be as simple as possible as the parser should not depend on any external libs.



Parsing XML is quite difficult and you really want to avoid it if you can't relay on external libs. JSON is a bit easier but still quite difficult.



The semantics of /etc/fstab are quite simple, they don't include any tree-like data structures or any other fancy stuff. All you need is records consisting of six values.



Whitepace-separated values are good enough for that, and they are easy to parse even if all you have is the C standard libs.



So there's just no reason to use JSON, XML or something similar.


[#26486] Friday, October 7, 2022, 2 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
bsorbedeldy

Total Points: 315
Total Questions: 110
Total Answers: 108

Location: Reunion
Member since Mon, Dec 28, 2020
3 Years ago
;