WARNING: THIS SITE IS A MIRROR OF GITHUB.COM / IT CANNOT LOGIN OR REGISTER ACCOUNTS / THE CONTENTS ARE PROVIDED AS-IS / THIS SITE ASSUMES NO RESPONSIBILITY FOR ANY DISPLAYED CONTENT OR LINKS / IF YOU FOUND SOMETHING MAY NOT GOOD FOR EVERYONE, CONTACT ADMIN AT ilovescratch@foxmail.com
Skip to content

Empty-string sub-attribute fails the build for __structuredAttrs = true #14765

@ShamrockLee

Description

@ShamrockLee

Describe the bug

Steps To Reproduce

  1. Clone Nixpkgs and change the working directory to its project root.
  2. Run
    nix-build --no-out-link --expr '
      (import ./. { }).stdenvNoCC.mkDerivation {
        __structuredAttrs = true;
        name = "test-structured-empty-subattr";
        foo = { "" = true; };
        buildCommand = "touch \$out";
      }
    '
  3. See the error.
    this derivation will be built:
      /nix/store/0m0h23b1f09ir63xiq7yckd4rvsr61av-test-structured-empty-subattr.drv
    building '/nix/store/0m0h23b1f09ir63xiq7yckd4rvsr61av-test-structured-empty-subattr.drv'...
    /build/.attrs.sh: line 16: ['']='1': bad array subscript
    error: builder for '/nix/store/0m0h23b1f09ir63xiq7yckd4rvsr61av-test-structured-empty-subattr.drv' failed with exit code 1;
           last 1 log lines:
           > /build/.attrs.sh: line 16: ['']='1': bad array subscript
           For full logs, run:
             nix log /nix/store/0m0h23b1f09ir63xiq7yckd4rvsr61av-test-structured-empty-subattr.drv
    

Expected behavior

The above derivation build.

Metadata

nix-env (Nix) 2.28.5

Additional context

Checklist


Add 👍 to issues you find important.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions