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

Replace netcat-openbsd with libressl #39634

Merged
merged 4 commits into from Apr 29, 2018

Conversation

matthewbauer
Copy link
Member

@matthewbauer matthewbauer commented Apr 28, 2018

Motivation for this change

Libressl comes with the netcat program. This is much more portable and from the exact same source as Debian's version.

/cc @WilliButz @ookhoi @dtzWill

@GrahamcOfBorg
Copy link

Success on x86_64-darwin (full log)

Attempted: libressl, netcat-gnu

Partial log (click to expand)

stripping (with command strip and flags -S) in /nix/store/54manzdzmz76b478pjqw6brvs5jn4m7y-libressl-2.5.5-bin/bin
patching script interpreter paths in /nix/store/54manzdzmz76b478pjqw6brvs5jn4m7y-libressl-2.5.5-bin
strip is /nix/store/kdff2gim6417493yha769kh00n63lnrw-cctools-binutils-darwin/bin/strip
stripping (with command strip and flags -S) in /nix/store/fgs67frjn3qz4fnkzqc12k1fmpfnim8c-libressl-2.5.5-dev/lib
patching script interpreter paths in /nix/store/fgs67frjn3qz4fnkzqc12k1fmpfnim8c-libressl-2.5.5-dev
strip is /nix/store/kdff2gim6417493yha769kh00n63lnrw-cctools-binutils-darwin/bin/strip
stripping (with command strip and flags -S) in /nix/store/8v9sxmabj4xbwhxnpd2haqjl6ksi57aq-libressl-2.5.5/lib
patching script interpreter paths in /nix/store/8v9sxmabj4xbwhxnpd2haqjl6ksi57aq-libressl-2.5.5
strip is /nix/store/kdff2gim6417493yha769kh00n63lnrw-cctools-binutils-darwin/bin/strip
patching script interpreter paths in /nix/store/s01404lk42kdhxkaxqqiafhh5rnl4j2l-libressl-2.5.5-man

@GrahamcOfBorg
Copy link

Success on x86_64-linux (full log)

Attempted: libressl, netcat-gnu

Partial log (click to expand)

stripping (with command strip and flags -S) in /nix/store/fsp9c5fazv7k8nxsvcqm74hgxbn3k4rj-libressl-2.5.5/lib
patching script interpreter paths in /nix/store/fsp9c5fazv7k8nxsvcqm74hgxbn3k4rj-libressl-2.5.5
checking for references to /build in /nix/store/fsp9c5fazv7k8nxsvcqm74hgxbn3k4rj-libressl-2.5.5...
shrinking RPATHs of ELF executables and libraries in /nix/store/xfw7f4y869q0c3frzr4chbccm4w8hph0-libressl-2.5.5-man
gzipping man pages under /nix/store/xfw7f4y869q0c3frzr4chbccm4w8hph0-libressl-2.5.5-man/share/man/
strip is /nix/store/j75dgadrff2d1fyc4fczmcgqkid2imdx-binutils-2.30/bin/strip
patching script interpreter paths in /nix/store/xfw7f4y869q0c3frzr4chbccm4w8hph0-libressl-2.5.5-man
checking for references to /build in /nix/store/xfw7f4y869q0c3frzr4chbccm4w8hph0-libressl-2.5.5-man...
/nix/store/cnnm8az8knygq84z1swvgirq7ngx6lk3-libressl-2.5.5-bin
/nix/store/v8xvjqcj8mavgnv1ir79gix09xwwv91n-netcat-gnu-0.7.1

@GrahamcOfBorg
Copy link

Success on aarch64-linux (full log)

Attempted: libressl, netcat-gnu

Partial log (click to expand)

stripping (with command strip and flags -S) in /nix/store/dvr9kshjpk52v5lc0pc46d4mfg08vfhr-libressl-2.5.5/lib
patching script interpreter paths in /nix/store/dvr9kshjpk52v5lc0pc46d4mfg08vfhr-libressl-2.5.5
checking for references to /build in /nix/store/dvr9kshjpk52v5lc0pc46d4mfg08vfhr-libressl-2.5.5...
shrinking RPATHs of ELF executables and libraries in /nix/store/bdspxs778gqj3zwd897kmcasb5hfhbrq-libressl-2.5.5-man
gzipping man pages under /nix/store/bdspxs778gqj3zwd897kmcasb5hfhbrq-libressl-2.5.5-man/share/man/
strip is /nix/store/j7d4mr0ikv974ig7yzhknpsq288js4bs-binutils-2.30/bin/strip
patching script interpreter paths in /nix/store/bdspxs778gqj3zwd897kmcasb5hfhbrq-libressl-2.5.5-man
checking for references to /build in /nix/store/bdspxs778gqj3zwd897kmcasb5hfhbrq-libressl-2.5.5-man...
/nix/store/w502vgdw0xvvlaqx7a7829a9znjhwx25-libressl-2.5.5-bin
/nix/store/4688g72pxm23drwza5paqikyqihkvfff-netcat-gnu-0.7.1

@dtzWill
Copy link
Member

