Commit Graph

13 Commits

Author SHA1 Message Date
Archit Gupta
d75cae80fa makeBinaryWrapper: fix read past NUL
When setting a prefix for a path-like environment variable, the
deduplication code in set_env_prefix reads past the NUL byte at the end
of the env val and into the next entry. This corrupts the resultant env
value with data from the next env var, or other data sitting after it.
2026-08-04 17:46:56 -07:00
Ihar Hrachyshka
9feb9be821 makeBinaryWrapper: fix passthru.extractCmd on darwin (#483719) 2026-07-21 00:28:08 +00:00
Arne Keller
74ebbfaf0b make{Script; Binary}Wrapper: log if target file does not exist (#384765) 2026-07-04 10:59:59 +00:00
Sigmanificient
0bbc8dffae treewide: set meta.license on hooks 2026-05-25 13:48:20 +02:00
Ihar Hrachyshka
6057da3eea makeBinaryWrapper: fix passthru.extractCmd on darwin
On darwin, strings does not support -d. Regardless of darwin, the
generated extract script has `strings` without a full nix store path,
making it potentially impure.

The solution is to always pull `strings` from GNU toolchain, regardless
of the platform.

Note: this change should have no implications for darwin bootstrap
because `passthru.extractCmd` has very limited use in the tree,
basically only used when building Firefox, and is not evaluated
otherwise.

Note: previous attempt to resolve the issue was incorrect, effectively
doing nothing on Darwin, see #379014. (The
`targetPackages.gnuStdenv.cc.bintools.targetPrefix` was empty.)
2026-01-25 13:46:35 -05:00
Martino Fontana
5a23a56feb makeBinaryWrapper: If prefix/suffix already exists, remove the original
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.
2025-10-11 17:09:23 +02:00
Pol Dellaiera
7b29eecc2b makeBinaryWrapper: use GNU bintools for extractCmd (#379014) 2025-06-10 04:31:11 +02:00
BirdeeHub
7b9c6346ff makeWrapper: --add-flag and --append-flag arguments
also:

manual: differences in makeWrapper implementations better explained

Update pkgs/by-name/ma/makeBinaryWrapper/make-binary-wrapper.sh

Co-authored-by: Naïm Camille Favier <n@monade.li>

Update pkgs/by-name/ma/makeBinaryWrapper/make-binary-wrapper.sh

Co-authored-by: Naïm Camille Favier <n@monade.li>

Update pkgs/by-name/ma/makeBinaryWrapper/make-binary-wrapper.sh

Co-authored-by: Naïm Camille Favier <n@monade.li>

Update pkgs/build-support/setup-hooks/make-wrapper.sh

Co-authored-by: Naïm Camille Favier <n@monade.li>

Update pkgs/build-support/setup-hooks/make-wrapper.sh

Co-authored-by: Naïm Camille Favier <n@monade.li>

Update pkgs/build-support/setup-hooks/make-wrapper.sh

Co-authored-by: Naïm Camille Favier <n@monade.li>

Update pkgs/by-name/ma/makeBinaryWrapper/make-binary-wrapper.sh

Co-authored-by: Naïm Camille Favier <n@monade.li>

Update pkgs/build-support/setup-hooks/make-wrapper.sh

Co-authored-by: Naïm Camille Favier <n@monade.li>

Update pkgs/by-name/ma/makeBinaryWrapper/make-binary-wrapper.sh

Co-authored-by: Naïm Camille Favier <n@monade.li>

Update pkgs/build-support/setup-hooks/make-wrapper.sh

Co-authored-by: Naïm Camille Favier <n@monade.li>
2025-04-25 12:57:29 -07:00
Ihar Hrachyshka
a919a6e611 makeBinaryWrapper: use GNU bintools for extractCmd
Only GNU supports the -d flag used. In a different environment, the
command fails as follows:

strings: error: unknown argument '-d'

Note: I believe it was not noticed because the command is used in
Firefox wrapper only where its failure is silently swallowed. The only
side effect then is that the wrapper won't work as expected when
wrapping a wrapper.

Signed-off-by: Ihar Hrachyshka <ihar.hrachyshka@gmail.com>
2025-04-03 20:48:17 -04:00
Wroclaw
bd17e51cde makeBinaryWrapper: warn if target file does not exist 2025-02-24 14:25:17 +01:00
Tristan Ross
3aadd30566 makeBinaryWrapper: fix compiling with clang 2025-01-16 20:29:09 -08:00
Silvan Mosberger
4f0dadbf38 treewide: format all inactive Nix files
After final improvements to the official formatter implementation,
this commit now performs the first treewide reformat of Nix files using it.
This is part of the implementation of RFC 166.

Only "inactive" files are reformatted, meaning only files that
aren't being touched by any PR with activity in the past 2 months.
This is to avoid conflicts for PRs that might soon be merged.
Later we can do a full treewide reformat to get the rest,
which should not cause as many conflicts.

A CI check has already been running for some time to ensure that new and
already-formatted files are formatted, so the files being reformatted here
should also stay formatted.

This commit was automatically created and can be verified using

    nix-build a08b3a4d19.tar.gz \
      --argstr baseRev b32a094368
    result/bin/apply-formatting $NIXPKGS_PATH
2024-12-10 20:26:33 +01:00
aleksana
571c71e6f7 treewide: migrate packages to pkgs/by-name, take 1
We are migrating packages that meet below requirements:

1. using `callPackage`
2. called path is a directory
3. overriding set is empty (`{ }`)
4. not containing path expressions other than relative path (to
makenixpkgs-vet happy)
5. not referenced by nix files outside of the directory, other
than`pkgs/top-level/all-packages.nix`
6. not referencing nix files outside of the directory
7. not referencing `default.nix` (since it's changed to `package.nix`)
8. `outPath` doesn't change after migration

The tool is here: https://github.com/Aleksanaa/by-name-migrate.
2024-11-09 20:04:51 +08:00