Debian Bug report logs - #962284
mailman: File "/usr/lib/mailman/cron/cull_bad_shunt", line 77 SyntaxError with Python 3

version graph

Package: mailman; Maintainer for mailman is Mailman for Debian <[email protected]>; Source for mailman is src:mailman (PTS, buildd, popcon).

Reported by: Joe Pfeiffer <[email protected]>

Date: Fri, 5 Jun 2020 15:21:01 UTC

Severity: normal

Found in version mailman/1:2.1.29-1+deb10u1

Reply or subscribe to this bug.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to [email protected], Mailman for Debian <[email protected]>:
Bug#962284; Package mailman. (Fri, 05 Jun 2020 15:21:04 GMT) (full text, mbox, link).


Acknowledgement sent to Joe Pfeiffer <[email protected]>:
New Bug report received and forwarded. Copy sent to Mailman for Debian <[email protected]>. (Fri, 05 Jun 2020 15:21:04 GMT) (full text, mbox, link).


Message #5 received at [email protected] (full text, mbox, reply):

From: Joe Pfeiffer <[email protected]>
To: Debian Bug Tracking System <[email protected]>
Subject: mailman: File "/usr/lib/mailman/cron/cull_bad_shunt", line 77 SyntaxError with Python 3
Date: Fri, 05 Jun 2020 08:56:57 -0600
Package: mailman
Version: 1:2.1.29-1+deb10u1
Severity: normal

Got the following this morning, after switching to Python 3:

From: [email protected] (Cron Daemon)
To: [email protected]
Subject: Cron <list@snowball> [ -x /usr/lib/mailman/cron/cull_bad_shunt ] && /usr/lib/mailman/cron/cull_bad_shunt
Date: Fri, 05 Jun 2020 04:30:01 -0600
Content-Type: text/plain; charset=UTF-8
X-Bogosity: Ham, tests=bogofilter, spamicity=0.000028, version=1.2.4

  File "/usr/lib/mailman/cron/cull_bad_shunt", line 77
    except getopt.error, msg:
                       ^
SyntaxError: invalid syntax

The issue appears to be that Python3 no longer accepts the comma in an
except block.

-- System Information:
Debian Release: bullseye/sid
  APT prefers testing
  APT policy: (700, 'testing'), (650, 'stable'), (600, 'unstable'), (550, 'experimental'), (500, 'oldstable')
Architecture: amd64 (x86_64)
Foreign Architectures: i386

Kernel: Linux 5.6.0-1-amd64 (SMP w/8 CPU cores)
Kernel taint flags: TAINT_OOT_MODULE, TAINT_UNSIGNED_MODULE
Locale: LANG=en_US.utf8, LC_CTYPE=en_US.utf8 (charmap=UTF-8), LANGUAGE=en_US.utf8 (charmap=UTF-8)
Shell: /bin/sh linked to /usr/bin/dash
Init: systemd (via /run/systemd/system)
LSM: AppArmor: enabled

Versions of packages mailman depends on:
ii  apache2 [httpd]        2.4.43-1
ii  cron [cron-daemon]     3.0pl1-136
ii  debconf [debconf-2.0]  1.5.74
ii  libc6                  2.30-4
ii  logrotate              3.16.0-3
ii  lsb-base               11.1.0
ii  python                 2.7.17-2
ii  python-dnspython       1.16.0-1
ii  ucf                    3.0038+nmu1

Versions of packages mailman recommends:
ii  exim4-daemon-light [mail-transport-agent]  4.93-15

Versions of packages mailman suggests:
pn  listadmin      <none>
ii  lynx           2.9.0dev.5-1
pn  mailman3-full  <none>
pn  spamassassin   <none>

-- debconf information excluded



Information forwarded to [email protected], Mailman for Debian <[email protected]>:
Bug#962284; Package mailman. (Sun, 07 Jun 2020 14:57:02 GMT) (full text, mbox, link).


