Skip to content
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

stdenv: concatTo: fallback for non-__structuredAttrs derivations #334973

Merged
merged 2 commits into from
Aug 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions pkgs/stdenv/generic/setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -400,8 +400,15 @@ concatTo() {
-a*)
targetref+=( "${nameref[@]}" ) ;;
*)
# shellcheck disable=SC2206
targetref+=( ${nameref-} ) ;;
if [[ "$name" = *"Array" ]]; then
nixErrorLog "concatTo(): $name is not declared as array, treating as a singleton. This will become an error in future"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
nixErrorLog "concatTo(): $name is not declared as array, treating as a singleton. This will become an error in future"
nixErrorLog "concatTo(): $name is not declared as array, treating as a singleton. This will become an error in future."

Also, should this use nixWarnLog, since it's not an error, yet?

Copy link
Contributor

@wolfgangwalther wolfgangwalther Aug 17, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, just read this:

making it output a warning instead of failing (using log level "error", otherwise I couldn't see the warning without extra flags...):

Hm.. nixErrorLog is not used anywhere in nixpkgs right now. Although.. none of the other log functions are used either, except for nixTalkativeLog and nixWarnLog directly inside generic/setup.sh.

This makes me wonder whether this is really the right "tool" to use?

With my arguments in #335110 (comment), maybe we should just silently apply the fallback here and do all the warnings / errors only on the nix-level?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is right, since nixErrorLog just spits something out on stderr. It might become structured logging in the future.

# Reproduces https://github.com/NixOS/nixpkgs/pull/318614/files#diff-7c7ca80928136cfc73a02d5b28350bd900e331d6d304857053ffc9f7beaad576L359
targetref+=( ${nameref+"${nameref[@]}"} )
else
# shellcheck disable=SC2206
targetref+=( ${nameref-} )
fi
;;
esac
fi
done
Expand Down
2 changes: 2 additions & 0 deletions pkgs/tools/security/sudo/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ stdenv.mkDerivation (finalAttrs: {
# e.g. links to man pages, value constraints etc.
version = "1.9.15p5";

__structuredAttrs = true;

src = fetchurl {
url = "https://www.sudo.ws/dist/sudo-${finalAttrs.version}.tar.gz";
hash = "sha256-VY0QuaGZH7O5+n+nsH7EQFt677WzywsIcdvIHjqI5Vg=";
Expand Down