Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merged PR 5078953: Work around Sexp crate issue with handling quotes
Work around Sexp crate issue with handling quotes The sexp crate has a bug around handling quoted strings that makes it impossible to differentiate between a quoted and an unquoted string. cgaebel/sexp#2 The short version is that quotes are added on output strings based on heuristics that include the presence of quotes in the original string, so giving a quoted string to sexp yields a doubly quoted string, and giving an unquoted string yields an unquoted string, resulting in no way to generate a Sexp structure that will output a quoted string with the Display trait, unless that string meets one of the following criteria: 1. Contains a quote 2. Contains whitespace 3. Is a number For CIL filecon statements, we need to include quoted strings, which meet none of these criteria. The sexp crate project appears to be abandoned, so a PR will not be fruitful. Rather than higher level of effort approaches such as forking the project or migrating to a different sexp crate, this commit simply works around the issue by adding a simple new display function that does no quote special handling. This requires us to manage quotes internally, but that's really what we want anyways."