[RFC, PATCH] UBUNTU: fix perf kernel version detection for multiple-flavour strings

Tim Gardner tim.gardner at canonical.com
Wed Apr 21 13:25:58 UTC 2010


On 04/21/2010 06:42 AM, Jeremy Kerr wrote:
> Currently, the perf tool doesn't work for the generic-pae flavour:
>
>   $ bash -x /usr/bin/perf
>   ++ uname -r
>   + version=2.6.32-21-generic-pae
>   + version=2.6.32-21-generic
>   + exec perf_2.6.32-21-generic
>   /usr/bin/perf: line 4: exec: perf_2.6.32-21-generic: not found
>
> - the PAE flavour has a version string ending in -generic-pae, but the
> version cleaning in the perf script doesn't handle the multiple flavour
> strings correctly. The perf tool is named perf_2.6.32-21, not
> perf_2.6.32-21-generic.
>
> This change fixes the perf wrapper script to throw away version data
> after a 'dash, non-digit' sequence instead of just the last dash. This
> fixes the problem on the PAE kernel. We need to do a special pass for
> the -386 flavour, as it's virtually indisinguishable from a normal
> version number. Testing this parsing against the possible flavours
> gives:
>
>          2.6.32-21-generic ->  2.6.32-21
>           2.6.32-21-server ->  2.6.32-21
>          2.6.32-21-preempt ->  2.6.32-21
>        2.6.32-21-versatile ->  2.6.32-21
>          2.6.32-21-generic ->  2.6.32-21
>      2.6.32-21-generic-pae ->  2.6.32-21
>              2.6.32-21-386 ->  2.6.32-21
>             2.6.32-21-ia64 ->  2.6.32-21
>             2.6.32-21-lpia ->  2.6.32-21
>          2.6.32-21-powerpc ->  2.6.32-21
>      2.6.32-21-powerpc-smp ->  2.6.32-21
>    2.6.32-21-powerpc64-smp ->  2.6.32-21
>          2.6.32-21-sparc64 ->  2.6.32-21
>      2.6.32-21-sparc64-smp ->  2.6.32-21
>
> Signed-off-by: Jeremy Kerr<jeremy.kerr at canonical.com>
>
> ---
>   debian/tools/perf |    3 ++-
>   1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/debian/tools/perf b/debian/tools/perf
> index 1a9915f..33df59d 100644
> --- a/debian/tools/perf
> +++ b/debian/tools/perf
> @@ -1,4 +1,5 @@
>   #!/bin/bash
>   version=`uname -r`
> -version=${version%-*}
> +version=${version/-[^0-9]*}
> +version=${version%-386}
>   exec "perf_$version" "$@"
>

Why not just drop everything after the second '-' inclusive ?

rtg
-- 
Tim Gardner tim.gardner at canonical.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-UBUNTU-Do-a-better-job-of-stripping-version-informat.patch
Type: text/x-diff
Size: 731 bytes
Desc: not available
URL: <https://lists.ubuntu.com/archives/kernel-team/attachments/20100421/8e67f67f/attachment.patch>


More information about the kernel-team mailing list