Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixed a nasty bug where JSON output validation was failing for `/proc/mounts` entries containing backslash characters. For example, ```bash $ grep crypt /proc/mounts tmpfs /run/credentials/systemd-cryptsetup@luks\134x2d3d322d7f\134x2d2f4f\134x2d45b1\134x2db73a\134x2d67ad0deff428.service tmpfs ro,seclabel,nosuid,nodev,noexec,relatime,nosymfollow,size=1024k,nr_inodes=1024,mode=700,inode64,noswap 0 0 ``` The mount directory was encoded literally such that the JSON output resulting from `procenv --format json` was invalid (since backslashes need to be escaped in JSON). The problem was not limited to JSON and was caused by two issues: - The string value passed to `section_open()` and `container_open()` being used literally, rather than being encoded like all other string values. - The translation table in `output.c` was not escaping the backslashes "enough" (moar backslashes please! :) Signed-off-by: James O. D. Hunt <[email protected]>
- Loading branch information