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

Bug #1786508 reported by mkurz on 2018-08-10
6
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
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.