/etc/acpi/screenblank.sh shows awk syntax error

Bug #893271 reported by Brad Evans
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
acpi-support (Ubuntu)
Fix Released
Medium
Unassigned

Bug Description

When running /etc/acpi/screenblank.sh, I get ..

awk: line 1: regular expression compile failed (missing '(')
:0)

Screen does go blank though..

ProblemType: Bug
DistroRelease: Ubuntu 11.10
Package: acpi-support 0.138
ProcVersionSignature: Ubuntu 3.0.0-12.20-generic 3.0.4
Uname: Linux 3.0.0-12-generic i686
NonfreeKernelModules: wl
ApportVersion: 1.23-0ubuntu4
Architecture: i386
Date: Mon Nov 21 14:27:21 2011
InstallationMedia: Ubuntu 11.10 "Oneiric Ocelot" - Release i386 (20111012)
ProcEnviron:
 PATH=(custom, user)
 LANG=en_US.UTF-8
 SHELL=/bin/bash
SourcePackage: acpi-support
UpgradeStatus: No upgrade log present (probably fresh install)

Revision history for this message
Brad Evans (brad-of-ottawa) wrote :
Revision history for this message
Brad Evans (brad-of-ottawa) wrote :

I found the problem in the script ..

/usr/share/acpi-support/power-funcs

I think that in line 9 ..

user=$(who | awk "/:$displaynum)/ { print \$1; exit }")

.. should be ...

user=$(who | awk "/:$displaynum/ { print \$1; exit }")

Revision history for this message
Steve Langasek (vorlon) wrote : Re: [Bug 893271] Re: /etc/acpi/screenblank.sh shows awk syntax error

On Mon, Nov 21, 2011 at 08:11:33PM -0000, Brad Evans wrote:
> I found the problem in the script ..

> /usr/share/acpi-support/power-funcs

> I think that in line 9 ..

> user=$(who | awk "/:$displaynum)/ { print \$1; exit }")

> .. should be ...

> user=$(who | awk "/:$displaynum/ { print \$1; exit }")

No, the ) is intentionally part of the match, to preclude accidentally
matching display names that have the one we're looking for as a prefix.

The problem here is gawk and mawk having two different means of interpreting
), and awk being an alternative that could point at either one. mawk is
installed by default, but it's likely that mawk's behavior here is actually
a bug and we probably don't want to rely on it; nor do we want acpi-support
to have to depend on gawk.

So I think the proper solution is to follow up on mawk's behavior and fix
mawk if necessary.

--
Steve Langasek Give me a lever long enough and a Free OS
Debian Developer to set it on, and I can move the world.
Ubuntu Developer http://www.debian.org/
<email address hidden> <email address hidden>

Changed in acpi-support (Ubuntu):
importance: Undecided → Medium
status: New → Triaged
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package acpi-support - 0.139

---------------
acpi-support (0.139) precise; urgency=low

  * lib/power-funcs: adjust getXuser and getXconsole to use consolekit
    instead of ps/who to identify the "foreground" session and the owner
    of a given X session, since lightdm is currently failing to record this
    information in utmp. Also, add headers for each of these functions
    documenting how they're supposed to work, since it's completely
    non-obvious and some of the scripts already in acpi-support are using
    them wrong. Thanks to Ayan George <email address hidden> for the
    preliminary patch. LP: #933626, #893271.
  * rotatescreen.sh: fix wrong use of getXconsole where getXuser is needed.
 -- Steve Langasek <email address hidden> Sat, 03 Mar 2012 15:49:47 -0800

Changed in acpi-support (Ubuntu):
status: Triaged → 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.