restricted-manager crashed with UnboundLocalError in load_lrmc_disabled()

Bug #122359 reported by Kaarel
70
Affects Status Importance Assigned to Milestone
restricted-manager (Ubuntu)
Fix Released
Undecided
Matteo Z

Bug Description

Binary package hint: restricted-manager

restricted-manager crashes when starting.

ProblemType: Crash
Architecture: i386
Date: Tue Jun 26 20:22:55 2007
DistroRelease: Ubuntu 7.10
ExecutablePath: /usr/bin/restricted-manager
InterpreterPath: /usr/bin/python2.5
NonfreeKernelModules: nvidia
Package: restricted-manager 0.23
PackageArchitecture: all
ProcCmdline: /usr/bin/python /usr/bin/restricted-manager --check
ProcCwd: /home/kaarel
ProcEnviron:
 LANGUAGE=et_EE.UTF-8
 PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/bin/X11:/usr/games
 LANG=et_EE.UTF-8
 SHELL=/bin/bash
PythonArgs: ['/usr/bin/restricted-manager', '--check']
SourcePackage: restricted-manager
Title: restricted-manager crashed with UnboundLocalError in load_lrmc_disabled()
Uname: Linux kaarel-desktop 2.6.22-7-generic #1 SMP Mon Jun 25 17:33:14 GMT 2007 i686 GNU/Linux

Tags: apport-crash
Revision history for this message
Kaarel (kaarelk1989-deactivatedaccount) wrote :
Revision history for this message
joe (joerg-unglaub) wrote :

Patch is to add the variable modules=[] just before the block where modules is figured out

joe (joerg-unglaub)
Changed in restricted-manager:
status: New → Confirmed
Revision history for this message
Zenigata (drebon) wrote :

same thing here, since I updated to gutsy restricted-manager do not load.

Revision history for this message
joe (joerg-unglaub) wrote :

This patch should solve the Problem

Ok the source should be checked for situations where variables are first assigned in a try: / except: block and the ether that variable is assigned in the except block also or initialized before the try: statement
to prevent more of such errors.

Revision history for this message
Matteo Z (matteozandi) wrote :

It seems that you have a non-standard /etc/default/linux-restricted-modules-common

Can you post it?

Changed in restricted-manager:
assignee: nobody → matteozandi
Revision history for this message
joe (joerg-unglaub) wrote :

Here it is, but none the less this errer could be fixed for others which also have a possibly non standard file. Version is 2.6.22.2-7.2

# This file is sourced from the linux-restricted-modules-common init
    # script and is used to disable the link-on-boot feature, one module
    # at a time. This can be useful if you want to use hand-compiled
    # versions of one or more modules, but keep linux-restricted-modules
    # installed on your system, or just to disable modules you don't use
    # and speed up your boot process by a second or two.
    #
    # Use a space-separated list of modules you wish to not have linked
    # on boot. The following example shows a (condensed) list of all
    # modules shipped in the linux-restricted-modules packages:
    #
    # DISABLED_MODULES="ath_hal fc fglrx ltm nv"
    #
    # Note that disabling "fc" disables all fcdsl drivers, "ltm" disables
    # ltmodem and ltserial, and "nv" disables both the nvidia drivers.
    # You can also name each module individually, if you prefer a subset.

    DISABLED_MODULES=""

Revision history for this message
Matteo Z (matteozandi) wrote :

> but none the less this errer could be fixed for others which also have a possibly non standard file

yes, that's what we want :)

I just wanted to see if there were some particular unhandled cases, do you have 4 spaces before 'DISABLED_MODULES=""'?

load_lrmc_disabled() should behave live sh, since /etc/default/linux-restricted-modules-common is sourced by a sh script. If we use your patch, we won't behave like sh and, in fact, r-m will be confused by those spaces.

If you have something like ' DISABLED_MODULES="fglrx" (4 spaces before DIS..), Restricted-manager will think that no modules are disabled altough fglrx is.

We should clear spaces at the beginning of the "DIS.." line.

Revision history for this message
joe (joerg-unglaub) wrote :

hmmm exactly 4 spaces. the question is:
 if it is due to some error in lrm or if it is caused by envy which I used before

so did someone use envy before lrm crashed??

Revision history for this message
ojab (ojab) wrote :

my /etc/default/linux-restricted-modules-common

Revision history for this message
Matthew Koyle (mgkoyle) wrote :

I had this same problem... used envy a few weeks ago and just updated to gutsy.

Deleting the four spaces before DISABLED_MODULES="" fixed it for me, too.

matthew@V5120NR:~$ sudo restricted-manager
Traceback (most recent call last):
  File "/usr/bin/restricted-manager", line 646, in <module>
    sys.exit(main(args, opts))
  File "/usr/bin/restricted-manager", line 602, in main
    handlers = get_handlers()
  File "/usr/lib/python2.5/site-packages/RestrictedManager/core.py", line 452, in get_handlers
    specials = get_specials()
  File "/usr/lib/python2.5/site-packages/RestrictedManager/core.py", line 411, in get_specials
    rm = __import__("RestrictedManager.%s" % name)
  File "/usr/lib/python2.5/site-packages/RestrictedManager/lrm_driver.py", line 140, in <module>
    LRMDriverHandler.load_lrmc_disabled()
  File "/usr/lib/python2.5/site-packages/RestrictedManager/lrm_driver.py", line 86, in load_lrmc_disabled
    if len(modules):
UnboundLocalError: local variable 'modules' referenced before assignment

Revision history for this message
Roland (roland1979) wrote :

My /etc/default/linux-restricted-modules-common consists only of comments (read: NO line which does not start with a #) and the restricted-manager crashes anyway.

Revision history for this message
Roland (roland1979) wrote :

The manager works instantly if you add

DISABLED_MODULES=""

directly under the last comment (in case you have a /etc/default/linux-restricted-modules-common without that line activated).

Revision history for this message
Martin Pitt (pitti) wrote :

Fixed in bzr head.

Changed in restricted-manager:
status: Confirmed → Fix Committed
Revision history for this message
Martin Pitt (pitti) wrote :

restricted-manager (0.24) gutsy; urgency=low

  [ Matteo Zandi ]
  * RestrictedManager/lrm_driver.py: load_lrmc_disabled() and
    save_lrmc_disabled() now handle trailing spaces in
    /etc/default/linux-restricted-modules-common. (LP: #122359)
  * RestrictedManager/bcm43xx.py: remove fake firmware file when
    disabling bcm43xx.
  * restricted-manager: Added new class DefaultHandlerMessageDialog that can be
    used to give messages from handlers.

  [ Martin Pitt ]
  * debian/restricted-manager.postinst: Do not call addgroup if the admin
    group already exists. In some corner cases, addgroup fails at this
    condidion. (LP: #122892)
  * Add man/restricted-manager.8: man page for r-m, thanks to Cesare
    Tirabassi! (LP: #128697)
  * restricted-manager: Check for l-r-m-generic package instead of the kernel
    ABI specific one. (LP: #107705)
  * debian/control: Add dependency to l-r-m-{generic,i386} on i386/amd64, since
    r-m does not work without it anyway and it just creates confusion.
  * RestrictedManager/bcm43xx.py: Check if bcm43xx-fwcutter could actually get
    installed before proceeding.
  * RestrictedManager/core.py, install_package(): Check that package is
    actually available; if not, point out that the software source for this
    needs to be enabled. Based on original patch of Matteo, but simplified and
    robustified. (LP: #123061, LP: #124304)

 -- Martin Pitt <email address hidden> Wed, 01 Aug 2007 12:20:55 +0200

Changed in restricted-manager:
status: Fix Committed → Fix Released
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.