Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 548876 - hooks/post-receive.gentoo-commits: uninitialized value $field - difficult to reproduce
Summary: hooks/post-receive.gentoo-commits: uninitialized value $field - difficult to ...
Status: CONFIRMED
Alias: None
Product: Gentoo Infrastructure
Classification: Unclassified
Component: Git (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Gentoo Infrastructure
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-05-07 21:23 UTC by Robin Johnson
Modified: 2018-06-28 09:39 UTC (History)
3 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Robin Johnson archtester Gentoo Infrastructure gentoo-dev Security 2015-05-07 21:23:58 UTC
Tommy[D] reported this on #gentoo-infra a few days ago. I could not reproduce it, as the code should always have it defined.

remote: Warning: Use of uninitialized value $field in string eq at ./hooks/post-receive.gentoo-commits line 374.
remote: Warning: Use of uninitialized value $field in string eq at ./hooks/post-receive.gentoo-commits line 389.
remote: Warning: Use of uninitialized value $field in string eq at ./hooks/post-receive.gentoo-commits line 389.
remote: Warning: Use of uninitialized value $field in hash element at ./hooks/post-receive.gentoo-commits line 414.
remote: Warning: Use of uninitialized value $field in string eq at ./hooks/post-receive.gentoo-commits line 374.
remote: Warning: Use of uninitialized value $field in string eq at ./hooks/post-receive.gentoo-commits line 389.
remote: Warning: Use of uninitialized value $field in string eq at ./hooks/post-receive.gentoo-commits line 389.
remote: Warning: Use of uninitialized value $field in hash element at ./hooks/post-receive.gentoo-commits line 414.
Comment 1 Robin Johnson archtester Gentoo Infrastructure gentoo-dev Security 2015-05-07 21:26:19 UTC
I added a detection block in cfengine.git:6dba36f and cfengine.git:70f09bb that asks users to report it here.
Comment 2 Robin Johnson archtester Gentoo Infrastructure gentoo-dev Security 2015-05-07 21:29:18 UTC
Here's the original problematic code, before the warning per comment #1 was made, which shifted the lines after line 373 by +3 lines.

368)            foreach my $line (split("\n", $rawcommit)) {
369)                    if($inheader eq 1) {
370)                            if ($line or length($line) > 0) {
371)                                    my @fields = split(/\s+/, $line);
372)                                    my $field = shift(@fields);
373) 
374)                                    if ($inpgpsig || $field eq "gpgsig") {
...
387)                                    }
388) 
389)                                    if($field eq "author" or $field eq "committer") {
...
412)                                    }
413)                                    else {
414)                                            $data{$field} = join(" ", @fields);
415)                                    }
Comment 3 Robin Johnson archtester Gentoo Infrastructure gentoo-dev Security 2015-05-07 21:30:14 UTC
mrueg reports it happened on this commit:
https://gitweb.gentoo.org/user/mrueg.git/commit/?id=aa6d4f2525dfc4e84b50592f17795e8e4b5993d3
Comment 4 Robin Johnson archtester Gentoo Infrastructure gentoo-dev Security 2015-05-07 21:31:17 UTC
Mrueg's comment triggered the warning output of:
Warning: $field is undefined, input line was ' ';
Comment 5 Robin Johnson archtester Gentoo Infrastructure gentoo-dev Security 2015-05-07 22:10:32 UTC
I added a more detailed error output, as well as a possible fix, if the problem lies in the gpgsig header. Testing welcomed after the change is deployed by cfengine (give it 45 minutes for good measure, so say after 2015/05/07 23:00 UTC).
Comment 6 Robin Johnson archtester Gentoo Infrastructure gentoo-dev Security 2015-05-08 19:11:32 UTC
Ok, it was inside the gpgsig header, which can legitimately contain otherwise blank lines with leading whitespace.

Thanks for helping debug. There is a fix in place for it now.
Comment 7 Thomas Sachau gentoo-dev 2015-10-04 11:43:40 UTC
seems like this was not completly fixed, got the messages again after merging tags 2.2.19 to 2.2.22 into the multilib branch of portage and pushing that:


