/usr/sbin/greylistd-setup-exim4 has two errors in Ubuntu 20.04

Bug #1875451 reported by Terje Nilima Monsen
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
greylistd (Ubuntu)
New
Undecided
Unassigned

Bug Description

When running /usr/sbin/greylistd-setup-exim4 add it produces this error:
# /usr/sbin/greylistd-setup-exim4 add
  File "/usr/sbin/greylistd-setup-exim4", line 254
    nmstring=options["netmask"]
                              ^
TabError: inconsistent use of tabs and spaces in indentation
---

Upon replacing the tab with spaces in line 254 and running the script again it produces this error:
# /usr/sbin/greylistd-setup-exim4 add
Adding greylistd support to Exim 4 configuration files
Traceback (most recent call last):
  File "/usr/sbin/greylistd-setup-exim4", line 423, in <module>
    ok = exim4_default_setup(description, function, options, doupdate)
  File "/usr/sbin/greylistd-setup-exim4", line 320, in exim4_default_setup
    ok = exim4_setup(filename, aclname, function, options, doupdate)
  File "/usr/sbin/greylistd-setup-exim4", line 287, in exim4_setup
    fp = file(filename, "w")
NameError: name 'file' is not defined
---

This is likely caused by file() being deprecated and not available in python3 which is what is shipped with Ubuntu 20.04.
Replacing this file() command with open() appears to resolve the issue, because now running the command it yelds:
# /usr/sbin/greylistd-setup-exim4 add
Adding greylistd support to Exim 4 configuration files
/etc/exim4/exim4.conf.template : OK
/etc/exim4/exim4.conf.template : OK
...conf.d/acl/30_exim4-config_check_rcpt: OK
...conf.d/acl/40_exim4-config_check_data: OK
---

Thank you for effort in maintaining open source software. I hope this bug report has been helpful to you.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

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