On Thu, Mar 01, 2018 at 11:04:34PM -0800, Jonathan Nieder wrote: > > Use of uninitialized value $_ in print at > > /usr/lib/git-core/git-add--interactive line 1371, <STDIN> line 75. > [...] > > Strange. The relevant line, for reference: > > $ dpkg-deb --fsys-tarfile git_2.11.0-3+deb9u2_amd64.deb | > tar Oxf - ./usr/lib/git-core/git-add--interactive | > sed -n '1370,1372 p' > > for (@{$hunk[$ix]{DISPLAY}}) { > print; <---- this one > } > > This is a foreach loop, so it's supposed to have set $_ to each value > in the list @{$hunk[$ix]{DISPLAY}). So why is Perl considering it > uninitialized? Because the array is full of "undef". See parse_diff(), which does this: my @diff = run_cmd_pipe("git", @diff_cmd, "--", $path); ... @colored = run_cmd_pipe(@display_cmd); ... for (my $i = 0; $i < @diff; $i++) { ... push @{$hunk[-1]{TEXT}}, $diff[$i]; push @{$hunk[-1]{DISPLAY}}, (@colored ? $colored[$i] : $diff[$i]); } If the @colored output is shorter than the normal @diff output, we'll push a bunch of "undef" onto the DISPLAY array (the ternary there is because sometimes @colored is completely empty if the user did not ask for color). -Peff