-
-
Notifications
You must be signed in to change notification settings - Fork 18.5k
Texlive package descriptions not properly escaped #365173
Description
Describe the bug
Let's look at texlivePackages.addlines as an example. The description on search.nixos.org says "A user-friendly wrapper around enlargethispage". But when looking at https://ctan.org/pkg/addlines?lang=en, it says "A user-friendly wrapper around \enlargethispage" instead. Note the missing backslash
The issue is that the string of the description is copied verbatim into tlpdb.nix: shortdesc = "A user-friendly wrapper around \enlargethispage";. But within Nix strings, escaping rules apply, and \e will become e, thus swallowing the backslash.
Possible solutions
The easiest solution would be to add a sed to properly escape the input, or even simply to switch to using '' strings instead of ", as their escaping rules are a lot less likely to be hit accidentally.
The probably best and most clean solution would be to switch over the entire package index to JSON, as a) this will automatically yield proper escaping without having to worry about the quirks of escaping rules in the Nix language, and b) should yield a performance gain as JSON is faster to parse than Nix.
Additional context
The root issue lies in the Nix language: Escapes like \x->x should never have been introduced in the first place. In this case, the issue may be benign (slightly wrong package descriptions), but there are several cases in Nixpkgs where such escapes have produced blatantly wrong code. Therefore I would like to move towards getting rid of such escapes Nixpkgs-wide.
Notify maintainers
@veprbl @lovek323 @raskin @jwiegley @xworld21
Note for maintainers: Please tag this issue in your PR.
Add a 👍 reaction to issues you find important.