[SRU] for oprofile, edgy-updates: bashism in oprofile's opcontrol script prevents user from setting any events

Bug #69455 reported by isign
28
Affects Status Importance Assigned to Milestone
oprofile (Debian)
Fix Released
Unknown
oprofile (Ubuntu)
Fix Released
Undecided
Adam Conrad
Gutsy
Invalid
Undecided
Unassigned
Hardy
Fix Released
Undecided
Adam Conrad

Bug Description

After invokation of
sudo opcontrol --event=default
the following lines occur:

/usr/bin/opcontrol: 1: arith: syntax error: "NR_CHOSEN - 1"
/usr/bin/opcontrol: 1: arith: syntax error: "NR_CHOSEN - 1"
No events given.

ophelp --get-default-event gives the following
CPU_CLK_UNHALTED:100000:0:1:1

Thanks in advance,

jochen

Revision history for this message
Kai Schroeder (kai-schroeder) wrote :

this can be easily fixed by replacing /bin/sh with /bin/bash in the first line of /usr/bin/opcontrol

Revision history for this message
Daniel T Chen (crimsun) wrote : SRU proposal for 6.10's oprofile 0.9.2-1

Hi all,

Recently I was made aware of bashisms[0] in the opcontrol script in
Edgy's oprofile 0.9.2-1 that were fixed in Debian's upload of 0.9.2-2.
All arches in Edgy are affected, and only Edgy is affected. For this
reason I've generated a debdiff that changes the invoked shell to
/bin/bash instead of /bin/sh, which is the least invasive and obviously
correct fix.

Attached please find an SRU debdiff for 6.10's oprofile 0.9.2-1.

% debdiff oprofile_0.9.2-1.dsc oprofile_0.9.2-1ubuntu0.1.dsc |diffstat
 oprofile-0.9.2/debian/changelog | 9 +++++++++
 utils/opcontrol | 2 +-
 2 files changed, 10 insertions(+), 1 deletion(-)

[0] https://launchpad.net/distros/ubuntu/+source/oprofile/+bug/69455

Thanks,
--
Daniel T. Chen <email address hidden>
GPG key: 0xC88ABDA3

diff -u oprofile-0.9.2/debian/changelog oprofile-0.9.2/debian/changelog
--- oprofile-0.9.2/debian/changelog
+++ oprofile-0.9.2/debian/changelog
@@ -1,3 +1,12 @@
+oprofile (0.9.2-1ubuntu0.1) edgy-proposed; urgency=low
+
+ * utils/opcontrol: Use /bin/bash instead of /bin/sh (Closes
+ Ubuntu: #69455), allowing opcontrol to function correctly. (Note:
+ This change is the least invasive one for -updates and so preferable
+ to the fixes in Debian #395014).
+
+ -- Daniel T Chen <email address hidden> Sun, 5 Nov 2006 03:44:52 -0500
+
 oprofile (0.9.2-1) unstable; urgency=low

   * Updated to latest upstream source.
only in patch2:
unchanged:
--- oprofile-0.9.2.orig/utils/opcontrol
+++ oprofile-0.9.2/utils/opcontrol
@@ -1,4 +1,4 @@
-#!/bin/sh
+#!/bin/bash
 #
 # opcontrol is a script to control OProfile
 # opcontrol --help and opcontrol --list-events have info

Changed in oprofile:
assignee: nobody → motu-sru
Changed in oprofile:
status: Unknown → Fix Released
Revision history for this message
StefanPotyra (sistpoty) wrote : Re: bashism in oprofile's opcontrol script prevents user from setting any events

Hi,

not quite sure if this bug matches "high profile", but at least it doesn't involve a high risk.

+1 from me.

Cheers,
     Stefan.

Revision history for this message
Reinhard Tartler (siretart) wrote :

+1 from me as well

Revision history for this message
isign (jochen-isign-softart) wrote : Re: [Bug 69455] Re: unable to set any event neither on amd64 nor i686 (Pentium M)

Thanks, it works for me as well... Embarassing I didn't see...

Cheers,

jochen

On Sunday 05 November 2006 09:23, Kai Schroeder wrote:
> this can be easily fixed by replacing /bin/sh with /bin/bash in the first
> line of /usr/bin/opcontrol

--
 jochen issing
 gpg-sig: 0A121BC8
 www.isign-softart.de

Revision history for this message
Colin Watson (cjwatson) wrote : Re: bashism in oprofile's opcontrol script prevents user from setting any events

FWIW, I'm not sure it's really accurate to describe this as a bashism; it's really a bug in dash. See http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=385195 for details.

Revision history for this message
Colin Watson (cjwatson) wrote :

Accepted into edgy-proposed. Once it builds, please contact the QA team via Simon Law to verify that the bug has been fixed and that there are no regressions.

This bug has been fixed in the source package feisty, but note that oprofile 0.9.2-2 failed to build on all architectures so the fix is not really available yet. Somebody might like to have a look at that.

Changed in oprofile:
status: Unconfirmed → In Progress
Revision history for this message
Daniel T Chen (crimsun) wrote : StableReleaseUpdates - Ubuntu bug 69455 - testing phase notification

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

QA team et al.,

Per SRU policy, I'm writing to request additional verification for the
fix in Ubuntu bug report 69455. Colin has accepted oprofile
(0.9.2-1ubuntu0.1) into edgy-proposed, and I've verified locally that
this version fixes the symptom. Please test on available edgy
configurations.

Per Colin's note, oprofile 0.9.2-3 was accepted[0] into Sid, fixing the
mentioned FTBFS. It should be synced into feisty.

[0] http://packages.qa.debian.org/o/oprofile/news/20061119T033214Z.html

Thanks,
- --
Daniel T. Chen <email address hidden>
GPG key: 0xC88ABDA3
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.5 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFFZDI7e9GwFciKvaMRAgHnAJ4nzFTVy+pzoTrESnvZnrjAN4SJKQCeIUif
DPtIpZzhN9VNJu5qkC+oU88=
=QRXC
-----END PGP SIGNATURE-----

Revision history for this message
Simon Law (sfllaw) wrote : Re: bashism in oprofile's opcontrol script prevents user from setting any events

This universe bug should be following the https://wiki.ubuntu.com/MOTU/Processes/SRU draft policy.

Revision history for this message
Simon Law (sfllaw) wrote :

There is something wrong with this patch. You have made oprofile depend on bash by changing its #! line.

You have not added a Depends: bash to the debian/control file, though. This means bash could be removed and oprofile will break.

Please upload a new package to -proposed with a fixed debian/control file.

I presume that when Feisty will not have this problem, as the bashisms will be removed by then.

Revision history for this message
Daniel T Chen (crimsun) wrote :

Thanks, Simon. I've made the appropriate adjustments, respun the source package, and uploaded to edgy-proposed.

StefanPotyra (sistpoty)
Changed in oprofile:
assignee: motu-sru → crimsun
Revision history for this message
Tollef Fog Heen (tfheen) wrote :

A few comments:

- The depends on bash is not needed, bash is Essential: yes and trying to remove it will give you large warnings.
- Subscribing ubuntu-archive to SRU bugs is considered useful, if not, it doesn't show up on our worklist.

To me, it looks like the current version in -proposed is fine; once it has received enough testing, please upload to -updates.

Revision history for this message
Adam Conrad (adconrad) wrote :

Released to -updates... Six months of testing seemed like more than enough to me for a 2-character fix. :)

