Bug 2217542

Summary: The cppcheck-2.11-1.fc39 fails on gettext.h with returnDanglingLifetime
Product: [Fedora] Fedora Reporter: Jiri Konecny <jkonecny>
Component: cppcheckAssignee: Gwyn Ciesla <gwync>
Status: CLOSED ERRATA QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 39CC: c72578, dueno, i18n-bugs, mtasaka, nphilipp, petersen, sgrubb, suanand, susi.lehtola, tdawson
Target Milestone: ---   
Target Release: ---   
Hardware: x86_64   
OS: Linux   
URL: https://github.com/rhinstaller/anaconda/actions/runs/5378586167/jobs/9758588667#step:4:2099
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2024-09-20 15:02:26 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Jiri Konecny 2023-06-26 15:56:14 UTC
On Rawhide cppcheck was recently updated and now we are getting returnDanglingLifetime error from it on copied gettext.h file from /usr/share/gettext/gettext.h path.

Version of cppcheck which shows this issue: 2.11-1.fc39
Last version of cppcheck which worked well: 2.9-4.fc38

I don't know if the error is valid or not...

Reproducible: Always

Steps to Reproduce:
1. podman run --rm -it fedora:rawhide
2. dnf install -y cppcheck gettext-devel
3. cppcheck -q -v /usr/share/gettext/gettext.h
Actual Results:  
/usr/share/gettext/gettext.h:248:16: error: Returning pointer to local variable 'msg_ctxt_id' that will be invalid when returning. [returnDanglingLifetime]
        return translation;

Expected Results:  
No error

Comment 1 Jens Petersen 2023-06-28 18:43:44 UTC
I am wondering: is it the new version of cppcheck or the new version of gettext?

Comment 2 Jiri Konecny 2023-06-30 13:50:05 UTC
Hi seems to be cppcheck version specific. The version of gettext did not changed during the success -> failure period.

Both the failure and successful checks were testing gettext-devel x86_64 0.21.1-3.fc39

Comment 3 Jens Petersen 2023-07-04 04:54:04 UTC
Thanks Jiri for clarifying

I see the error for gettext-0.21.1 and gettext0.22 (0.21 seems okay).
The source file is "gettext-runtime/gnulib-lib/gettext.h".

I reported it to bug-gettext - depending on the response I may open a bug in savannah too.

Comment 4 Jens Petersen 2023-07-04 10:32:33 UTC
According the reply I got from Bruno Haible:

https://lists.gnu.org/archive/html/bug-gettext/2023-07/msg00003.html

this should be a false positive.

Should it be reported to cppcheck then?

Comment 5 Jiri Konecny 2023-07-14 09:40:07 UTC
Sounds reasonable to me. Maybe switching this bug to cppcheck for them to find out if this is a bug in cppcheck or not.

Comment 6 Fedora Release Engineering 2023-08-16 08:11:25 UTC
This bug appears to have been reported against 'rawhide' during the Fedora Linux 39 development cycle.
Changing version to 39.

Comment 7 Fedora Admin user for bugzilla script actions 2024-09-19 15:39:20 UTC
This package has changed maintainer in Fedora. Reassigning to the new maintainer of this component.

Comment 8 Fedora Admin user for bugzilla script actions 2024-09-20 01:59:11 UTC
This package has changed maintainer in Fedora. Reassigning to the new maintainer of this component.

Comment 9 Gwyn Ciesla 2024-09-20 15:02:26 UTC
Leaving this for upstream.