[SRU] Fix lsb-core for 12.10 and 13.04

Bug #1035136 reported by Chris Johnston
90
This bug affects 16 people
Affects Status Importance Assigned to Milestone
lsb (Ubuntu)
Fix Released
Low
Unassigned
Quantal
Won't Fix
Medium
Brian Murray
Raring
Fix Released
Medium
Brian Murray

Bug Description

[Impact]
This bug makes certian LSB applications unusable.

As Ubuntu 12.10 and 13.04 will still be around for a while, this bug is worth fixing.

The fixes are in the related branch, the purpose of the fixes are simple, make the affected scripts compatible with Python 3 as they are expected to.

[Test Case]
$ /usr/lib/lsb/install_initd
Usage: /usr/lib/lsb/install_initd /etc/init.d/<init-script>

Better to test with actual LSB applications that uses scripts under /usr/lib/lsb/

[Regression Potential]
Almost zero, as the origin scripts in lsb-core just crashes.

[Other Info]
This problem is mostly due to incompatibilty of Python 2/3 and Ubuntu's clumsy way of port LSB scripts to Python 3 (calling 2to3 in debian/rules)

Origin bug report:
"""
Received a crash after installing an app

ProblemType: Crash
DistroRelease: Ubuntu 12.10
Package: lsb-core 4.0-0ubuntu22
ProcVersionSignature: Ubuntu 3.5.0-8.8-generic 3.5.0
Uname: Linux 3.5.0-8-generic x86_64
NonfreeKernelModules: wl
ApportVersion: 2.4-0ubuntu6
Architecture: amd64
Date: Thu Aug 9 19:26:12 2012
ExecutablePath: /usr/lib/lsb/install_initd
InstallationMedia: Ubuntu 12.04 LTS "Precise Pangolin" - Release amd64 (20120425)
InterpreterPath: /usr/bin/python3.2mu
ProcCmdline: /usr/bin/python3 /usr/lib/lsb/install_initd /etc/init.d/logmein-hamachi
ProcEnviron:
 PATH=(custom, no user)
 LANG=en_US.UTF-8
PythonArgs: ['/usr/lib/lsb/install_initd', '/etc/init.d/logmein-hamachi']
SourcePackage: lsb
Title: install_initd crashed with SyntaxError in __main__: invalid syntax
UpgradeStatus: Upgraded to quantal on 2012-06-26 (44 days ago)
UserGroups:
"""

Revision history for this message
Chris Johnston (cjohnston) wrote :
tags: removed: need-duplicate-check
Changed in lsb (Ubuntu):
importance: Undecided → Medium
Revision history for this message
Brian Murray (brian-murray) wrote :

As logmein-hamachi isn't provided by an Ubuntu package I don't believe we can do anything about this as it looks like install_initd is crashing trying to parse the /etc/init.d/logmein-hamachi file.

visibility: private → public
Changed in lsb (Ubuntu):
importance: Medium → Low
Revision history for this message
Launchpad Janitor (janitor) wrote :

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in lsb (Ubuntu):
status: New → Confirmed
Revision history for this message
Chris Davis (chris240182) wrote :

same issue affecting eset nod32 installation

Revision history for this message
Ma Hsiao-chun (mahsiaochun) wrote :

The problem is, well, /usr/lib/lsb/initdutils.py is a Python 2 script.

tags: added: raring
Revision history for this message
Dmitry Shachnev (mitya57) wrote :

Can we make that file use `except .. as ..` syntax? (That would be compatible with both Python 2 & 3)

Revision history for this message
Ma Hsiao-chun (mahsiaochun) wrote :

Actually all the files under /usr/lib/lsb are in Python2...
"#! /usr/bin/python3" is just wrong.

@mitya57
The synatx difference is far beyond the difference of "except" I guess. You may run 2to3 to see the changeset required.

BTW, "assert True" non-sense at the beginning of initdutils.py will be rejected by Python 3.

Revision history for this message
Colin Watson (cjwatson) wrote :

I guess this is what was fixed in saucy:

