oprofile script bug with used shell

Bug #172495 reported by Adrian Chadd
4
Affects Status Importance Assigned to Milestone
oprofile (Ubuntu)
Fix Released
Medium
Luca Falavigna

Bug Description

Binary package hint: oprofile

oprofile uses a control program thats written in sh (opcontrol) - this script uses:

#!/bin/sh

as the shell to run it was. Unfortunately this doesn't work well:

root@sun-3:/home/adrian# opcontrol -c 4 --start --vmlinux=none
Using default event: CPU_CLK_UNHALTED:100000:0:1:1
/usr/bin/opcontrol: 1: arith: syntax error: "NR_CHOSEN - 1"
No events given.

The code in question:

        if test "$NR_CHOSEN" != 0; then
                for f in `seq 0 $((NR_CHOSEN - 1))`; do
                        get_event $f
                        if test "$GOTEVENT" != ""; then
                                OPHELP_ARGS="$OPHELP_ARGS $GOTEVENT"
                        fi

Now I'm not certain whether this is sh, bash or dash compliant, but inserting an "echo $NR_CHOSEN" beforehand shows this value to be 0. Somehow the evaluation isn't "right" with an out of the box gutsy/amd64 install when using /bin/sh -> /bin/dash. There's no oprofile running and I've not run it before so /etc/oprofile is empty.

Changing the shell to #!/bin/bash solves the problem.

Related branches

Changed in oprofile:
assignee: nobody → dktrkranz
importance: Undecided → Medium
status: New → Confirmed
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package oprofile - 0.9.3-1.1ubuntu1

---------------
oprofile (0.9.3-1.1ubuntu1) hardy; urgency=low

  * Merge from debian unstable (LP: #179335), remaining changes:
    - Configuration file in /etc.
    - On powerpc configure --with-target=cell-be.
    - Fix for seg fault in opreport when using --xml and --details.
    - Change for opcontrol. Fix problem running on system using
      a network file system with different time base.
    - Change m4 file for SDK build process.
    - Add changes to allow profiling of code that the SPU runtime
      dynamically creates and runs on the stack.
  * debian/patches/opcontrol_bashisms:
    - fix bashisms in opcontrol script (LP: #172495)

oprofile (0.9.3-1.1) unstable; urgency=low

  * NMU
  * link libbfd static (closes: #446360)

 -- Luca Falavigna <email address hidden> Sat, 22 Dec 2007 09:53:22 +0000

Changed in oprofile:
status: Confirmed → 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.