Bug 2217542 - The cppcheck-2.11-1.fc39 fails on gettext.h with returnDanglingLifetime
Summary: The cppcheck-2.11-1.fc39 fails on gettext.h with returnDanglingLifetime
Keywords:
Status: ASSIGNED
Alias: None
Product: Fedora
Classification: Fedora
Component: gettext
Version: 39
Hardware: x86_64
OS: Linux
unspecified
medium
Target Milestone: ---
Assignee: Jens Petersen
QA Contact: Fedora Extras Quality Assurance
URL: https://github.com/rhinstaller/anacon...
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2023-06-26 15:56 UTC by Jiri Konecny
Modified: 2023-08-16 08:11 UTC (History)
5 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed:
Type: ---
Embargoed:


Attachments (Terms of Use)

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.


Note You need to log in before you can comment on or make changes to this bug.