parsing of $displaynum in /usr/share/acpi-support/power-funcs gives two matches

Bug #122684 reported by Peter Meiser
2
Affects Status Importance Assigned to Milestone
acpi-support (Ubuntu)
Fix Released
Medium
Paul Sladen

Bug Description

Binary package hint: acpi-support

Hi,

I had a talk with Paul Sladen on IRC. The /usr/share/acpi-support/power-funcs script gives two matches for $displaynum.

whoopie@notebook:~$ ps ax | grep -e 'X .* vt'7 | grep -v grep | sed -re 's!.*/X .*:([0-9]+).*!\1!'
0
0
whoopie@notebook:~$ console=`sudo fgconsole`
whoopie@notebook:~$ echo $console
7
whoopie@notebook:~$ ps ax | grep -e 'X .* vt'7 | grep -v grep
5032 tty7 SLs+ 1:50 /usr/X11R6/bin/X :0 -br -audit 0 -auth /var/lib/gdm/:0.Xauth -nolisten tcp vt7
5136 tty7 SL+ 0:00 /usr/X11R6/bin/X :0 -br -audit 0 -auth /var/lib/gdm/:0.Xauth -nolisten tcp vt7

So the fix is to change it to:
displaynum=`ps ax | grep -m1 -e '[X] .* vt'$console | sed -re 's!.*/X .*:([0-9]+).*!\1!'`

I'll attach a patch for it.

Best regards,
Whoopie

Revision history for this message
Peter Meiser (meiser79) wrote :
Changed in acpi-support:
assignee: nobody → sladen
Revision history for this message
Paul Sladen (sladen) wrote :

I provided this patch, will apply. Now that it's documented in the bug report we can close it with satisfaction! :)

Changed in acpi-support:
importance: Undecided → Medium
status: New → Confirmed
Revision history for this message
Peter Meiser (meiser79) wrote :

Sorry, Paul, didn't want to take the credit for the patch, just forgot to mention it.

Matthew Garrett (mjg59)
Changed in acpi-support:
status: Confirmed → Fix Committed
Revision history for this message
Daniel Hahler (blueyed) wrote :

Fixed in Hardy (at least). Thanks.

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