From e2372502d3d0503711ea792a74292373286e5c8f Mon Sep 17 00:00:00 2001 From: sternenseemann Date: Sun, 30 Oct 2016 02:52:47 +0200 Subject: [PATCH 1/2] netcat: make netcat-openbsd the default netcat (#19411) The motivation for this change is the following: As gnu-netcat, e. g. does not support ipv6, it is not suitable as default netcat. This commit also fixes all obvious build issues caused by this change. --- nixos/tests/hibernate.nix | 4 ++-- nixos/tests/virtualbox.nix | 12 ++++++------ pkgs/applications/misc/playonlinux/default.nix | 4 ++-- pkgs/build-support/vm/windows/bootstrap.nix | 4 ++-- pkgs/build-support/vm/windows/controller/default.nix | 6 +++--- pkgs/build-support/vm/windows/default.nix | 2 +- .../xfce/panel-plugins/xfce4-sensors-plugin.nix | 6 +++--- .../networking/{netcat => netcat-gnu}/default.nix | 0 pkgs/top-level/all-packages.nix | 4 +++- 9 files changed, 22 insertions(+), 20 deletions(-) rename pkgs/tools/networking/{netcat => netcat-gnu}/default.nix (100%) diff --git a/nixos/tests/hibernate.nix b/nixos/tests/hibernate.nix index 787929f8904d..7616a75b0214 100644 --- a/nixos/tests/hibernate.nix +++ b/nixos/tests/hibernate.nix @@ -13,7 +13,7 @@ import ./make-test.nix (pkgs: { networking.firewall.allowedTCPPorts = [ 4444 ]; - systemd.services.listener.serviceConfig.ExecStart = "${pkgs.netcat}/bin/nc -l -p 4444"; + systemd.services.listener.serviceConfig.ExecStart = "${pkgs.netcat}/bin/nc -l 4444"; }; probe = { config, lib, pkgs, ...}: { @@ -36,7 +36,7 @@ import ./make-test.nix (pkgs: { $machine->waitForShutdown; $machine->start; $probe->waitForUnit("network.target"); - $probe->waitUntilSucceeds("echo test | nc -c machine 4444"); + $probe->waitUntilSucceeds("echo test | nc machine 4444"); ''; }) diff --git a/nixos/tests/virtualbox.nix b/nixos/tests/virtualbox.nix index 02a8fc680280..376c4f21dc04 100644 --- a/nixos/tests/virtualbox.nix +++ b/nixos/tests/virtualbox.nix @@ -299,9 +299,9 @@ let -pf /run/dhclient.pid \ -v eth0 eth1 - otherIP="$(${pkgs.netcat}/bin/netcat -clp 1234 || :)" + otherIP="$(${pkgs.netcat}/bin/nc -l 1234 || :)" ${pkgs.iputils}/bin/ping -I eth1 -c1 "$otherIP" - echo "$otherIP reachable" | ${pkgs.netcat}/bin/netcat -clp 5678 || : + echo "$otherIP reachable" | ${pkgs.netcat}/bin/nc -l 5678 || : ''; sysdDetectVirt = pkgs: '' @@ -461,11 +461,11 @@ in mapAttrs mkVBoxTest { my $test1IP = waitForIP_test1 1; my $test2IP = waitForIP_test2 1; - $machine->succeed("echo '$test2IP' | netcat -c '$test1IP' 1234"); - $machine->succeed("echo '$test1IP' | netcat -c '$test2IP' 1234"); + $machine->succeed("echo '$test2IP' | nc '$test1IP' 1234"); + $machine->succeed("echo '$test1IP' | nc '$test2IP' 1234"); - $machine->waitUntilSucceeds("netcat -c '$test1IP' 5678 >&2"); - $machine->waitUntilSucceeds("netcat -c '$test2IP' 5678 >&2"); + $machine->waitUntilSucceeds("nc '$test1IP' 5678 >&2"); + $machine->waitUntilSucceeds("nc '$test2IP' 5678 >&2"); shutdownVM_test1; shutdownVM_test2; diff --git a/pkgs/applications/misc/playonlinux/default.nix b/pkgs/applications/misc/playonlinux/default.nix index 4050f8bf5894..b604905320b2 100644 --- a/pkgs/applications/misc/playonlinux/default.nix +++ b/pkgs/applications/misc/playonlinux/default.nix @@ -7,7 +7,7 @@ , gnupg1compat , icoutils , imagemagick -, netcat +, netcat-gnu , p7zip , python2Packages , unzip @@ -34,7 +34,7 @@ let gnupg1compat icoutils imagemagick - netcat + netcat-gnu p7zip unzip wget diff --git a/pkgs/build-support/vm/windows/bootstrap.nix b/pkgs/build-support/vm/windows/bootstrap.nix index ebea819b1910..3b06d8f47490 100644 --- a/pkgs/build-support/vm/windows/bootstrap.nix +++ b/pkgs/build-support/vm/windows/bootstrap.nix @@ -1,5 +1,5 @@ { stdenv, fetchurl, vmTools, writeScript, writeText, runCommand, makeInitrd -, python, perl, coreutils, dosfstools, gzip, mtools, netcat, openssh, qemu +, python, perl, coreutils, dosfstools, gzip, mtools, netcat-gnu, openssh, qemu , samba, socat, vde2, cdrkit, pathsFromGraph, gnugrep }: @@ -10,7 +10,7 @@ with stdenv.lib; let controller = import ./controller { inherit stdenv writeScript vmTools makeInitrd; - inherit samba vde2 openssh socat netcat coreutils gzip gnugrep; + inherit samba vde2 openssh socat netcat-gnu coreutils gzip gnugrep; }; mkCygwinImage = import ./cygwin-iso { diff --git a/pkgs/build-support/vm/windows/controller/default.nix b/pkgs/build-support/vm/windows/controller/default.nix index 06a0a2293064..9009702113ea 100644 --- a/pkgs/build-support/vm/windows/controller/default.nix +++ b/pkgs/build-support/vm/windows/controller/default.nix @@ -1,5 +1,5 @@ { stdenv, writeScript, vmTools, makeInitrd -, samba, vde2, openssh, socat, netcat, coreutils, gnugrep, gzip +, samba, vde2, openssh, socat, netcat-gnu, coreutils, gnugrep, gzip }: { sshKey @@ -79,7 +79,7 @@ let ${coreutils}/bin/chmod 600 /ssh.key '' + (if installMode then '' echo -n "Waiting for Windows installation to finish..." - while ! ${netcat}/bin/netcat -z 192.168.0.1 22; do + while ! ${netcat-gnu}/bin/netcat -z 192.168.0.1 22; do echo -n . # Print a dot every 10 seconds only to shorten line length. ${coreutils}/bin/sleep 10 @@ -118,7 +118,7 @@ let ${samba}/sbin/smbd -D echo -n "Waiting for Windows VM to become available..." - while ! ${netcat}/bin/netcat -z 192.168.0.1 22; do + while ! ${netcat-gnu}/bin/netcat -z 192.168.0.1 22; do echo -n . ${coreutils}/bin/sleep 1 done diff --git a/pkgs/build-support/vm/windows/default.nix b/pkgs/build-support/vm/windows/default.nix index f9f1d75c70d6..c668e7569a44 100644 --- a/pkgs/build-support/vm/windows/default.nix +++ b/pkgs/build-support/vm/windows/default.nix @@ -3,7 +3,7 @@ pkgs: let bootstrapper = import ./bootstrap.nix { inherit (pkgs) stdenv vmTools writeScript writeText runCommand makeInitrd; - inherit (pkgs) coreutils dosfstools gzip mtools netcat openssh qemu samba; + inherit (pkgs) coreutils dosfstools gzip mtools netcat-gnu openssh qemu samba; inherit (pkgs) socat vde2 fetchurl python perl cdrkit pathsFromGraph; inherit (pkgs) gnugrep; }; diff --git a/pkgs/desktops/xfce/panel-plugins/xfce4-sensors-plugin.nix b/pkgs/desktops/xfce/panel-plugins/xfce4-sensors-plugin.nix index 770f34490235..3314d313ad2c 100644 --- a/pkgs/desktops/xfce/panel-plugins/xfce4-sensors-plugin.nix +++ b/pkgs/desktops/xfce/panel-plugins/xfce4-sensors-plugin.nix @@ -1,5 +1,5 @@ { stdenv, fetchurl, pkgconfig, intltool, gnome2, libxfce4ui, - libxfce4util, xfce4panel, libnotify, lm_sensors, hddtemp, netcat + libxfce4util, xfce4panel, libnotify, lm_sensors, hddtemp, netcat-gnu }: stdenv.mkDerivation rec { @@ -26,14 +26,14 @@ stdenv.mkDerivation rec { libnotify lm_sensors hddtemp - netcat + netcat-gnu ]; enableParallelBuilding = true; configureFlags = [ "--with-pathhddtemp=${hddtemp}/bin/hddtemp" - "--with-pathnetcat=${netcat}/bin/netcat" + "--with-pathnetcat=${netcat-gnu}/bin/netcat" ]; meta = { diff --git a/pkgs/tools/networking/netcat/default.nix b/pkgs/tools/networking/netcat-gnu/default.nix similarity index 100% rename from pkgs/tools/networking/netcat/default.nix rename to pkgs/tools/networking/netcat-gnu/default.nix diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index fc0d7f1f6063..df4f8d066eca 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -2795,7 +2795,9 @@ in netboot = callPackage ../tools/networking/netboot {}; - netcat = callPackage ../tools/networking/netcat { }; + netcat = netcat-openbsd; + + netcat-gnu = callPackage ../tools/networking/netcat-gnu { }; netcat-openbsd = callPackage ../tools/networking/netcat-openbsd { }; From bbe9159725d73a77922953b3cd17c862451ba59a Mon Sep 17 00:00:00 2001 From: sternenseemann Date: Sun, 30 Oct 2016 02:54:19 +0200 Subject: [PATCH 2/2] netcat-openbsd: install man page --- pkgs/tools/networking/netcat-openbsd/default.nix | 1 + 1 file changed, 1 insertion(+) diff --git a/pkgs/tools/networking/netcat-openbsd/default.nix b/pkgs/tools/networking/netcat-openbsd/default.nix index e71abcd8a2c8..9933b512006f 100644 --- a/pkgs/tools/networking/netcat-openbsd/default.nix +++ b/pkgs/tools/networking/netcat-openbsd/default.nix @@ -21,6 +21,7 @@ stdenv.mkDerivation rec { installPhase = '' install -Dm0755 nc $out/bin/nc + install -Dm0644 nc.1 $out/share/man/man1/nc.1 ''; meta = {