Bug 2235734 - Changes in net-snmp-config-s390x.h break s390utils build
Summary: Changes in net-snmp-config-s390x.h break s390utils build
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Fedora
Classification: Fedora
Component: s390utils
Version: rawhide
Hardware: Unspecified
OS: Linux
unspecified
medium
Target Milestone: ---
Assignee: Dan Horák
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2023-08-29 15:18 UTC by Jakub Čajka
Modified: 2023-11-20 08:54 UTC (History)
6 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2023-11-20 08:54:08 UTC
Type: ---
Embargoed:


Attachments (Terms of Use)
Patch with solution (377 bytes, patch)
2023-08-30 18:27 UTC, Josef Ridky
no flags Details | Diff

Description Jakub Čajka 2023-08-29 15:18:35 UTC
This seems to be tied to the change of bunch of definitions of functions in the net-snmp-config from:
"
#define config_error(x)

#define config_warning(x)

#define config_belongs_in(x)

#define config_exclude(x)

#define config_arch_require(x,y)

#define config_version_require(x)

#define config_require(x)

#define config_add_mib(x)

#define config_parse_dot_conf(w,x,y,z)
"
to:
"#define config_parse_dot_conf(w,x,y,z) NETSNMP_REQUIRE_SEMICOLON

#define config_error(x) NETSNMP_REQUIRE_SEMICOLON

#define config_warning(x) NETSNMP_REQUIRE_SEMICOLON

#define NETSNMP_REQUIRE_SEMICOLON extern void netsnmp_unused_function(void)

#define config_belongs_in(x) NETSNMP_REQUIRE_SEMICOLON

#define config_exclude(x) NETSNMP_REQUIRE_SEMICOLON

#define config_arch_require(x,y) NETSNMP_REQUIRE_SEMICOLON

#define config_version_require(x) NETSNMP_REQUIRE_SEMICOLON

#define config_require(x) NETSNMP_REQUIRE_SEMICOLON

#define config_add_mib(x) NETSNMP_REQUIRE_SEMICOLON
"
Reverting it fixed the issue with the header file(s).

Reproducible: Always

Steps to Reproduce:
1. Build s390utils in rawhide, f39
Actual Results:  
...snip...
osasnmpd.c: In function 'netsnmp_unused_function':
osasnmpd.c:31:19: error: storage class specified for parameter 'oid_list_head'
   31 | extern TABLE_OID* oid_list_head;
      |                   ^~~~~~~~~~~~~
osasnmpd.c:33:1: error: parameter 'keep_running' is initialized
   33 | sig_atomic_t keep_running = 1;
      | ^~~~~~~~~~~~
osasnmpd.c:34:1: error: parameter 'interfaces_changed' is initialized
   34 | sig_atomic_t interfaces_changed = 0;
      | ^~~~~~~~~~~~
