5 ms·
Systemd/systemd – shared: add minimal JSON tokenizer
- unmole 12y agoAnd so it begins...
- pavlov 12y agoA system configuration tool needs to parse configuration files in a modern format? Shocking. The Only True Unix way is to invent an ad hoc configuration format with arbitrary rules about line breaks, tabulators and separator characters, incomplete Unicode support and confusing issues around whitespace escaping.
- oblio 12y agoDon't forget that the config format should also evolve until it is Turing complete, creating a crappy scripting language, instead of: a) separating configuration values from code b) embedding an established interpreter
- Sanddancer 12y agoThe problem here is that Poettering ignored the numerous other small json libraries, like json-c, which is 69k compiled as a static library, and jansson, which is 89k as a static library, and built his own. Which means there's yet one more library out there to test against to make sure one's own stuff works without problem. This is developer bravado with no real benefit.
- lomnakkus 12y agoWhat are you talking about? JSON is a standard -- it doesn't matter which implementation you use as long as it conforms. (Indeed, that is the point of JSON.) Of course being written in C, this implementation isn't likely to be able to handle arbitrary-precision numbers, but then neither do jansson nor json-c AFAIK.
- fsniper 12y agoHe is very clear about Poettering's NIH syndrome. There are many established c libraries out there but he feels he needs to implement everything himself.
- lomnakkus 12y agoNo, the systemd people probably just wanted to avoid an dependency that they don't control.
- fsniper 12y agoThat is exactly nih syndrom told in another way.
- lomnakkus 12y agoNo. There are many very valid reasons to want to avoid 3rd party dependencies.
- fsniper 12y ago(I am trying to be sincere here please don't take it any other way) Could you please tell me few reasons against code reuse? And as a bonus; a reasonable case for reimplementing everything in systemd ecosystem would be very appreciated.
- lomnakkus 12y agoHave you ever run a big C or C++ project? Dependencies in these languages are not a good thing -- especially if it's for such a trivial thing as JSON parsing. (If you want more, I'll be happy unless you're just being facetious. In which case, see below.) > And as a bonus; a reasonable case for reimplementing everything in systemd ecosystem would be very appreciated. Oh, fuck off. EDIT: What I meant to say in that last sentence is: I realize that I could have been more upfront about what the tradeoffs are, but if you're just going to spew bullshit like "NIH!" over and over without anything to back it up, then I don't care to engage in a serious discussion with you. Indeed, I think it might not be possible to engage in a serious disccusion with you. Hence, "fuck off".
- spydum 12y agoHmmm, just browsing the diff and spotted something odd to me : is that pretty typical code style to write: for (;;) ? Why not while (true)?
- lelf 12y agoIt is (for plain C). For while (true) you'd need <stdbool.h>. As for “for (;;)” vs “while (1)” I'd say the former is still more common.
- Flow 12y agoI like toml files. https://github.com/toml-lang/toml https://github.com/toml-lang/toml
- nly 12y agoLooks good. I was just about to post how I think JSON is crappy as a config format and how I really liked INI. TOML seems to be very INI-like. Any software actually using it? Anyone know any other config file targeted formats? I'm not keen on YAML for config. There's libconfig (and assoc. format), but, imho, it's a bit complex
- Flow 12y agoRust's package system, Cargo, uses it. See http://doc.crates.io/guide.html http://doc.crates.io/guide.html for an example.
- captainmuon 12y agoAs much as I dislike systemd, to use a standard format like JSON for config files looks like a really good idea. I would however prefer if it used a lenient superset (allowing comments and trailing commas in lists, maybe also unquoted keys). Something like JSON5 ( http://json5.org/ http://json5.org/ ). The requirements for config files and for a wire-format are different (easily human-writable vs. strict standard). Also, this is really, really something that would be better placed in a library. (If you don't want to avoid dynamic dependencies, then make it a source library or link staticly.)
- mondoshawan 12y agoJson. Seriously. In a replacement for init. And syslog. And ifconfig. Which already parses and understands XML. And other config files. And so on. Why am I not surprised? I give up.
- Spidler 12y agoFor those who wonder, it's a dependency needed for the userspace parts that import docker images into "native" systemd-nspawn containers. It's not actually used in pid 1, but in the userspace tooling.
- james2vegas 12y agodiff --git a/src/shared/xml.h b/src/shared/xml.h to weed out the less than <C99 compilers? heh