dtzWill commented Apr 28, 2018

Woohoo! LGTM! Thank you! Looks good w/musl!

@@ -11,6 +11,8 @@ let
inherit sha256;
};

configureFlags = [ "--enable-nc" ];

enableParallelBuilding = true;

outputs = [ "bin" "dev" "out" "man" ];
Copy link
Member

Choose a reason for hiding this comment

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

Maybe a separate output for netcat? It feels weird to me that if I install netcat I also get a ssl library.

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes i can look into it. My hope was that it would be small enough to not matter though.

Copy link
Member Author

Choose a reason for hiding this comment

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

The problem with somethig like this is that it’s not obvious what is in the netcat output. For instance should nc.1 go in man or netcat?

Copy link
Member

Choose a reason for hiding this comment

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

Everything that belongs to netcat should also go there.

I still feel weird about doing this because it seems a little hacky
but this was requested by @Mic92 and seems understandable to not want
to mix up libressl outputs with netcat stuff.
@matthewbauer matthewbauer merged commit 6583ec5 into NixOS:master Apr 29, 2018
@aszlig
Copy link
Member

aszlig commented Apr 29, 2018

@matthewbauer: Be sure to note this in the release notes, because this is incompatible with openbsd-netcat. Most options are compatible, but for example there is no -q option in the version from libressl. The latter already breaks our hibernate test, so this should have a release note entry so that people are aware of this.

In the meantime, I'm going to fix the hibernate test...

@matthewbauer
Copy link
Member Author

Ok will do! They looked identical when I tried them but thanks for catching that.

@matthewbauer
Copy link
Member Author

matthewbauer commented Apr 29, 2018

Actually if it does really need it, we can probably still apply this patch (with minor modifications):

https://sources.debian.org/patches/netcat-openbsd/1.105-7/0006-quit-timer.patch/

Which enables the -q flag. We would definitely want to upstream it to OpenBSD. I strongly dislike Debian's tendency of "patch hording".

aszlig added a commit that referenced this pull request Apr 29, 2018
I'm not sure why 024b501 used -q 0
because even netcat-openbsd has the -N flag which IMO is the better way
to shutdown the socket on EOF.

Our default netcat implementation has changed once again[1] in
3c3b822 and we're now using LibreSSL's
implementation, which doesn't have a -q flag.

See #39634 for the pull request
introducing the switch.

[1]: #19982

Signed-off-by: aszlig <aszlig@nix.build>
Cc: @matthewbauer, @dtzWill, @Mic92
@matthewbauer
Copy link
Member Author

@aszlig Are the Nixpkgs release notes no longer used? I can definitely put the release note in nixos/doc/manual/rl-1809.xml just want to make sure that is the right place.

@aszlig
Copy link
Member

aszlig commented Apr 29, 2018

@matthewbauer: This is mainly a NixOS issue anyway, because netcat-openbsd is part of NixOS by default so scripts and services that depend on it might break due to the change. As for the release notes in general... we don't have a real nixpkgs release, only NixOS releases which ship a certain snapshot of nixpkgs with it.

Synthetica9 pushed a commit to Synthetica9/nixpkgs that referenced this pull request May 3, 2018
I'm not sure why 024b501 used -q 0
because even netcat-openbsd has the -N flag which IMO is the better way
to shutdown the socket on EOF.

Our default netcat implementation has changed once again[1] in
3c3b822 and we're now using LibreSSL's
implementation, which doesn't have a -q flag.

See NixOS#39634 for the pull request
introducing the switch.

[1]: NixOS#19982

Signed-off-by: aszlig <aszlig@nix.build>
Cc: @matthewbauer, @dtzWill, @Mic92
@linas
Copy link

linas commented May 9, 2019

FYI, we tripped over the missing -q flag in netcat here: opencog/opencog-nix#28

@dudebout
Copy link
Contributor

dudebout commented Jan 1, 2020

Note that this makes netcat hard to install from nix-env because it is provided in the nc output which is not part of outputsToInstall. A workaround is to use an overlay like:

self: super:
{
    netcat = super.libressl.overrideAttrs (oldAttrs: {
    meta = oldAttrs.meta // { outputsToInstall = [ "nc" ]; };
  });
}

@dudebout
Copy link
Contributor

dudebout commented Jan 2, 2020

Alternatively define a separate derivation for netcat-libressl as follows:

  # Hack around nix-env's inability to install outputs that are not in
  # outputsToInstall: nc(1) is in the "nc" output of the libressl package, but
  # "nc" is not in the outputsToInstall
  stdenv.mkDerivation {
    pname = "netcat-libressl";
    version = libressl.version;
    unpackPhase = "true";
    installPhase = ''
      mkdir $out
      cp -r ${libressl.nc}/* $out
    '';
  }

This makes it clearer which version of netcat it actually is, and where netcat is coming from when running nix-env -q.

@sebastianblunt
Copy link
Member

FWIW #101601 - the one from debian appears to be more portable.

@Artturin Artturin mentioned this pull request May 8, 2022
13 tasks
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

8 participants