Acknowledgement sent to Dominic Hargreaves <[email protected]>:
Extra info received and forwarded to list. Copy sent to Mailman for Debian <[email protected]>. (Sun, 07 Jun 2020 14:57:03 GMT) (full text, mbox, link).


Message #10 received at [email protected] (full text, mbox, reply):

From: Dominic Hargreaves <[email protected]>
To: Joe Pfeiffer <[email protected]>, [email protected]
Subject: Re: Bug#962284: mailman: File "/usr/lib/mailman/cron/cull_bad_shunt", line 77 SyntaxError with Python 3
Date: Sun, 7 Jun 2020 15:52:55 +0100
[Message part 1 (text/plain, inline)]
On Fri, Jun 05, 2020 at 08:56:57AM -0600, Joe Pfeiffer wrote:
> Got the following this morning, after switching to Python 3:
> 
> From: [email protected] (Cron Daemon)
> To: [email protected]
> Subject: Cron <list@snowball> [ -x /usr/lib/mailman/cron/cull_bad_shunt ] && /usr/lib/mailman/cron/cull_bad_shunt
> Date: Fri, 05 Jun 2020 04:30:01 -0600
> Content-Type: text/plain; charset=UTF-8
> X-Bogosity: Ham, tests=bogofilter, spamicity=0.000028, version=1.2.4
> 
>   File "/usr/lib/mailman/cron/cull_bad_shunt", line 77
>     except getopt.error, msg:
>                        ^
> SyntaxError: invalid syntax
> 
> The issue appears to be that Python3 no longer accepts the comma in an
> except block.

Mailman 2 will never support python 3 and it has been removed from
unstable and testing (see mailman3 for the future, but bear in mind it's
very much not a transparent upgrade). That said, as far as I can tell even
in unstable, /usr/bin/python is still pointing to /usr/bin/python2.7,
so you must have manually changed the link in /usr/bin/python behind
the packaging system's back?

It does appear to be a bug in this package that /usr/bin/python is used
(Python policy says that /usr/bin/python2 must be used if the
application requires a specific major version of python), but
in practical terms it doesn't appear need fixing since the default isn't
going to change in the stable releases.

I've attached a trivial patch for completeness (which I prepared before
I realised that there is no supported mechanism to actually switch
/usr/bin/python that I can see) in case it's of help. If you're manually
changing files in /usr/bin, you could of course just fix the scripts
to specify /usr/bin/python2 by hand, though I don't recommend this
approach.

Dominic
[mailman-use-python2.patch (text/x-diff, attachment)]

Information forwarded to [email protected], Mailman for Debian <[email protected]>:
Bug#962284; Package mailman. (Sun, 07 Jun 2020 17:51:03 GMT) (full text, mbox, link).


Acknowledgement sent to Joe Pfeiffer <[email protected]>:
Extra info received and forwarded to list. Copy sent to Mailman for Debian <[email protected]>. (Sun, 07 Jun 2020 17:51:03 GMT) (full text, mbox, link).


Message #15 received at [email protected] (full text, mbox, reply):

From: Joe Pfeiffer <[email protected]>
To: [email protected]
Subject: Re: Bug#962284: mailman: File "/usr/lib/mailman/cron/cull_bad_shunt", line 77 SyntaxError with Python 3
Date: Sun, 7 Jun 2020 11:30:55 -0600
Dominic Hargreaves writes:
>
>Mailman 2 will never support python 3 and it has been removed from
>unstable and testing (see mailman3 for the future, but bear in mind it's
>very much not a transparent upgrade).

Yeah, the amount of work I anticipate for the switch is why I've been
procrastinating.  I wasn't aware it had been removed from unstable and
testing; it sounds like I'm going to have to bite the bullet sooner
rather than later....

>That said, as far as I can tell even
>in unstable, /usr/bin/python is still pointing to /usr/bin/python2.7,
>so you must have manually changed the link in /usr/bin/python behind
>the packaging system's back?

