/usr/lib/pm-utils/sleep.d/99video: 22: /usr/lib/pm-utils/sleep.d/99video: shopt: not found

Bug #1091824 reported by Zygmunt Krynicki on 2012-12-18
58
This bug affects 10 people
Affects Status Importance Assigned to Milestone
pm-utils (Ubuntu)
Undecided
Martin Pitt

Bug Description

Running pm-suspend in any way triggers the following error to be displayed (possible bashism?)

/usr/lib/pm-utils/sleep.d/99video: 22: /usr/lib/pm-utils/sleep.d/99video: shopt: not found

ProblemType: Bug
DistroRelease: Ubuntu 13.04
Package: pm-utils 1.4.1-9git1
ProcVersionSignature: Ubuntu 3.7.0-7.15-generic 3.7.0
Uname: Linux 3.7.0-7-generic x86_64
ApportVersion: 2.7-0ubuntu2
Architecture: amd64
Date: Tue Dec 18 20:34:03 2012
InstallationDate: Installed on 2012-12-18 (0 days ago)
InstallationMedia: Ubuntu 13.04 "Raring Ringtail" - Alpha amd64 (20121214)
MarkForUpload: True
PackageArchitecture: all
ProcEnviron:
 TERM=xterm-256color
 PATH=(custom, no user)
 LANG=pl_PL.UTF-8
 SHELL=/bin/bash
SourcePackage: pm-utils
UpgradeStatus: No upgrade log present (probably fresh install)

Zygmunt Krynicki (zyga) wrote :
Launchpad Janitor (janitor) wrote :

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

Changed in pm-utils (Ubuntu):
status: New → Confirmed
ToZ (toz) wrote :

Diff file between raring and quantal:

~$ diif /usr/lib/pm-utils/sleep.d/99video Downloads/99video
No command 'diif' found, did you mean:
 Command 'diff' from package 'diffutils' (main)
diif: command not found
toz@xubi:~$ diff /usr/lib/pm-utils/sleep.d/99video Downloads/99video
15,22d14
< # only needed on x86, quickly exit on other architectures as this is rather
< # expensive
< ARCH=`uname -m`
< if [ "$ARCH" = "${ARCH%86}" -a "$ARCH" = "${ARCH#x86}" ]; then
< exit 0;
< fi
<
< shopt -s extglob

Note the shell being used by the script:

$ head -1 /usr/lib/pm-utils/sleep.d/99video
#!/bin/sh

Confirming that this affects me too-- since updating to raring, when I resume from suspend on my HP dm4t laptop, there is a pause of a minute or so where the backlight is on but nothing displays... with lines like:

[ 773.833620] [drm:atom_op_jump] *ERROR* atombios stuck in loop for more than 5secs aborting
[ 773.833633] [drm:atom_execute_table_locked] *ERROR* atombios stuck executing CC80 (len 62, WS 0, PS 0) @ 0xCC9C

Looking at /var/log/pm-suspend.log showed the error listed in the initial report, which led me to this bug. if I either i) replace the running shell with bash instead of sh or ii) remove the 'shopt -s extglob' then suspend/resume goes back to working for me!

The upstream 99video appears to match the quantal version. Is there a reason the shopt line was added? If so, then the shell running the file needs to be bash.

loke (developer-loke) wrote :

This script has a bug. It is not supposed to execute on x64, but the test fails and the code executes. The test at the beginning should be replaced with :

if [ "$ARCH" = "${ARCH%86}" ] || [ "$ARCH" = "${ARCH#x86}" ]; then
    exit 0;
fi

Actually, it looks like something from this script is helpful on my system (HP dm4t) under x86_64. If I make the changes suggested by loke in #5, then my laptop doesn't sleep properly. How was it decided that the functions herein are not needed on x86_64? Again-- upstream runs this regardless.

Secondarily, the fact that 'shopt -s extglob' is in a script that is run with '/bin/sh' is a bug! '/bin/sh' is not always bash. That line needs to be removed (again, it is not present upstream; it looks like it slipped in; unless I'm mistaken there is no extglob functionality used in the script).

Investigating a little further, it looks like (per http://bazaar.launchpad.net/~ubuntu-branches/ubuntu/raring/pm-utils/raring/revision/58) this script is intended to run on both x86 and x86_64. Which just leaves the unneeded bashism extglob...

Martin Pitt (pitti) wrote :

Yes, the script is supposed to run under both i386 and amd64; the intention of that statement is to not run it on arm, powerpc, and any other platform. I'm not actually sure where the extglob came from, sorry about that.

Changed in pm-utils (Ubuntu):
status: Confirmed → In Progress
assignee: nobody → Martin Pitt (pitti)
status: In Progress → Fix Committed
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package pm-utils - 1.4.1-10

---------------
pm-utils (1.4.1-10) unstable; urgency=low

  * debian/rules: Stop installing sleep.d/55NetworkManager. Current
    NetworkManager does not even expose this API any more, so the
    sleep()/wake() calls just always fail. As NM is apparently able to deal
    with suspends just fine, no need to waste cycles on this.
  * Drop 90-nm-proper-wakeup.patch: Obsolete with above change.
  * Add debian/time-hook-execution.patch: Measure time that hooks take and
    print them in the log. Also, disable actual suspend call to make hook
    optimization/measure turnarounds more convenient. This is not applied by
    default as the date calls themselves add overhead; just keep it in the
    source package for future use.
  * Add 15-video_quirks_on_x86_only.patch: Only run the video quirk handlers
    on x86 and x86_64, as they are quite expensive.
  * Add 16-no-powersave-before-suspend.patch: Calling pm-powersave before
    pm-suspend is very slow, it. e. g. takes > 1.5 seconds on a Nexus 7. This
    does not nearly compensate the potentially slightly slower suspend
    operation in low power mode, so disable it.
  * Drop the "shopt" bashism from 15-video_quirks_on_x86_only.patch which
    somehow slipped in there. (LP: #1091824)
  * Lift ethtool suggests to recommends, to make disable_wol work in a default
    installation. (LP: #1081785)
  * 20-video-quirk-pm-sony.quirkdb: Fix '||' typo, leading to suspend failure
    on Vaios. (Closes: #561877)

 -- Martin Pitt <email address hidden> Mon, 01 Jul 2013 07:46:04 +0200

Changed in pm-utils (Ubuntu):
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Duplicates of this bug

Other bug subscribers