Changed in oprofile:
assignee: crimsun → adconrad
status: In Progress → Fix Released
Revision history for this message
Zooko Wilcox-O'Hearn (zooko) wrote :

I seem to have the same problem on gutsy:

zooko@tahoecs2:~$ sudo opcontrol --start --no-vmlinux
Using default event: GLOBAL_POWER_EVENTS:100000:1:1:1
/usr/bin/opcontrol: 1: arith: syntax error: "NR_CHOSEN - 1"
No events given.

zooko@tahoecs2:~$ cat /etc/issue
Ubuntu 7.10 \n \l

Revision history for this message
Kai Schroeder (kai-schroeder) wrote :

I have applied the same fix as for Feisty in the attached debdiff. As this is my first patch please have a closer look at it. I have been told on #ubuntu-motu that bash is essential and does not have to be specified in Depends, so that part of the Feisty patch is missing.

Revision history for this message
Kai Schroeder (kai-schroeder) wrote :

updated patch that removes the statement that bash has been added to Depends from the changelog. sorry for the noise.

Revision history for this message
Kai Schroeder (kai-schroeder) wrote :

debdiff for gutsy-proposed

Revision history for this message
Olly Betts (ojwb) wrote :

I've just run into this on gutsy.

I'm really just commenting to note that until the proposed fix gets to the repository you can workaround the problem quite easily by running explicitly using bash, like so:

sudo bash opcontrol --start --no-vmlinux

Revision history for this message
Maor (maor-gm) wrote :

I've run into this bug in gusty.
This problem seems to repeat itself every release.

Revision history for this message
Lucian Adrian Grijincu (lucian.grijincu) wrote :

Yep still broken in gutsy, Olly Betts' solution:
      sudo bash opcontrol --start --no-vmlinux
works just fine, thanx :)

Revision history for this message
Paulo Henrique Silva (phsilva) wrote :

The problem was resolved upstream. See https://lists.ubuntu.com/archives/ubuntu-patches/2008-January/015928.html.
Aside from sh problems with arithmetic (solved by http://launchpadlibrarian.net/11784461/opcontrol-quoting.patch) , there was also some problems with "let" (only solved upstream).

With this upstream patch, there is no need to change from sh to bash.

Revision history for this message
Olly Betts (ojwb) wrote :

gutsy has now reached end of life, so there's no point at all this staying open.

Changed in oprofile (Ubuntu Gutsy):
status: New → Invalid
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.