-
-
Notifications
You must be signed in to change notification settings - Fork 14.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
lib.generators.toPlist: escape XML syntax in strings & keys #356502
Conversation
|
This is clearly an improvement, and would be nice for nix-darwin. However I’m a bit worried about the Hyrum’s law implications here, since it is likely that people are already doing manual escaping to work around this in the wild. It may have to be an option, or else perhaps renaming the function and gradually deprecating the old one. |
Nice catch! I hadn't thought about that. An initial glance at public uses of If it were up to me it would just be a breaking change in the next version, but to be honest I'm not used to working on projects this large, so I guess that's up to you! |
In an ideal world we’d do that, but |
I have made the changes you suggested. Escaping is now disabled by default :^) |
Could you squash your PR please? |
4320e8e
to
9da2f54
Compare
Should be done know? |
Thanks. Will let our library owners chime in now. |
Sooo... can we merge this now, or which "library owners" should I reach out to? :^) |
@infinisil @Profpatsch friendly ping. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is looking almost perfect, just a minor improvement to automate the deprecation a bit more :)
Before this patch, code like this would break generate invalid XML: lib.generators.toPlist {} "ab<cd" That's obviously bad, since the call to toPlist often happens through indirection, as is the case in e.g. the nix-darwin project. A user might not realize that they have to escape the strings. This patch adds the argument 'escape' to lib.generators.plist and emits a warning if it is not set to true. In a future release, this behavior should become the default. I have also added a note for future maintainers, in case I forget to actually remove the deprecated functionality in a future release.
b4163c1
to
d1cb670
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, looking good!
Before this patch, code like this would break generate invalid XML.
That's obviously bad, since the call to toPlist often happens through indirection, as is the case in e.g. the nix-darwin project.
Things done
nix.conf
? (See Nix manual)sandbox = relaxed
sandbox = true
nix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD"
. Note: all changes have to be committed, also see nixpkgs-review usage./result/bin/
)Add a 👍 reaction to pull requests you find important.