At this point, update-alternatives lists python3 as the "auto"
alternative, so that appears to be the default (I'm nothing resembling
an expert on Debian policies or packaging, so it's entirely possible
I'm reading more into that than I should).

>It does appear to be a bug in this package that /usr/bin/python is used
>(Python policy says that /usr/bin/python2 must be used if the
>application requires a specific major version of python), but
>in practical terms it doesn't appear need fixing since the default isn't
>going to change in the stable releases.
>
>I've attached a trivial patch for completeness (which I prepared before
>I realised that there is no supported mechanism to actually switch
>/usr/bin/python that I can see) in case it's of help. If you're manually
>changing files in /usr/bin, you could of course just fix the scripts
>to specify /usr/bin/python2 by hand, though I don't recommend this
>approach.

That's what I've wound up doing (after filing the bug report, I found
several more scripts in mailman that also break with python3).
-- 
Joe Pfeiffer                                   575.525.2764 (H)
1440 Tierra del Sol Dr                         575.496.3501 (C)
Las Cruces, NM 88007-5548                      



Information forwarded to [email protected], Mailman for Debian <[email protected]>:
Bug#962284; Package mailman. (Sun, 07 Jun 2020 19:09:05 GMT) (full text, mbox, link).


Acknowledgement sent to Dominic Hargreaves <[email protected]>:
Extra info received and forwarded to list. Copy sent to Mailman for Debian <[email protected]>. (Sun, 07 Jun 2020 19:09:05 GMT) (full text, mbox, link).


Message #20 received at [email protected] (full text, mbox, reply):

From: Dominic Hargreaves <[email protected]>
To: Joe Pfeiffer <[email protected]>, [email protected]
Subject: Re: Bug#962284: mailman: File "/usr/lib/mailman/cron/cull_bad_shunt", line 77 SyntaxError with Python 3
Date: Sun, 7 Jun 2020 20:06:22 +0100
On Sun, Jun 07, 2020 at 11:30:55AM -0600, Joe Pfeiffer wrote:
> Dominic Hargreaves writes:
> >
> >Mailman 2 will never support python 3 and it has been removed from
> >unstable and testing (see mailman3 for the future, but bear in mind it's
> >very much not a transparent upgrade).
> 
> Yeah, the amount of work I anticipate for the switch is why I've been
> procrastinating.  I wasn't aware it had been removed from unstable and
> testing; it sounds like I'm going to have to bite the bullet sooner
> rather than later....

Yep, I sympathise - I have the same issue (speaking as one of the
maintainers of alioth-lists.debian.net as well as some other installs.
(For the avoidance of doubt, I'm not the maintainer of the mailman
package.)

I believe it's already been determined that python 2 will not be shipped
with bullseye.

> >That said, as far as I can tell even
> >in unstable, /usr/bin/python is still pointing to /usr/bin/python2.7,
> >so you must have manually changed the link in /usr/bin/python behind
> >the packaging system's back?
> 
> At this point, update-alternatives lists python3 as the "auto"
> alternative, so that appears to be the default (I'm nothing resembling
> an expert on Debian policies or packaging, so it's entirely possible
> I'm reading more into that than I should).

This confused me, since Python in Debian doesn't have alternatives set
up - but a quick web search reveals various people suggesting receipes
for setting this up by hand, so at a guess you must have done this,
aybe following something like this?

https://stackoverflow.com/questions/43062608/how-to-update-alternatives-to-python-3-without-breaking-apt

The default you're seeing is not a part of the Debian system.

I mention this merely as a clarification for future readers of the
bug report. Glad to see that you've managed to get things working
for yourself :)

Cheers
Dominic



Send a report that this bug log contains spam.


Debian bug tracking system administrator <[email protected]>. Last modified: Thu May 15 15:58:01 2025; Machine Name: buxtehude

Debian Bug tracking system

Debbugs is free software and licensed under the terms of the GNU General Public License version 2. The current version can be obtained from https://bugs.debian.org/debbugs-source/.

Copyright © 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson, 2005-2017 Don Armstrong, and many other contributors.