Bug #23721 compile fails: check-cpu mishandles cpu flags with - in it (like ds-cpl).
Submitted: 27 Oct 2006 14:21 Modified: 2 Feb 2007 2:55
Reporter: Mikko Ruuska Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server Severity:S2 (Serious)
Version:5.0.26 OS:Linux (RHEL ES 3(5))
Assigned to: Chad MILLER CPU Architecture:Any
Tags: check-cpu, compile

[27 Oct 2006 14:21] Mikko Ruuska
Description:
When building on a system with cpu-flags that have dashes in them, compilation fails in check-cpu.

% ./BUILD/compile-pentium-max
./BUILD/compile-pentium-max: line 1: cpu_flag_ds-cpl=yes: command not found

In here (BUILD/check-cpu):

    # parse CPU flags
    for flag in `$cpuinfo | grep '^flags' | sed -e 's/^flags.*: //'`; do 
          eval cpu_flag_$flag=yes
    done

This is because variable names can't have - in them. 

To my understanding this machine has 2 CPUs (not 2 cores), early 64bit P4s.

See the flags in cpuinfo:

% cat /proc/cpuinfo 
processor  : 0
vendor_id  : GenuineIntel
cpu family : 15
model      : 4
model name :               Intel(R) Pentium(R) 4 CPU 3.00GHz
physical id  : 0
siblings   : 2
runqueue   : 0
stepping   : 3
cpu MHz    : 3000.280
cache size : 0 KB
fpu  : yes
fpu_exception   : yes
cpuid level  : 5
wp  : yes
flags      : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss tm ferr syscall nx lm sse3 monitor ds-cpl gv3 cnxt-id
bogomips   : 5989.99
clflush size : 64
address sizes   : 36 bits physical, 48 bits virtual
power management:

[another cpu clipped]

How to repeat:
Get a machine with a cpu that has such flags.

Run any compile-script, eg.

./BUILD/compile-pentium-max

Suggested fix:
Transform - (dash, minus) from the flag to, say, an underscore before evaling.
[31 Oct 2006 8:16] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/14589

ChangeSet@1.2342, 2006-10-31 09:15:53+01:00, hartmut@mysql.com +1 -0
  convert '-' in cpu flags to '_' for variable assignment (Bug #23721)
[9 Nov 2006 19:52] Mikko Ruuska
The thing about this bug was: intel 64-bit processor on 64-bit linux with 2.4 kernel (one with the intel flags added, at least .21 has them). In 2.6 ds-cpl is ds_cpl and at least some 2.4 distros seem to have patched that.
[17 Jan 2007 18:08] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/18268

ChangeSet@1.2597, 2007-01-17 13:08:40-05:00, cmiller@zippy.cornsilk.net +1 -0
  Bug#23721: compile fails: check-cpu mishandles cpu flags with \
  	hyphen in it (like ds-cpl).
  
  convert '-' in cpu flags to '_' for variable assignment (Bug #23721)
[17 Jan 2007 18:23] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/18271

ChangeSet@1.2597, 2007-01-17 13:22:50-05:00, cmiller@zippy.cornsilk.net +2 -0
  Bug#23721: compile fails: check-cpu mishandles cpu flags with \
  	hyphen in it (like ds-cpl).
  
  convert illegal chars in cpu flags to '_' for variable assignment
[31 Jan 2007 19:10] Chad MILLER
Available in 4.1.23, 5.0.36, 5.1.15-beta.
[2 Feb 2007 2:55] Paul DuBois
No changelog entry needed.