git push
Zähle Objekte: 48, Fertig.
Delta compression using up to 8 threads.
Komprimiere Objekte: 100% (48/48), Fertig.
Schreibe Objekte: 100% (48/48), 20.28 KiB | 0 bytes/s, Fertig.
Total 48 (delta 35), reused 0 (delta 0)
remote: Warning: $field is undefined, input line (#10) was '', previous field was ' '; please report the repo & commitid to Gentoo bug #548876
remote: Warning: Use of uninitialized value $field in string eq at ./hooks/post-receive.gentoo-commits line 391.
remote: Warning: Use of uninitialized value $field in string eq at ./hooks/post-receive.gentoo-commits line 406.
remote: Warning: Use of uninitialized value $field in string eq at ./hooks/post-receive.gentoo-commits line 406.
remote: Warning: Use of uninitialized value $field in hash element at ./hooks/post-receive.gentoo-commits line 431.
remote: Warning: $field is undefined, input line (#14) was '', previous field was ' '; please report the repo & commitid to Gentoo bug #548876
remote: Warning: Use of uninitialized value $field in string eq at ./hooks/post-receive.gentoo-commits line 391.
remote: Warning: Use of uninitialized value $field in string eq at ./hooks/post-receive.gentoo-commits line 406.
remote: Warning: Use of uninitialized value $field in string eq at ./hooks/post-receive.gentoo-commits line 406.
remote: Warning: Use of uninitialized value $field in hash element at ./hooks/post-receive.gentoo-commits line 431.
remote: Warning: $field is undefined, input line (#10) was '', previous field was ' '; please report the repo & commitid to Gentoo bug #548876
remote: Warning: Use of uninitialized value $field in string eq at ./hooks/post-receive.gentoo-commits line 391.
remote: Warning: Use of uninitialized value $field in string eq at ./hooks/post-receive.gentoo-commits line 406.
remote: Warning: Use of uninitialized value $field in string eq at ./hooks/post-receive.gentoo-commits line 406.
remote: Warning: Use of uninitialized value $field in hash element at ./hooks/post-receive.gentoo-commits line 431.
remote: Warning: $field is undefined, input line (#14) was '', previous field was ' '; please report the repo & commitid to Gentoo bug #548876
remote: Warning: Use of uninitialized value $field in string eq at ./hooks/post-receive.gentoo-commits line 391.
remote: Warning: Use of uninitialized value $field in string eq at ./hooks/post-receive.gentoo-commits line 406.
remote: Warning: Use of uninitialized value $field in string eq at ./hooks/post-receive.gentoo-commits line 406.
remote: Warning: Use of uninitialized value $field in hash element at ./hooks/post-receive.gentoo-commits line 431.
remote: Warning: $field is undefined, input line (#10) was '', previous field was ' '; please report the repo & commitid to Gentoo bug #548876
remote: Warning: Use of uninitialized value $field in string eq at ./hooks/post-receive.gentoo-commits line 391.
remote: Warning: Use of uninitialized value $field in string eq at ./hooks/post-receive.gentoo-commits line 406.
remote: Warning: Use of uninitialized value $field in string eq at ./hooks/post-receive.gentoo-commits line 406.
remote: Warning: Use of uninitialized value $field in hash element at ./hooks/post-receive.gentoo-commits line 431.
remote: Warning: $field is undefined, input line (#14) was '', previous field was ' '; please report the repo & commitid to Gentoo bug #548876
remote: Warning: Use of uninitialized value $field in string eq at ./hooks/post-receive.gentoo-commits line 391.
remote: Warning: Use of uninitialized value $field in string eq at ./hooks/post-receive.gentoo-commits line 406.
remote: Warning: Use of uninitialized value $field in string eq at ./hooks/post-receive.gentoo-commits line 406.
remote: Warning: Use of uninitialized value $field in hash element at ./hooks/post-receive.gentoo-commits line 431.
remote: Warning: $field is undefined, input line (#10) was '', previous field was ' '; please report the repo & commitid to Gentoo bug #548876
remote: Warning: Use of uninitialized value $field in string eq at ./hooks/post-receive.gentoo-commits line 391.
remote: Warning: Use of uninitialized value $field in string eq at ./hooks/post-receive.gentoo-commits line 406.
remote: Warning: Use of uninitialized value $field in string eq at ./hooks/post-receive.gentoo-commits line 406.
remote: Warning: Use of uninitialized value $field in hash element at ./hooks/post-receive.gentoo-commits line 431.
remote: Warning: $field is undefined, input line (#14) was '', previous field was ' '; please report the repo & commitid to Gentoo bug #548876
remote: Warning: Use of uninitialized value $field in string eq at ./hooks/post-receive.gentoo-commits line 391.
remote: Warning: Use of uninitialized value $field in string eq at ./hooks/post-receive.gentoo-commits line 406.
remote: Warning: Use of uninitialized value $field in string eq at ./hooks/post-receive.gentoo-commits line 406.
remote: Warning: Use of uninitialized value $field in hash element at ./hooks/post-receive.gentoo-commits line 431.
remote: Warning: $field is undefined, input line (#10) was '', previous field was ' '; please report the repo & commitid to Gentoo bug #548876
remote: Warning: Use of uninitialized value $field in string eq at ./hooks/post-receive.gentoo-commits line 391.
remote: Warning: Use of uninitialized value $field in string eq at ./hooks/post-receive.gentoo-commits line 406.
remote: Warning: Use of uninitialized value $field in string eq at ./hooks/post-receive.gentoo-commits line 406.
remote: Warning: Use of uninitialized value $field in hash element at ./hooks/post-receive.gentoo-commits line 431.
remote: Warning: $field is undefined, input line (#14) was '', previous field was ' '; please report the repo & commitid to Gentoo bug #548876
remote: Warning: Use of uninitialized value $field in string eq at ./hooks/post-receive.gentoo-commits line 391.
remote: Warning: Use of uninitialized value $field in string eq at ./hooks/post-receive.gentoo-commits line 406.
remote: Warning: Use of uninitialized value $field in string eq at ./hooks/post-receive.gentoo-commits line 406.
remote: Warning: Use of uninitialized value $field in hash element at ./hooks/post-receive.gentoo-commits line 431.
To git+ssh://git@git.gentoo.org/proj/portage.git
   cf7284c..0c879b9  multilib -> multilib
Comment 8 Robin Johnson archtester Gentoo Infrastructure gentoo-dev Security 2015-10-07 05:54:45 UTC
Ok, I reproduced the remaining error case.

It's specifically caused by doing a non-fast-forward merge of a SIGNED tag, which adds a 'mergetag' block to the raw commit. The body of that block starts with lines with a leading space.

We need to put together a better parser for the raw commits, one that handles continued lines properly
Comment 9 Thomas Sachau gentoo-dev 2018-01-07 10:15:27 UTC
Any status update for this? I am still getting those warnings, when merging commits into the multilib branch of portage:

remote: Warning: $field is undefined, input line (#10) was '', previous field was ' '; please report the repo & commitid to Gentoo bug #548876
remote: Warning: Use of uninitialized value $field in string eq at hooks/post-receive.h01-gentoo-commits line 395.
remote: Warning: Use of uninitialized value $field in string eq at hooks/post-receive.h01-gentoo-commits line 410.
remote: Warning: Use of uninitialized value $field in string eq at hooks/post-receive.h01-gentoo-commits line 410.
remote: Warning: Use of uninitialized value $field in hash element at hooks/post-receive.h01-gentoo-commits line 435.
remote: Warning: $field is undefined, input line (#14) was '', previous field was ' '; please report the repo & commitid to Gentoo bug #548876
remote: Warning: Use of uninitialized value $field in string eq at hooks/post-receive.h01-gentoo-commits line 395.
remote: Warning: Use of uninitialized value $field in string eq at hooks/post-receive.h01-gentoo-commits line 410.
remote: Warning: Use of uninitialized value $field in string eq at hooks/post-receive.h01-gentoo-commits line 410.
remote: Warning: Use of uninitialized value $field in hash element at hooks/post-receive.h01-gentoo-commits line 435.
Comment 10 Fabian Groffen gentoo-dev 2018-06-28 09:39:22 UTC
% cvs push
Enumerating objects: 6, done.
Counting objects: 100% (6/6), done.
Delta compression using up to 3 threads.
Compressing objects: 100% (4/4), done.
Writing objects: 100% (4/4), 967 bytes | 241.00 KiB/s, done.
Total 4 (delta 2), reused 0 (delta 0)
remote: Warning: $field is undefined, input line (#16) was '', previous field was ' '; please report the repo & commitid to Gentoo bug #548876
remote: Warning: Use of uninitialized value $field in string eq at hooks/post-receive.h01-gentoo-commits line 395.
remote: Warning: Use of uninitialized value $field in string eq at hooks/post-receive.h01-gentoo-commits line 410.
remote: Warning: Use of uninitialized value $field in string eq at hooks/post-receive.h01-gentoo-commits line 410.
remote: Warning: Use of uninitialized value $field in hash element at hooks/post-receive.h01-gentoo-commits line 435.
To git+ssh://git.gentoo.org/proj/portage-utils.git
   c73ba1a..223d945  master -> master

I was pushing a merge commit made by GitHub from a PR, perhaps that that introduces something weird.