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
I am wondering: is it the new version of cppcheck or the new version of gettext?
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
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.
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?
Sounds reasonable to me. Maybe switching this bug to cppcheck for them to find out if this is a bug in cppcheck or not.
This bug appears to have been reported against 'rawhide' during the Fedora Linux 39 development cycle. Changing version to 39.
This package has changed maintainer in Fedora. Reassigning to the new maintainer of this component.
Leaving this for upstream.