Use of uninitialized value $ARGV[0] in string eq at /usr/sbin/eximstats line 563

Bug #1786508 reported by mkurz on 2018-08-10
10
This bug affects 1 person
Affects Status Importance Assigned to Milestone
exim4 (Debian)
Fix Released
Unknown
exim4 (Ubuntu)
Undecided
Unassigned
Bionic
Low
Andreas Hasenack

Bug Description

[Impact]

The eximstats tool, when not given any command line parameters, prints out a (harmless) warning:
# eximstats
Use of uninitialized value $ARGV[0] in string eq at /usr/sbin/eximstats line 563.

Problem is that this tool is used in a cron job which, if enabled, will print output to stderr and that is enough for cron to email an admin, which is annoying.

The fix is simple and is applied upstream:
-if ($ARGV[0] eq '--version') {
+if (@ARGV and $ARGV[0] eq '--version') {

[Test Case]
On Bionic:
* Install exim4:
sudo apt update
sudo apt install exim4

* Run eximstats with no arguments, which will block (it's waiting for stdin) but print the warning:
ubuntu@bionic-eximstats:~$ eximstats
Use of uninitialized value $ARGV[0] in string eq at /usr/sbin/eximstats line 563.

* To observe the effect this has in the cron job, edit /etc/cron.daily/exim4-base and set E4BCD_DAILY_REPORT_TO near the top of the file to "ubuntu@localhost", like this:
E4BCD_DAILY_REPORT_TO="ubuntu@localhost"

* Then run these commands and observe that the cron script prints out the same warning, which, if ran by cron, would have been emailed to the admin:
$ echo hello | mail -s hello ubuntu@localhost
$ sudo /etc/cron.daily/exim4-base
Use of uninitialized value $ARGV[0] in string eq at /usr/sbin/eximstats line 563.

With the updated packages, eximstats with no arguments will just block, waiting for data on stdin, and not print the warning. The cron job test will also be silent.

[Regression Potential]
I can't imagine a regression with this change, other than the usual fact the the updated package is a rebuild, and it might link with different libraries since bionic was released.

[Other Info]
Were it not for the cron job, this update would probably not be worth it.

[Original description]

Already fixed upstream and in Debian: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=894501

Fix is easy:
https://git.exim.org/exim.git/blobdiff/d51252ebebd7744dd218c4af965ca3d5424648cc..44de51a174765f7f5ecb250638cdb3fe64ec67dc:/src/src/eximstats.src

Please backport to Bionic.

Thanks!

Related branches

Robie Basak (racb) wrote :

Thank you for taking the time to report this bug and helping to make Ubuntu better.

I see that the fix is in Cosmic, but not in Bionic.

Changed in exim4 (Ubuntu):
status: New → Triaged
Changed in exim4 (Ubuntu Bionic):
status: New → Triaged
Changed in exim4 (Ubuntu):
status: Triaged → Fix Released
tags: added: bitesize server-next
Changed in exim4 (Debian):
status: Unknown → Fix Released
Changed in exim4 (Ubuntu Bionic):
assignee: nobody → Andreas Hasenack (ahasenack)
status: Triaged → In Progress
importance: Undecided → Low
description: updated
description: updated
description: updated

Hello mkurz, or anyone else affected,

Accepted exim4 into bionic-proposed. The package will build now and be available at https://launchpad.net/ubuntu/+source/exim4/4.90.1-1ubuntu1.1 in a few hours, and then in the -proposed repository.

Please help us by testing this new package. See https://wiki.ubuntu.com/Testing/EnableProposed for documentation on how to enable and use -proposed. Your feedback will aid us getting this update out to other Ubuntu users.

If this package fixes the bug for you, please add a comment to this bug, mentioning the version of the package you tested and change the tag from verification-needed-bionic to verification-done-bionic. If it does not fix the bug for you, please add a comment stating that, and change the tag to verification-failed-bionic. In either case, without details of your testing we will not be able to proceed.

Further information regarding the verification process can be found at https://wiki.ubuntu.com/QATeam/PerformingSRUVerification . Thank you in advance for helping!

N.B. The updated package will be released to -updates after the bug(s) fixed by this package have been verified and the package has been in -proposed for a minimum of 7 days.

Changed in exim4 (Ubuntu Bionic):
status: In Progress → Fix Committed
tags: added: verification-needed verification-needed-bionic
Andreas Hasenack (ahasenack) wrote :

Bionic verification:

Confirming bug:
ubuntu@bionic-exim4-1786508:~$ apt-cache policy exim4
exim4:
  Installed: 4.90.1-1ubuntu1
  Candidate: 4.90.1-1ubuntu1
  Version table:
 *** 4.90.1-1ubuntu1 500
        500 http://br.archive.ubuntu.com/ubuntu bionic/main amd64 Packages
        100 /var/lib/dpkg/status

ubuntu@bionic-exim4-1786508:~$ eximstats
Use of uninitialized value $ARGV[0] in string eq at /usr/sbin/eximstats line 563.
**** No valid log lines read

# cron test
ubuntu@bionic-exim4-1786508:~$ sudo vi /etc/cron.daily/exim4-base
ubuntu@bionic-exim4-1786508:~$ echo hello | mail -s hello ubuntu@localhost
ubuntu@bionic-exim4-1786508:~$ sudo /etc/cron.daily/exim4-base
Use of uninitialized value $ARGV[0] in string eq at /usr/sbin/eximstats line 563.
ubuntu@bionic-exim4-1786508:~$

Confirming fix:
ubuntu@bionic-exim4-1786508:~$ apt-cache policy exim4
exim4:
  Installed: 4.90.1-1ubuntu1.1
  Candidate: 4.90.1-1ubuntu1.1
  Version table:
 *** 4.90.1-1ubuntu1.1 500
        500 http://br.archive.ubuntu.com/ubuntu bionic-proposed/main amd64 Packages
        100 /var/lib/dpkg/status
     4.90.1-1ubuntu1 500
        500 http://br.archive.ubuntu.com/ubuntu bionic/main amd64 Packages

# no warning
ubuntu@bionic-exim4-1786508:~$ eximstats
**** No valid log lines read

# clean cron
ubuntu@bionic-exim4-1786508:~$ echo hello | mail -s hello ubuntu@localhost
ubuntu@bionic-exim4-1786508:~$ sudo /etc/cron.daily/exim4-base
ubuntu@bionic-exim4-1786508:~$

tags: added: verification-done-bionic
removed: verification-needed-bionic
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.