Repository navigation
makeBinaryWrapper: If prefix/suffix already exists, remove the original - #451031
Merged
Merged
Conversation
This is mostly meant for `wrapQtApps`, which is why it's implemented only for `makeBinaryWrapper`. Qt apps are often launched on top of each other, creating a problem: many of the paths in `XDG_DATA_PATHS`, `QT_PLUGIN_PATH` and `NIXPKGS_QT6_QML_IMPORT_PATH` become duplicated, and these envars are already massive by themselves without this problem. Starting KDE Plasma, and most paths are seen twice. Open Konsole, and it becomes three times. If it was opened with CTRL+ALT+T, four times. Why is this a problem? - The more these paths are duplicated, the slower it becomes to copy the envars, and for the programs to parse them. - Some programs are buggy and malfunction if the environment variable block is too big. For instance, the EA App (via Wine) is unable to launch games if there are more than 32768 characters in the block, a number easily surpassable due to this problem. - It's ugly typing `env` and seeing this massive wall of duplicated paths. Because there is no reason for the same path to appear multiple times, this change removes a path if it's already in the list, adding it back to the start or the end.
|
This pull request has been mentioned on NixOS Discourse. There might be relevant details there: |
|
This pull request has been mentioned on NixOS Discourse. There might be relevant details there: |
|
This pull request has been mentioned on NixOS Discourse. There might be relevant details there: |
Contributor
Author
|
Small note about the EA App, the latest version of Wine intentionally doesn't import some environment variables in order to dampen the issue. But everything else still stands. |
github-merge-queue
Bot
removed this pull request from the merge queue due to failed status checks
Dec 11, 2025
Contributor
Author
3 of 13 tasks
This was referenced Mar 31, 2026
nixos-cuda-channel-updater Bot
pushed a commit
to nixos-cuda/nixpkgs
that referenced
this pull request
Jul 31, 2026
0fdcb95 (makeBinaryWrapper: If prefix/suffix already exists, remove the original (NixOS#451031), 2025-12-11) changed the C code generated by makeBinaryWrapper. The tests for makeBinaryWrapper check the exact code that's generated, so they need updating. Fixes NixOS#505339.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This is mostly meant for
wrapQtApps, which is why it's implemented only formakeBinaryWrapper.Qt apps are often launched on top of each other, creating a problem: many of the paths in
XDG_DATA_PATHS,QT_PLUGIN_PATHandNIXPKGS_QT6_QML_IMPORT_PATHbecome duplicated, and these envars are already massive by themselves without this problem.Starting KDE Plasma, and most paths are seen twice. Open Konsole, and it becomes three times. If it was opened with CTRL+ALT+T, four times.
Why is this a problem?
envand seeing this massive wall of duplicated paths.Because there is no reason for the same path to appear multiple times, this change removes a path if it's already in the list, adding it back to the start or the end.
Notes
I am unable to locally test this change due to the massive amount of rebuilds.
I did test the functionality of the C code outside nixpkgs.
In terms of performance, I tested adding new paths with both the old and new algorithm, and there is no measurable difference: it's basically dependent only on the length of the string, meaning that performance should be improved thanks to the deduplication.
If the path does exist, the algorithm is fast: I tested calling
set_env_prefixandset_env_suffixback and forth with the same value (80 characters long) 1000 times, on an environment variable that is 3000 characters long: it takes only about 1.5 ms.(Also, should this change apply only to the prefix and not the suffix?)
Things done
passthru.tests.nixpkgs-reviewon this PR. See nixpkgs-review usage../result/bin/.Add a 👍 reaction to pull requests you find important.
Footnotes
The problem is with the EA App itself, not Wine (the issue is also on Windows). I tried to contact EA, and obviously they ignored me. ↩