Skip to content

--print-build-logs|-L ignores empty lines #11991

@ysndr

Description

@ysndr

Describe the bug

Empty lines printed by the builder of a derivation are not echo'ed to the build log,
despite being present in the build log of the derivation.

Steps To Reproduce

A minimal derivation that supposedly prints 5 lines.

# repro.nix

let buildscript = builtins.toFile "build.sh" ''
	#!/bin/sh
	echo "start"
	echo
	echo
	echo
	echo "end"
	: > $out
'';
in
builtins.derivation {
	name = "repro";
	builder = "/bin/sh";
	args = [ buildscript ];
	outputs = [ "out" ];
	system = builtins.currentSystem;
}

Build with nix

$ nix build -f ./repro.nix -L [--rebuild]
$ nix log -f ./repro.nix | cat

Expected behavior

Output should be the same for both commands and contain newlines

$ nix build -f ./repro.nix -L [--rebuild]
repro> start
repro>
repro>
repro>
repro> end
$nix log -f ./repro.nix | cat
start



end

Actual behavior

The build logs do not contain new-lines

$ nix build -f ./repro.nix -L [--rebuild]
repro> start
repro> end
$ nix log -f ./repro.nix | cat
start



end

Metadata

nix-env (Nix) 2.24.10

Checklist


Add 👍 to issues you find important.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugderivation-buildThe process of building an individual derivation (see also sandbox label)good first issueQuick win for first-time contributors
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions