audio_settings crashes if none of the element indexes (sources, sinks) is marked as active

Bug #1067026 reported by Daniel Manrique
24
This bug affects 3 people
Affects Status Importance Assigned to Milestone
Checkbox
Fix Released
High
Brendan Donegan

Bug Description

On a system here (Dell Inspiron 17R), audio_settings is bombing with this trace:

Traceback (most recent call last):
  File "/usr/share/checkbox/scripts/audio_settings", line 241, in <module>
    sys.exit(main())
  File "/usr/share/checkbox/scripts/audio_settings", line 218, in main
    store_audio_settings(args.file)
  File "/usr/share/checkbox/scripts/audio_settings", line 92, in store_audio_settings
    active_entry = active_entries_regex.search(pacmd_entries).group()
AttributeError: 'NoneType' object has no attribute 'group'

I went in and was able to replicate this behavior by simply running:
/usr/share/checkbox/scripts/audio_settings store --file=/tmp/something

I traced this to trying to find a line like this in pactl list-sources output:

* index: 0

This is given by a regular expression defined as follows:
active_entries_regex = re.compile("\* index.*?(?=properties)", re.DOTALL)

The important part is the asterisk. On a system where the test doesn't bomb, pacmd list-sources |grep index says this:

    index: 0
  * index: 1

However on the failing system it's this:

    index: 0
    index: 1

Apparently the line where the regex search is performed assumes that it will always succeed, instead of checking that it had a match (line 91 in the script):

active_entry = active_entries_regex.search(pacmd_entries).group()

I'm attaching in its entirety the pacmd output that gives trouble, maybe the parsing can be fixed to accomodate this.

Related branches

Revision history for this message
Daniel Manrique (roadmr) wrote :
Revision history for this message
Brendan Donegan (brendan-donegan) wrote :

This is a matter of just making it fail more gracefully - the fact that there is no source or sink selected ought to make the test fail so I wouldn't like to change that.

Changed in checkbox:
importance: Undecided → Medium
status: New → Triaged
assignee: nobody → Brendan Donegan (brendan-donegan)
status: Triaged → In Progress
Revision history for this message
Brendan Donegan (brendan-donegan) wrote :

After talking to diwic on IRC, it looks like we are partially at fault here. We should be using pactl instead of pacmd, that seems to work more reliably

Changed in checkbox:
importance: Medium → High
tags: added: cert-sru-issue
Changed in checkbox:
status: In Progress → Fix Released
status: Fix Released → Fix Committed
Changed in checkbox:
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.