lsb (4.1+Debian10) unstable; urgency=low

  [ Steve Langasek ]
  * Fix the remaining problems of initdutils.py python3 compatibility
    (Closes: #673586)
  * Revert unnecessary use of /bin/echo -n (Closes: #708337)

  [ Didier Raboud ]
  * Compress source with xz

 -- Didier Raboud <email address hidden> Wed, 15 May 2013 11:06:44 +0200

So we'd just need backports of the appropriate changes to initdutils.py.

Changed in lsb (Ubuntu Quantal):
status: New → Triaged
Changed in lsb (Ubuntu Raring):
status: New → Triaged
Changed in lsb (Ubuntu Quantal):
importance: Undecided → Medium
Changed in lsb (Ubuntu Raring):
importance: Undecided → Medium
Changed in lsb (Ubuntu):
status: Confirmed → Fix Released
Revision history for this message
Ma Hsiao-chun (mahsiaochun) wrote :

No, Colin. Debian's fix is irrelevant here.

If it is about this diff:
http://anonscm.debian.org/gitweb/?p=collab-maint/lsb.git;a=commitdiff;h=f4ed7f08600d633c3daba9f494997f1c35555aed;hp=b459407133b43ce0bcb2231eff1408fe9f0b41b7

What it does is that it makes initdutils.py , still a Python 2 script, compatible with Python 3 (hopefully).

But in, Ubuntu saucy, Python 2 script install_initd, lsbinstall and remove_initd had their shebang (#!) changed to "/usr/bin/python3" by something in debian/rules, so it is still broken.

Revision history for this message
Colin Watson (cjwatson) wrote :

Hardly irrelevant. Those scripts also have 2to3 run over them, so that's OK.

There is a remaining incompatibility in initdutils.py, for which I've just uploaded a fix. After that, /usr/lib/lsb/install_initd seems to work fine in a saucy chroot.

lsb (4.1+Debian11ubuntu3) saucy; urgency=low

  * Use open() rather than file() in initdutils.py, for Python 3
    compatibility (see LP #1035136).
  * Test fileob and strob against None in RFC822Parser.__init__ rather than
    testing their truth value, to avoid a misleading error in the case of a
    file with no LSB headers.

 -- Colin Watson <email address hidden> Mon, 01 Jul 2013 12:36:13 +0100

Changed in lsb (Ubuntu):
status: Fix Released → Fix Committed
summary: - install_initd crashed with SyntaxError in __main__: invalid syntax
+ [SRU] Fix lsb-core for 12.10 and 13.04
Revision history for this message
Ma Hsiao-chun (mahsiaochun) wrote :

Subscribed ubuntu-sru, please test and give feedback

description: updated
Revision history for this message
Colin Watson (cjwatson) wrote :

lsb (4.1+Debian11ubuntu3) saucy; urgency=low

  * Use open() rather than file() in initdutils.py, for Python 3
    compatibility (see LP #1035136).
  * Test fileob and strob against None in RFC822Parser.__init__ rather than
    testing their truth value, to avoid a misleading error in the case of a
    file with no LSB headers.

 -- Colin Watson <email address hidden> Mon, 01 Jul 2013 12:36:13 +0100

Changed in lsb (Ubuntu):
status: Fix Committed → Fix Released
Revision history for this message
Ma Hsiao-chun (mahsiaochun) wrote :

Ping?

Revision history for this message
Iain Lane (laney) wrote :

Uploaded, thank you

Changed in lsb (Ubuntu Raring):
status: Triaged → In Progress
Changed in lsb (Ubuntu Quantal):
status: Triaged → In Progress
Revision history for this message
Dimitri John Ledkov (xnox) wrote :

Packages are waiting in the unapproved queue for review by Ubuntu SRU team. Unsubscribing ubuntu-sponsors team.

Revision history for this message
Brian Murray (brian-murray) wrote :

FYI - they are waiting in the SRU queue as there is an unverified SRU of lsb in -proposed already.

Revision history for this message
Brian Murray (brian-murray) wrote : Please test proposed package

Hello Chris, or anyone else affected,

Accepted lsb into raring-proposed. The package will build now and be available at http://launchpad.net/ubuntu/+source/lsb/4.0-0ubuntu27.2 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 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 to verification-done. If it does not fix the bug for you, please add a comment stating that, and change the tag to verification-failed. In either case, details of your testing will help us make a better decision.

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

Changed in lsb (Ubuntu Raring):
status: In Progress → Fix Committed
tags: added: verification-needed
Changed in lsb (Ubuntu Quantal):
status: In Progress → Fix Committed
Revision history for this message
Brian Murray (brian-murray) wrote :

Hello Chris, or anyone else affected,

Accepted lsb into quantal-proposed. The package will build now and be available at http://launchpad.net/ubuntu/+source/lsb/4.0-0ubuntu26.3 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 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 to verification-done. If it does not fix the bug for you, please add a comment stating that, and change the tag to verification-failed. In either case, details of your testing will help us make a better decision.

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

Revision history for this message
Petteri S (petteri-stenius) wrote :

Hello

I don't think this issue was completely fixed. I see this error when I run install_initd with lsb version 4.0-0ubuntu27.2

Traceback (most recent call last):
  File "/usr/lib/lsb/install_initd", line 102, in <module>
    initdutils.save_depends(depends)
  File "/usr/lib/lsb/initdutils.py", line 138, in save_depends
    fh = file(DEPENDS, 'w')
NameError: global name 'file' is not defined

There still exists some references to 'file' in initdutils.py

$ grep -n file\( initdutils.py
54:def scan_initfile(initfile):
99: fh = file(FACILITIES, 'w')
125: independs = RFC822Parser(fileob=file(DEPENDS))
138: fh = file(DEPENDS, 'w')
171: print(scan_initfile('init-fragment'))

Thanks.

Revision history for this message
Brian Murray (brian-murray) wrote :

Thanks Petteri S, that is correct and I've marked the bug as verification-failed.

tags: added: verification-failed
removed: verification-needed
Revision history for this message
Brian Murray (brian-murray) wrote :

I'll upload new fixes for Raring and Quantal.

Changed in lsb (Ubuntu Quantal):
assignee: nobody → Brian Murray (brian-murray)
Changed in lsb (Ubuntu Raring):
assignee: nobody → Brian Murray (brian-murray)
Revision history for this message
Brian Murray (brian-murray) wrote :

Hello Chris, or anyone else affected,

Accepted lsb into raring-proposed. The package will build now and be available at http://launchpad.net/ubuntu/+source/lsb/4.0-0ubuntu27.3 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 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 to verification-done. If it does not fix the bug for you, please add a comment stating that, and change the tag to verification-failed. In either case, details of your testing will help us make a better decision.

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

tags: removed: verification-failed
tags: added: verification-needed
Revision history for this message
Brian Murray (brian-murray) wrote :

Hello Chris, or anyone else affected,

Accepted lsb into quantal-proposed. The package will build now and be available at http://launchpad.net/ubuntu/+source/lsb/4.0-0ubuntu26.4 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 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 to verification-done. If it does not fix the bug for you, please add a comment stating that, and change the tag to verification-failed. In either case, details of your testing will help us make a better decision.

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

Revision history for this message
Petteri S (petteri-stenius) wrote :

Thanks everybody, this latest update has fixed any issues we were experiencing with the lsb install_initd and remove_initd scripts.

Revision history for this message
Brian Murray (brian-murray) wrote :

@Petteri - were you testing this on Raring again?

Revision history for this message
Petteri S (petteri-stenius) wrote :

Yes this is Ubuntu 13.04. For more details I've attached the output from "ubuntu-bug lsb-core".

tags: added: verification-done-raring
tags: added: verification-needed-quantal
removed: verification-needed
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package lsb - 4.0-0ubuntu27.3

---------------
lsb (4.0-0ubuntu27.3) raring-proposed; urgency=low

  * initdutils.py: Fully fix issues with Python 3. (LP: #1035136)
 -- Brian Murray <email address hidden> Thu, 22 Aug 2013 15:10:16 -0700

Changed in lsb (Ubuntu Raring):
status: Fix Committed → Fix Released
Revision history for this message
Brian Murray (brian-murray) wrote : Update Released

The verification of this Stable Release Update has completed successfully and the package has now been released to -updates. Subsequently, the Ubuntu Stable Release Updates Team is being unsubscribed and will not receive messages about this bug report. In the event that you encounter a regression using the package from -updates please report a new bug using ubuntu-bug and tag the bug report regression-update so we can easily find any regresssions.

Revision history for this message
Rolf Leggewie (r0lf) wrote :

quantal has seen the end of its life and is no longer receiving any updates. Marking the quantal task for this ticket as "Won't Fix".

Changed in lsb (Ubuntu Quantal):
status: Fix Committed → Won't Fix
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Remote bug watches

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