Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)

ddclient: Force line buffering on stdout

Status messages of ddclient go to stdout, which is block buffered by
default, so most of its output won't appear in the journal until it is
exiting:

-- Reboot --
Apr 19 11:31:04 xen systemd[1]: Starting Dynamic DNS Client...
Apr 19 11:31:04 xen systemd[1]: Started Dynamic DNS Client.
Apr 19 11:31:53 xen systemd[1]: Stopping Dynamic DNS Client...
Apr 19 11:31:53 xen ddclient[530]: === opt ====
Apr 19 11:31:53 xen ddclient[530]: opt{cache} : <undefined>
Apr 19 11:31:53 xen ddclient[530]: opt{cmd} : <undefined>
...

Fix this by adding a patch to set line buffering on stdout.

+21 -1
+20
pkgs/tools/networking/ddclient/ddclient-line-buffer-stdout.patch
···
··· 1 + diff -u ddclient-3.8.1/ddclient ddclient-3.8.1.patched/ddclient 2 + --- ddclient-3.8.1/ddclient 2011-07-11 23:04:21.000000000 +0200 3 + +++ ddclient-3.8.1.patched/ddclient 2012-11-08 11:52:31.930647236 +0100 4 + @@ -19,6 +19,7 @@ use strict; 5 + use Getopt::Long; 6 + use Sys::Hostname; 7 + use IO::Socket; 8 + +use IO::Handle qw( ); 9 + 10 + my ($VERSION) = q$Revision: 157 $ =~ /(\d+)/; 11 + 12 + @@ -675,7 +676,7 @@ $SIG{'TERM'} = sub { $caught_term = 1; }; 13 + $SIG{'KILL'} = sub { $caught_kill = 1; }; 14 + # don't fork() if foreground or force is on 15 + if (opt('foreground') || opt('force')) { 16 + - ; 17 + + STDOUT->autoflush(1); 18 + } elsif (opt('daemon')) { 19 + $SIG{'CHLD'} = 'IGNORE'; 20 + my $pid = fork;
+1 -1
pkgs/tools/networking/ddclient/default.nix
··· 10 11 buildInputs = [ perlPackages.IOSocketSSL perlPackages.DigestSHA1 ]; 12 13 - patches = [ ./ddclient-foreground.patch ]; 14 15 # Use iproute2 instead of ifconfig 16 preConfigure = ''
··· 10 11 buildInputs = [ perlPackages.IOSocketSSL perlPackages.DigestSHA1 ]; 12 13 + patches = [ ./ddclient-foreground.patch ./ddclient-line-buffer-stdout.patch ]; 14 15 # Use iproute2 instead of ifconfig 16 preConfigure = ''