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

icon-lang: fix build #80714

Merged
merged 2 commits into from Mar 2, 2020
Merged

icon-lang: fix build #80714

merged 2 commits into from Mar 2, 2020

Conversation

KamilaBorowska
Copy link
Member

Motivation for this change

ZHF: #80379

@NixOS/nixos-release-managers

Things done
  • Tested using sandboxing (nix.useSandbox on NixOS, or option sandbox in nix.conf on non-NixOS linux)
  • Built on platform(s)
    • NixOS
    • macOS
    • other Linux distributions
  • Tested via one or more NixOS test(s) if existing and applicable for the change (look inside nixos/tests)
  • Tested compilation of all pkgs that depend on this change using nix-shell -p nixpkgs-review --run "nixpkgs-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • Determined the impact on package closure size (by running nix path-info -S before and after)
  • Ensured that relevant documentation is up to date
  • Fits CONTRIBUTING.md.

@KamilaBorowska
Copy link
Member Author

@GrahamcOfBorg build icon-lang noweb

@KamilaBorowska
Copy link
Member Author

KamilaBorowska commented Feb 21, 2020

noweb fails, but this seems unrelated to this pull request.

@KamilaBorowska
Copy link
Member Author

KamilaBorowska commented Feb 21, 2020

@GrahamcOfBorg build icon-lang noweb

I have no idea what's the difference with noweb, but that seems to work. noweb was broken by 65395a7, and I'm not sure if putting install-man on installTargets is the right fix. Originally, installTargets was a string, and that works, but I don't think it should be changed back into a string.

@KamilaBorowska
Copy link
Member Author

KamilaBorowska commented Feb 21, 2020

@GrahamcOfBorg build icon-lang noweb

Well, I guess I don't have to put install-man in installTargets. Would prefer to minimize my changes.

@yurrriq
Copy link
Member

yurrriq commented Feb 21, 2020

Seems good to me. Should we do a separate PR to fix installTargets?

@KamilaBorowska
Copy link
Member Author

@GrahamcOfBorg build icon-lang noweb

Copy link
Member

@yurrriq yurrriq left a comment

Choose a reason for hiding this comment

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

LGTM

@vcunat vcunat merged commit 4d954e5 into NixOS:master Mar 2, 2020
vcunat added a commit that referenced this pull request Mar 2, 2020
(cherry picked from commit 4d954e5)
@KoviRobi
Copy link
Contributor

KoviRobi commented Mar 2, 2020

Hmm, I know bash quoting is notoriously weird, but I think the change to noweb isn't right, let me think out loud (apologies, it isn't meant to be patronising, all the steps surprised me apart from the first one)

  • "cmd ${var[@]}" does cmd "${var[0]}" "${var[1]" ... "${var[n]}", so I can see why make "''${installFlags[@]}" install-man (note, in a doubly single-quoted string in nix, hence the ''${...}) would make sense.

  • I had no idea what "prefix ${var[@]} suffix" does, so I checked (in bash):

    print_args() {
        for a in "$@"; do
            echo $a
        done
    }
    typeset -a var=(1 2 3 4)
    print_args "hello ${var[@]} world"
    

    gives

    hello 1
    2
    3
    4 world
    

    So doing make "''${installFlags[@]} install-man" wouldn't make sense, because it would be like

    make "VAR1=VAL1" "VAR2=VAL2" ... "VARN=VALN install-man"
    

    I.e. it would just make the default target! Except, it gets even worse:

  • Turns out nix passes lists as space-separated values, so installFlags isn't an array, it's a single string:

    print_args "${installFlags[@]} install-man"
    

    gives (I have used ${placeholder out} instead of $out hence the root-relative hashes)

    BIN=/1rz4g4znpzjwh1xymhjpm42vipw92pr73vdgl6xs1hycac8kf2n9/bin ELISP=/1rz4g4znpzjwh1xymhjpm42vipw92pr73vdgl6xs1hycac8kf2n9/share/emacs/site-lisp LIB=/1rz4g4znpzjwh1xymhjpm42vipw92pr73vdgl6xs1hycac8kf2n9/lib/noweb MAN=/1rz4g4znpzjwh1xymhjpm42vipw92pr73vdgl6xs1hycac8kf2n9/share/man TEXINPUTS=/0wi6yxl11zryxm8g3s6iqz0karl3k4bc3zpvma0ci713wzid8ixw/tex/latex/noweb install-man
    

    so make only receives the variable BIN and it has the value /1rz... ELISP=... LIB=... MAN=... TEXINPUTS=... install-man, ouch! This certainly isn't what I expected.

    Which is how I got to my change of (on top of your change here):

    @@ -57,7 +57,7 @@ let noweb = stdenv.mkDerivation rec {
     
         # HACK: This is ugly, but functional.
         PATH=$out/bin:$PATH make -BC xdoc
    -    make "''${installFlags[@]} install-man"
    +    make ''${installFlags[@]} install-man
     
         ln -s "$tex" "$out/share/texmf"
       '';

    Granted, this will break if you have a space in any single element of installFlags :( I wonder if this is something to be changed in the way nix passes lists to derivations?

Also see #81042

EDIT: After reading the manual more, turns out there is a bash (not nix) variable installFlagsArray, now updating #81042 .

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants