<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "http://bugs.gentoo.org/bugzilla.dtd">

<bugzilla version="2.22.7"
          urlbase="http://bugs.gentoo.org/"
          maintainer="bugzilla@gentoo.org"
>

    <bug>
          <bug_id>80778</bug_id>
          
          <creation_ts>2005-02-04 14:07 0000</creation_ts>
          <short_desc>foldingathome-5.0.2-r1 CPU Count incorrect</short_desc>
          <delta_ts>2005-02-05 16:54:48 0000</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>Gentoo Linux</product>
          <component>Applications</component>
          <version>unspecified</version>
          <rep_platform>x86</rep_platform>
          <op_sys>All</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          
          
          <priority>P2</priority>
          <bug_severity>minor</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          
          <everconfirmed>1</everconfirmed>
          <reporter>andy.dalton@gmail.com</reporter>
          <assigned_to>sci@gentoo.org</assigned_to>
          

      

      
          <long_desc isprivate="0">
            <who>andy.dalton@gmail.com</who>
            <bug_when>2005-02-04 14:07:25 0000</bug_when>
            <thetext>The /etc/init.d/foldingathome startup scripts attempts to identify a CPU count automatically if the CPU variable is set to 0 in /etc/conf.d/foldingathome.  The code that does that is the following:

    if [ -z &quot;${CPU}&quot; ] || [ &quot;${CPU}&quot; == &quot;0&quot; ]; then
        if [ -r /proc/cpuinfo ]; then
            CPU=`grep processor &lt;/proc/cpuinfo | wc -l`
        else
            CPU=1
        fi
    fi

The problem is, however, the word &apos;processor&apos; can appear in different places.  Consider the following output I get by running the command manually:

# grep processor &lt;/proc/cpuinfo
processor       : 0
model name      : AMD Athlon(tm) processor

Here, I only have a single CPU, but the script determines I have two.  I suggest revising the script as follows:

replace
    CPU=`grep processor &lt;/proc/cpuinfo | wc -l`
with
    CPU=`grep &quot;^processor.*:&quot; /proc/cpuinfo | wc -l`

This way, the pattern matched is restricted to lines starting with the word processor, followed by some number of characters, followed by a colon.

Thanks,

Andy Dalton</thetext>
          </long_desc>
          <long_desc isprivate="0">
            <who>lostlogic@gentoo.org</who>
            <bug_when>2005-02-05 16:54:48 0000</bug_when>
            <thetext>Thanks, making -r3 with this change.</thetext>
          </long_desc>
      
    </bug>

</bugzilla>