[stx-metal] wrong code to set the terminate char.

Bug #1804599 reported by Yan Chen
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
StarlingX
Fix Released
Low
Yan Chen

Bug Description

Title
-----
[stx-metal] wrong code to set the terminate char.

Brief Description
-----------------
In mtce/src/hwmon/hwmonThreads.cpp, line 266:
    ++dst_ptr = '\0' ;
should be modified as
    *(++dst_ptr) = '\0' ;
Otherwise the code is useless and will generate a compile error in higher version gcc.

Severity
--------
Critical

Steps to Reproduce
------------------
Code review.

Expected Behavior
------------------
stx-metal can pass compile on gcc 8.2.1

Actual Behavior
----------------
stx-metal cannot pass compile on gcc 8.2.1

Reproducibility
---------------
100% reproducible with gcc 8.2.1

System Configuration
--------------------
Build time issue.

Branch/Pull Time/Commit
-----------------------
master

Timestamp/Logs
--------------
2018-11-22 17:09:19.888 | g++ -I. -I/usr/include/mtce-daemon -I/usr/include/mtce-common -I../maintenance -g -O2 -Wall -Wextra -std=c++11 -DBUILDINFO="\"$(date)\"" -c hwmonTs.cpp -o hwmonThreads.o
2018-11-22 17:09:20.261 | hwmonThreads.cpp: In function ‘void _get_field(char*, int, char*)’:
2018-11-22 17:09:20.261 | hwmonThreads.cpp:266:17: error: invalid conversion from ‘char’ to ‘char*’ [-fpermissive]
2018-11-22 17:09:20.261 | ++dst_ptr = '\0' ;
2018-11-22 17:09:20.261 | ^~~~
2018-11-22 17:09:20.262 | make[1]: *** [Makefile:36: hwmonThreads.o] Error 1
2018-11-22 17:09:20.262 | make[1]: Leaving directory '/opt/stack/stx-metal/mtce/src/hwmon'
2018-11-22 17:09:20.262 | make: *** [Makefile:17: build] Error 2
2018-11-22 17:09:20.268 | +/opt/stack/stx-metal/devstack/lib/stx-metal:install_mtce:1 exit_trap

Yan Chen (ychen2u)
Changed in starlingx:
assignee: nobody → Yan Chen (ychen2u)
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to stx-metal (master)

Fix proposed to branch: master
Review: https://review.openstack.org/619462

Changed in starlingx:
status: New → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to stx-metal (master)

Reviewed: https://review.openstack.org/619462
Committed: https://git.openstack.org/cgit/openstack/stx-metal/commit/?id=b2290e4fd97974753fff500643c8160f477d55fc
Submitter: Zuul
Branch: master

commit b2290e4fd97974753fff500643c8160f477d55fc
Author: Yan Chen <email address hidden>
Date: Fri Nov 23 01:47:44 2018 +0800

    fix the wrong code to set the terminate char

    Description:

    In mtce/src/hwmon/hwmonThreads.cpp, line 266:
        ++dst_ptr = '\0' ;
    should be modified as
        *(++dst_ptr) = '\0' ;
    Otherwise the code is useless and will generate a compile error in
      higher version gcc.

    Reproduce:

    Compile the mcte code with gcc 8.2.1 will cause a compile error.
    And after the fix, the error is gone.

    Closes-Bug: 1804599
    Change-Id: I25df255fb14aa3d96c62927eeb7d3e23ae29af2b
    Signed-off-by: Yan Chen <email address hidden>

Changed in starlingx:
status: In Progress → Fix Released
Revision history for this message
Ghada Khalil (gkhalil) wrote :

Low priority, but would be nice to fix. There are no compile issues with the compiler used in the current StarlingX build environment. This is a future proofing exercise.

Changed in starlingx:
importance: Undecided → Low
tags: added: stx.2019.03 stx.metal
Ken Young (kenyis)
tags: added: stx.2019.05
removed: stx.2019.03
Ken Young (kenyis)
tags: added: stx.2.0
removed: stx.2019.05
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.