Menu

#153 opcontrol fails on Ubuntu 6.10 (Edgy Eft)

closed-fixed
None
5
2009-07-31
2006-12-27
erpo41
No

DISCLAIMER: I am new to oprofile.

--------------------------

The Problem

opcontrol fails when I run it on both of my linux boxes. Both are Ubuntu 6.10 (Edgy Eft).

--------------------------

What I Did

I ran the command line:
sudo opcontrol --no-vmlinux --start
and the following output was printed:

Using default event: CPU_CLK_UNHALTED:100000:0:1:1
/usr/bin/opcontrol: 1: arith: syntax error: "NR_CHOSEN - 1"
No events given.

--------------------------

The Stopgap Fix

After a bunch of troubleshooting, I tracked the problem down to /bin/sh (the interpreter for opcontrol) being symlinked to /bin/dash in my distro instead of /bin/bash.

This command line works:
sudo bash opcontrol --no-vmlinux --start

-------------------------

Permanent Solution Options

1. The interpreter for opcontrol could be changed from one that sometimes does not work (i.e. /bin/sh) to one that works (i.e. /bin/bash).

2. opcontrol, and possibly other programs related to oprofile, could be rewritten to work with dash.

3. A warning could be printed if opcontrol detects that it is being interpreted by dash. However, for some reason, the SHELL variable is set to /bin/bash inside dash. I have no idea why this is done, but it means the SHELL variable is not a reliable method of detecting which shell is being used.

Discussion

  • John Levon

    John Levon - 2006-12-27

    Logged In: YES
    user_id=53034
    Originator: NO

    The script is supposed to be shell agnostic. I'm not sure whether $((FOO - 1)) is POSIX or not.

     
  • Brian Eaton

    Brian Eaton - 2006-12-29

    Logged In: YES
    user_id=1678773
    Originator: NO

    This is a bug in dash: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=329025

     
  • John Levon

    John Levon - 2006-12-29

    Logged In: YES
    user_id=53034
    Originator: NO

    Then I'm much inclined to either get Ubuntu to ship their own hacked oprofile, and/or tell Ubuntu users to
    switch to bash (as essentially everybody has to do anyway). We're not regressing beyond standard shell
    behaviour to suit a poorly thought out decision by one vendor.

     
  • Maynard Johnson

    Maynard Johnson - 2009-05-13

    Obuntu used to have a problem with dash failing on $((NR_CHOSEN - 1)) in opcontrol. This form is, in fact, posix-compliant, which is why no action was taken on the part of the oprofile project. On May 12, 2009, Brian Bloniarz reported to the oprofile list that Obuntu has fixed this problem, and that opcontrol's use of the "let" built-in was the lone bashism that needed to be replaced with something posix-compliant. Brian posted a patch and it was committed to CVS on May 13. So this bug has now been resolved.

     
  • Maynard Johnson

    Maynard Johnson - 2009-05-13
    • assigned_to: nobody --> maynardj
    • status: open --> open-fixed
     
  • Maynard Johnson

    Maynard Johnson - 2009-07-31
    • status: open-fixed --> closed-fixed
     

Log in to post a comment.