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

binutils and gcc manpages hidden by wrappers #43547

Closed
bgamari opened this issue Jul 15, 2018 · 24 comments
Closed

binutils and gcc manpages hidden by wrappers #43547

bgamari opened this issue Jul 15, 2018 · 24 comments

Comments

@bgamari
Copy link
Contributor

bgamari commented Jul 15, 2018

Issue description

The gcc and bin-utils wrappers don't expose the underlying derivations' man outputs.

Steps to reproduce

  1. nix run nixpkgs.binutils.man -c man ld
  2. Notice that the manpage is not found

Technical details

 - system: `"x86_64-linux"`
 - host os: `Linux 4.16.14, NixOS, 18.03.132646.08d245eb31a (Impala)`
 - multi-user?: `yes`
 - sandbox: `no`
 - version: `nix-env (Nix) 1.12pre5788_e3013543`
 - channels(root): `"nixos-18.03.132646.08d245eb31a, nixpkgs-18.09pre142651.95a8cb3ade1"`
 - channels(ben): `"nixpkgs-18.03pre126020.931a0b8be80"`
 - nixpkgs: `/nix/var/nix/profiles/per-user/root/channels/nixos/nixpkgs`
@bgamari
Copy link
Contributor Author

bgamari commented Jul 15, 2018

@Ericson2314, perhaps you know of an easy way to resolve this? Perhaps just symlink the manpages into the wrappers' output?

@infinisil
Copy link
Member

It seems to only propagate man pages via propagated-user-env-packages:

+ optionalString propagateDoc ''
##
## Man page and info support
##
mkdir -p $man/nix-support $info/nix-support
printWords ${cc.man or ""} > $man/nix-support/propagated-user-env-packages
printWords ${cc.info or ""} > $info/nix-support/propagated-user-env-packages
''

This has the problem of only working when you actually install it into a profile, see #43049.

The fix would be to add something like

ln -s ${cc.man}/share $man

@matthewbauer
Copy link
Member

matthewbauer commented Aug 1, 2018

@bgamari nix run has no knowledge of MANPATH. It only touches PATH. I think there may be a way to get MANPATH set based on PATH but I have never gotten that to work (multiple outputs probably break it).

For now you can do:

MANPATH=$(nix-build -E 'with import <nixpkgs> {}; lib.getOutput "man" stdenv.cc.bintools.bintools')/share/man man ld
MANPATH=$(nix-build -E 'with import <nixpkgs> {}; lib.getOutput "man" stdenv.cc.cc')/share/man man gcc

We definitely need a more versatile solution for this though.

A lot of people have setups to collect all of the manpages to install:

{
  packageOverrides = pkgs: with pkgs; {
    manpages = buildEnv {
      name = "manpages";
      paths = [ stdenv.cc.cc stdenv.cc.bintools.bintools ];
      extraOutputsToInstall = ["man"];
      pathsToLink = [ "/share/man" ];
    };
  };
}

Then you can just do nix-env -iA manpages. Then just do export MANPATH=$HOME/.nix-profile/share/man. But this is kind of a high bar to setup correctly.

@Ericson2314
Copy link
Member

Ericson2314 commented Aug 2, 2018

Yes this is just a mistake @oxij and I forgot to correct. It is done correctly in bintools-wrapper with nix-support/propagated-build-inputs, which is strictly stronger. The two wrapper scripts should work the same way.

@oxij
Copy link
Member

oxij commented Aug 3, 2018 via email

@Ericson2314
Copy link
Member

To be clear it's really my fault, not yours :). I added the binutils one and didn't update the original, so I just didn't finish the job. You didn't touch the propagation part at al, so that would have been an out out of scope change.

That said, if you could do this I'd really appreciate it. I have a few other things to tackle.

@oxij
Copy link
Member

oxij commented Aug 5, 2018

See #44516.

@oxij
Copy link
Member

oxij commented Aug 8, 2018 via email

@teto
Copy link
Member

teto commented Aug 9, 2018

Does that solve it for readelf too ? I couldn't get access to the man either (https://linux.die.net/man/1/readelf)

@oxij
Copy link
Member

oxij commented Aug 9, 2018 via email

@oxij
Copy link
Member

oxij commented Aug 24, 2018 via email

@Profpatsch
Copy link
Member

Was reverted in c981787

@Profpatsch Profpatsch reopened this Sep 5, 2018
@Ericson2314
Copy link
Member

:/

@oxij
Copy link
Member

oxij commented Sep 5, 2018 via email

@oxij
Copy link
Member

oxij commented Sep 5, 2018 via email

@edolstra
Copy link
Member

edolstra commented Sep 5, 2018

@oxij Don't worry, I have no desire to contribute to SLNOS.

Turning this around, I don't understand why these changes (moving from propagatedUserEnvPackages to symlinks) were made in the first place. Why are symlinks better?

@Ericson2314
Copy link
Member

@edolstra so nix-shell -p stdenv.cc.man works

@edolstra
Copy link
Member

edolstra commented Sep 5, 2018

nix run stdenv.cc.man works (with Nix 2.1).

@oxij
Copy link
Member

oxij commented Sep 5, 2018 via email

@Ericson2314
Copy link
Member

I can't get even nix run stdenv.cc.cc.man to work on whatever NixOS version I am on, so I am switching to a newer one.

@oxij
Copy link
Member

oxij commented Sep 5, 2018 via email

@Profpatsch
Copy link
Member

I opened a documentation request issue #46141. If we document these, tooling can add support to understand them (like nix 2.1 does).

@oxij
Copy link
Member

oxij commented Sep 6, 2018

So, a day and several hours of experiments later, I still think the correct way to proceed on the issue is to revert the reverts, i.e. merge #46115 as is (I also edited the reverted reverts a tiny bit there).

I wrote an explanation why the first patch of #46115 is the correct way to proceed on the issue in #46119 (comment) (also see the changes in #46119 to see the problem I didn't know I accidentally fixed it in #44558). Since I don't see any actual arguments against using symlinks, I think the second patch of #46115 should be applied too.

Hence, I would merge #46115 as is.

oxij added a commit to oxij/nixpkgs that referenced this issue Sep 23, 2018
02c09e0 (NixOS#44558) was reverted in
c981787 but, as it turns out, it fixed an issue
I didn't know about at the time: the values of `propagateDoc` options were
(and now again are) inconsistent with the underlying things those wrappers wrap
(see NixOS#46119), which was (and now is) likely to produce more instances
of NixOS#43547, if not now, then eventually as stdenv changes.

This patch (which is a simplified version of the original reverted patch) is the
simplest solution to this whole thing: it forces wrappers to directly inspect the
outputs of the things they are wrapping instead of making stdenv guess the correct
values.
@oxij
Copy link
Member

oxij commented Feb 18, 2019 via email

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

No branches or pull requests

8 participants