Fix C compatibility issues
Related to: <https://fedoraproject.org/wiki/Changes/PortingToModernC> <https://fedoraproject.org/wiki/Toolchain/PortingToModernC>
This commit is contained in:
parent
630761c4fe
commit
2a28c71178
60
OpenIPMI-c99.patch
Normal file
60
OpenIPMI-c99.patch
Normal file
@ -0,0 +1,60 @@
|
||||
C type errors in the SWIG-generated Perl bindings
|
||||
|
||||
The first change fixes an error with newer compilers:
|
||||
|
||||
OpenIPMI_wrap.c: In function ‘_wrap_strconstarray_val_set’:
|
||||
OpenIPMI_wrap.c:10491:27: error: assignment to ‘const char **’ from incompatible pointer type ‘char **’
|
||||
10491 | if (arg1) (arg1)->val = arg2;
|
||||
| ^
|
||||
|
||||
The second change is also about a compiler error:
|
||||
|
||||
In file included from /usr/lib64/perl5/CORE/perl.h:4530,
|
||||
from OpenIPMI_wrap.c:751:
|
||||
OpenIPMI_wrap.c: In function ‘_wrap_ipmi_sol_conn_t_write’:
|
||||
/usr/lib64/perl5/CORE/sv.h:1952:31: error: passing argument 3 of ‘Perl_SvPV_helper’ from incompatible pointer type
|
||||
1952 | Perl_SvPV_helper(aTHX_ sv, &len, flags, SvPVnormal_type_, \
|
||||
/usr/lib64/perl5/CORE/sv.h:1972:37: note: in expansion of macro ‘SvPV_flags’
|
||||
1972 | #define SvPV(sv, len) SvPV_flags(sv, len, SV_GMAGIC)
|
||||
| ^~~~~~~~~~
|
||||
OpenIPMI_wrap.c:27664:24: note: in expansion of macro ‘SvPV’
|
||||
27664 | (&arg2)->val = SvPV(tempsv, (&arg2)->len);
|
||||
| ^~~~
|
||||
In file included from /usr/lib64/perl5/CORE/perl.h:7812:
|
||||
/usr/lib64/perl5/CORE/sv_inline.h:908:33: note: expected ‘STRLEN * const’ {aka ‘long unsigned int * const’} but argument is of type ‘int *’
|
||||
908 | STRLEN * const lp,
|
||||
| ~~~~~~~~~~~~~~~^~
|
||||
|
||||
But the existing code looks broken on big-endian 64-bit architectures,
|
||||
too.
|
||||
|
||||
Submitted upstream: <https://sourceforge.net/p/openipmi/patches/38/>
|
||||
|
||||
diff --git a/swig/OpenIPMI.i b/swig/OpenIPMI.i
|
||||
index 8e674a94e6f85f62..db2aa1b5292a276f 100644
|
||||
--- a/swig/OpenIPMI.i
|
||||
+++ b/swig/OpenIPMI.i
|
||||
@@ -359,7 +359,7 @@ typedef struct iargarray
|
||||
%}
|
||||
typedef struct strconstarray
|
||||
{
|
||||
- char **val;
|
||||
+ const char **val;
|
||||
int len;
|
||||
} strconstarray;
|
||||
typedef struct argarray
|
||||
diff --git a/swig/perl/OpenIPMI_lang.i b/swig/perl/OpenIPMI_lang.i
|
||||
index d13b62f09e69e02a..d7482d1135cdc3e4 100644
|
||||
--- a/swig/perl/OpenIPMI_lang.i
|
||||
+++ b/swig/perl/OpenIPMI_lang.i
|
||||
@@ -292,7 +292,9 @@
|
||||
$1.val = NULL;
|
||||
$1.len = 0;
|
||||
} else {
|
||||
- $1.val = SvPV(tempsv, $1.len);
|
||||
+ STRLEN len;
|
||||
+ $1.val = SvPV(tempsv, len);
|
||||
+ $1.len = len;
|
||||
}
|
||||
}
|
||||
|
@ -4,7 +4,7 @@ Summary: IPMI (Intelligent Platform Management Interface) library and tools
|
||||
Name: OpenIPMI
|
||||
|
||||
Version: 2.0.32
|
||||
Release: 10%{?dist}
|
||||
Release: 11%{?dist}
|
||||
License: LGPL-2.1-or-later and GPL-2.0-or-later or BSD-3-Clause
|
||||
URL: http://sourceforge.net/projects/openipmi/
|
||||
Source: http://downloads.sourceforge.net/openipmi/%{name}-%{version}.tar.gz
|
||||
@ -14,6 +14,7 @@ Source3: ipmi.service
|
||||
Patch1: 0001-man.patch
|
||||
Patch2: OpenIPMI-ax-python.patch
|
||||
Patch3: OpenIPMI-sysconfig.patch
|
||||
Patch4: OpenIPMI-c99.patch
|
||||
|
||||
BuildRequires: make
|
||||
BuildRequires: gdbm-devel swig glib2-devel net-snmp-devel ncurses-devel
|
||||
@ -199,6 +200,9 @@ echo ".so man1/openipmish.1" > %{buildroot}%{_mandir}/man1/ipmish.1
|
||||
%{_mandir}/man5/ipmi_sim_cmd.5*
|
||||
|
||||
%changelog
|
||||
* Mon Jan 08 2024 Florian Weimer <fweimer@redhat.com> - 2.0.32-11
|
||||
- Fix C compatibility issues
|
||||
|
||||
* Wed Jul 19 2023 Fedora Release Engineering <releng@fedoraproject.org> - 2.0.32-10
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_39_Mass_Rebuild
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user