osasnmpd.c:39:1: error: expected '=', ',', ';', 'asm' or '__attribute__' before '{' token
   39 | {
      | ^
osasnmpd.c:48:1: error: expected '=', ',', ';', 'asm' or '__attribute__' before '{' token
   48 | {
      | ^
osasnmpd.c:55:1: error: expected '=', ',', ';', 'asm' or '__attribute__' before '{' token
   55 | {
      | ^
osasnmpd.c:78:1: error: expected '=', ',', ';', 'asm' or '__attribute__' before '{' token
   78 | {
      | ^
osasnmpd.c:97:22: error: storage class specified for parameter 'longopts'
   97 | static struct option longopts[] = {
      |                      ^~~~~~~~
osasnmpd.c:97:15: error: parameter 'longopts' is initialized
   97 | static struct option longopts[] = {
      |               ^~~~~~
osasnmpd.c:97:35: error: variable-sized object may not be initialized except with an empty initializer
   97 | static struct option longopts[] = {
      |                                   ^
osasnmpd.c:98:9: warning: braces around scalar initializer
   98 |         {"help",no_argument,0,'h'},
      |         ^
osasnmpd.c:98:9: note: (near initialization for 'longopts')
osasnmpd.c:98:10: warning: initialization of 'struct option *' from incompatible pointer type 'char *' [-Wincompatible-pointer-types]
   98 |         {"help",no_argument,0,'h'},
      |          ^~~~~~
osasnmpd.c:98:10: note: (near initialization for 'longopts')
osasnmpd.c:98:17: warning: excess elements in scalar initializer
   98 |         {"help",no_argument,0,'h'},
      |                 ^~~~~~~~~~~
osasnmpd.c:98:17: note: (near initialization for 'longopts')
osasnmpd.c:98:29: warning: excess elements in scalar initializer
   98 |         {"help",no_argument,0,'h'},
      |                             ^
osasnmpd.c:98:29: note: (near initialization for 'longopts')
osasnmpd.c:98:31: warning: excess elements in scalar initializer
   98 |         {"help",no_argument,0,'h'},
      |                               ^~~
osasnmpd.c:98:31: note: (near initialization for 'longopts')
osasnmpd.c:99:9: warning: braces around scalar initializer
   99 |         {"version",no_argument,0,'v'},
      |         ^
osasnmpd.c:99:9: note: (near initialization for 'longopts')
osasnmpd.c:99:10: warning: initialization of 'struct option *' from incompatible pointer type 'char *' [-Wincompatible-pointer-types]
   99 |         {"version",no_argument,0,'v'},
      |          ^~~~~~~~~
osasnmpd.c:99:10: note: (near initialization for 'longopts')
osasnmpd.c:99:20: warning: excess elements in scalar initializer
   99 |         {"version",no_argument,0,'v'},
      |                    ^~~~~~~~~~~
osasnmpd.c:99:20: note: (near initialization for 'longopts')
osasnmpd.c:99:32: warning: excess elements in scalar initializer
   99 |         {"version",no_argument,0,'v'},
      |                                ^
osasnmpd.c:99:32: note: (near initialization for 'longopts')
osasnmpd.c:99:34: warning: excess elements in scalar initializer
   99 |         {"version",no_argument,0,'v'},
      |                                  ^~~
osasnmpd.c:99:34: note: (near initialization for 'longopts')
osasnmpd.c:99:9: warning: excess elements in scalar initializer
   99 |         {"version",no_argument,0,'v'},
      |         ^
osasnmpd.c:99:9: note: (near initialization for 'longopts')
osasnmpd.c:100:9: warning: braces around scalar initializer
  100 |         {"append",no_argument,0,'A'},
      |         ^
osasnmpd.c:100:9: note: (near initialization for 'longopts')
osasnmpd.c:100:10: warning: initialization of 'struct option *' from incompatible pointer type 'char *' [-Wincompatible-pointer-types]
  100 |         {"append",no_argument,0,'A'},
      |          ^~~~~~~~
osasnmpd.c:100:10: note: (near initialization for 'longopts')
osasnmpd.c:100:19: warning: excess elements in scalar initializer
  100 |         {"append",no_argument,0,'A'},
      |                   ^~~~~~~~~~~
osasnmpd.c:100:19: note: (near initialization for 'longopts')
osasnmpd.c:100:31: warning: excess elements in scalar initializer
  100 |         {"append",no_argument,0,'A'},
      |                               ^
osasnmpd.c:100:31: note: (near initialization for 'longopts')
osasnmpd.c:100:33: warning: excess elements in scalar initializer
  100 |         {"append",no_argument,0,'A'},
      |                                 ^~~
osasnmpd.c:100:33: note: (near initialization for 'longopts')
osasnmpd.c:100:9: warning: excess elements in scalar initializer
  100 |         {"append",no_argument,0,'A'},
      |         ^
osasnmpd.c:100:9: note: (near initialization for 'longopts')
osasnmpd.c:101:9: warning: braces around scalar initializer
  101 |         {"stderrlog",no_argument,0,'L'},
      |         ^
osasnmpd.c:101:9: note: (near initialization for 'longopts')
osasnmpd.c:101:10: warning: initialization of 'struct option *' from incompatible pointer type 'char *' [-Wincompatible-pointer-types]
  101 |         {"stderrlog",no_argument,0,'L'},
      |          ^~~~~~~~~~~
osasnmpd.c:101:10: note: (near initialization for 'longopts')
osasnmpd.c:101:22: warning: excess elements in scalar initializer
  101 |         {"stderrlog",no_argument,0,'L'},
      |                      ^~~~~~~~~~~
osasnmpd.c:101:22: note: (near initialization for 'longopts')
osasnmpd.c:101:34: warning: excess elements in scalar initializer
  101 |         {"stderrlog",no_argument,0,'L'},
      |                                  ^
osasnmpd.c:101:34: note: (near initialization for 'longopts')
osasnmpd.c:101:36: warning: excess elements in scalar initializer
  101 |         {"stderrlog",no_argument,0,'L'},
      |                                    ^~~
osasnmpd.c:101:36: note: (near initialization for 'longopts')
osasnmpd.c:101:9: warning: excess elements in scalar initializer
  101 |         {"stderrlog",no_argument,0,'L'},
      |         ^
osasnmpd.c:101:9: note: (near initialization for 'longopts')
osasnmpd.c:102:9: warning: braces around scalar initializer
  102 |         {"nofork",no_argument,0,'f'},
      |         ^
osasnmpd.c:102:9: note: (near initialization for 'longopts')
osasnmpd.c:102:10: warning: initialization of 'struct option *' from incompatible pointer type 'char *' [-Wincompatible-pointer-types]
  102 |         {"nofork",no_argument,0,'f'},
      |          ^~~~~~~~
osasnmpd.c:102:10: note: (near initialization for 'longopts')
osasnmpd.c:102:19: warning: excess elements in scalar initializer
  102 |         {"nofork",no_argument,0,'f'},
      |                   ^~~~~~~~~~~
osasnmpd.c:102:19: note: (near initialization for 'longopts')
osasnmpd.c:102:31: warning: excess elements in scalar initializer
  102 |         {"nofork",no_argument,0,'f'},
      |                               ^
osasnmpd.c:102:31: note: (near initialization for 'longopts')
osasnmpd.c:102:33: warning: excess elements in scalar initializer
  102 |         {"nofork",no_argument,0,'f'},
      |                                 ^~~
osasnmpd.c:102:33: note: (near initialization for 'longopts')
osasnmpd.c:102:9: warning: excess elements in scalar initializer
  102 |         {"nofork",no_argument,0,'f'},
      |         ^
osasnmpd.c:102:9: note: (near initialization for 'longopts')
osasnmpd.c:103:9: warning: braces around scalar initializer
  103 |         {"logfile",required_argument,0,'l'},
      |         ^
osasnmpd.c:103:9: note: (near initialization for 'longopts')
osasnmpd.c:103:10: warning: initialization of 'struct option *' from incompatible pointer type 'char *' [-Wincompatible-pointer-types]
  103 |         {"logfile",required_argument,0,'l'},
      |          ^~~~~~~~~
osasnmpd.c:103:10: note: (near initialization for 'longopts')
osasnmpd.c:103:20: warning: excess elements in scalar initializer
  103 |         {"logfile",required_argument,0,'l'},
      |                    ^~~~~~~~~~~~~~~~~
osasnmpd.c:103:20: note: (near initialization for 'longopts')
osasnmpd.c:103:38: warning: excess elements in scalar initializer
  103 |         {"logfile",required_argument,0,'l'},
      |                                      ^
osasnmpd.c:103:38: note: (near initialization for 'longopts')
osasnmpd.c:103:40: warning: excess elements in scalar initializer
  103 |         {"logfile",required_argument,0,'l'},
      |                                        ^~~
osasnmpd.c:103:40: note: (near initialization for 'longopts')
osasnmpd.c:103:9: warning: excess elements in scalar initializer
  103 |         {"logfile",required_argument,0,'l'},
      |         ^
osasnmpd.c:103:9: note: (near initialization for 'longopts')
osasnmpd.c:104:9: warning: braces around scalar initializer
  104 |         {"pidfile",required_argument,0,'P'},
      |         ^
osasnmpd.c:104:9: note: (near initialization for 'longopts')
osasnmpd.c:104:10: warning: initialization of 'struct option *' from incompatible pointer type 'char *' [-Wincompatible-pointer-types]
  104 |         {"pidfile",required_argument,0,'P'},
      |          ^~~~~~~~~
osasnmpd.c:104:10: note: (near initialization for 'longopts')
osasnmpd.c:104:20: warning: excess elements in scalar initializer
  104 |         {"pidfile",required_argument,0,'P'},
      |                    ^~~~~~~~~~~~~~~~~
osasnmpd.c:104:20: note: (near initialization for 'longopts')
osasnmpd.c:104:38: warning: excess elements in scalar initializer
  104 |         {"pidfile",required_argument,0,'P'},
      |                                      ^
osasnmpd.c:104:38: note: (near initialization for 'longopts')
osasnmpd.c:104:40: warning: excess elements in scalar initializer
  104 |         {"pidfile",required_argument,0,'P'},
      |                                        ^~~
osasnmpd.c:104:40: note: (near initialization for 'longopts')
osasnmpd.c:104:9: warning: excess elements in scalar initializer
  104 |         {"pidfile",required_argument,0,'P'},
      |         ^
osasnmpd.c:104:9: note: (near initialization for 'longopts')
osasnmpd.c:105:9: warning: braces around scalar initializer
  105 |         {"sockaddr",required_argument,0,'x'},
      |         ^
osasnmpd.c:105:9: note: (near initialization for 'longopts')
osasnmpd.c:105:10: warning: initialization of 'struct option *' from incompatible pointer type 'char *' [-Wincompatible-pointer-types]
  105 |         {"sockaddr",required_argument,0,'x'},
      |          ^~~~~~~~~~
osasnmpd.c:105:10: note: (near initialization for 'longopts')
osasnmpd.c:105:21: warning: excess elements in scalar initializer
  105 |         {"sockaddr",required_argument,0,'x'},
      |                     ^~~~~~~~~~~~~~~~~
osasnmpd.c:105:21: note: (near initialization for 'longopts')
osasnmpd.c:105:39: warning: excess elements in scalar initializer
  105 |         {"sockaddr",required_argument,0,'x'},
      |                                       ^
osasnmpd.c:105:39: note: (near initialization for 'longopts')
osasnmpd.c:105:41: warning: excess elements in scalar initializer
  105 |         {"sockaddr",required_argument,0,'x'},
      |                                         ^~~
osasnmpd.c:105:41: note: (near initialization for 'longopts')
osasnmpd.c:105:9: warning: excess elements in scalar initializer
  105 |         {"sockaddr",required_argument,0,'x'},
      |         ^
osasnmpd.c:105:9: note: (near initialization for 'longopts')
osasnmpd.c:106:9: warning: braces around scalar initializer
  106 |         {0,0,0,0}
      |         ^
osasnmpd.c:106:9: note: (near initialization for 'longopts')
osasnmpd.c:106:12: warning: excess elements in scalar initializer
  106 |         {0,0,0,0}
      |            ^
osasnmpd.c:106:12: note: (near initialization for 'longopts')
osasnmpd.c:106:14: warning: excess elements in scalar initializer
  106 |         {0,0,0,0}
      |              ^
osasnmpd.c:106:14: note: (near initialization for 'longopts')
osasnmpd.c:106:16: warning: excess elements in scalar initializer
  106 |         {0,0,0,0}
      |                ^
osasnmpd.c:106:16: note: (near initialization for 'longopts')
osasnmpd.c:106:9: warning: excess elements in scalar initializer
  106 |         {0,0,0,0}
      |         ^
osasnmpd.c:106:9: note: (near initialization for 'longopts')
osasnmpd.c:115:1: error: expected '=', ',', ';', 'asm' or '__attribute__' before '{' token
  115 | {
      | ^
In file included from /usr/include/net-snmp/net-snmp-config.h:21,
                 from ibmOSAMibDefs.h:12,
                 from ibmOSAMibUtil.h:35,
                 from osasnmpd.c:24:
ibmOSAMib.h:19:1: error: old-style parameter declarations in prototyped function definition
   19 | config_require(util_funcs)
      | ^~~~~~~~~~~~~~
osasnmpd.c:317: error: expected '{' at end of input
...snip...

Expected Results:  
Build passes

Comment 1 Jakub Čajka 2023-08-29 15:28:28 UTC
To note, adding semicolon to the extern function definition in the mentioned header file seems to also fix the issue.

Comment 2 Josef Ridky 2023-08-30 14:21:29 UTC
Fix tested at https://copr.fedorainfracloud.org/coprs/jridky/s390u/build/6355783/

I'll report it to the upstream.

Comment 3 Josef Ridky 2023-08-30 17:58:27 UTC
Response from the upstream

This is the wrong way to fix the build error that was encountered. The exact purpose of the NETSNMP_REQUIRE_SEMICOLON macro is to trigger a build error if the macro in which this macro is used is not terminated with a semicolon.

What now?

Comment 4 Josef Ridky 2023-08-30 18:24:23 UTC
So I looked into s390utils and found issue there with not properly using net-snmp calls.

See attachment with proposed patch to fix your issue (tested in copr: https://copr.fedorainfracloud.org/coprs/jridky/s390u/build/6356823/)

Moving issue back to s390utils.

Comment 5 Josef Ridky 2023-08-30 18:27:05 UTC
Created attachment 1986189 [details]
Patch with solution

Comment 6 Jakub Čajka 2023-08-31 06:48:50 UTC
Do you have link to any information from the upstream handy? What is the issue they are trying to solve? Is there some documentation covering the proper use of net-snmp?

I have been diving in to the issue and it seems to me they are extensively using several layers of (header) pre-procesing, making debugging nearly impossible, and it is really hard to find what code maps to which release in they git repo, they have stopped tagging some time ago.

Comment 7 Jakub Čajka 2023-08-31 10:47:40 UTC
Actually, I have tried, but forgotten to apply similar patch prior to reporting this bug, grr...
Although upstream still have in any docs, that I could find usage only without the semicolon, like https://net-snmp.sourceforge.io/wiki/index.php/FAQ:Coding_11 http://www.net-snmp.org/tutorial/tutorial-4/agent/03-header.html http://www.net-snmp.org/docs/FAQ.html

Comment 8 Jakub Čajka 2023-09-01 08:39:28 UTC
Patch sent upstream via https://github.com/ibm-s390-linux/s390-tools/pull/155
MR fixing this issue along with other changes in Fedora https://src.fedoraproject.org/rpms/s390utils/pull-request/7

Comment 9 Adam Williamson 2023-11-18 16:43:40 UTC
So the PR has been merged and there seem to have been successful builds of s390utils against net-snmp 5.9.4, e.g. https://koji.fedoraproject.org/koji/buildinfo?buildID=2319737 . Can we close this bug? Can we also now push https://bodhi.fedoraproject.org/updates/FEDORA-2023-f1f1df110e stable?

Comment 10 Jakub Čajka 2023-11-20 08:54:08 UTC
Yes, sorry for missing this. I have thought that the net-snmp update got pushed/unblocked already.


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