MarcJHuber / event-driven-servers

A collection of event-driven servers (currently: tac_plus, tac_plus-ng, ftpd, tcprelay)
https://www.pro-bono-publico.de/projects
Other
98 stars 25 forks source link

Build Failure for tac_plus-ng with --debug Flag #127

Closed pmackey2 closed 2 days ago

pmackey2 commented 3 days ago

Summary

While debugging another issue, I encountered a problem building tacacs-ng with debugging enabled.

I'm building the latest version from commit 6604ec1 at HEAD.

Environment

I'm building this in an Alpine Linux docker container.

gcc-13.2.1 make-4.4.1 musl-dev-1.2.5 libstdc++-13.2.1 c-ares-dev-1.33.1 openssl-dev-3.3.2 libcrypto3-3.3.2 pcre2-dev-10.43 curl-dev-8.11.0 perl-5.38.2

Error

During the build phase, I receive the following output:

make[2]: Entering directory '/event-driven-servers/build/linux-6.1.0-13-amd64-x86_64/tac_plus-ng'
gcc  -Wall -W -Wno-strict-prototypes -Wno-implicit-fallthrough -Werror -Wno-deprecated-declarations -Wno-unused-result -g -Og -ggdb -DOSTYPE=linux -DOSLEVEL=0x06010000 -DOS="\"linux-6.1.0-13-amd64-x86_64\"" -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -DDEBUG -DWITH_ARES -DWITH_DNS -DWITH_SSL -DWITH_CRYPTO -DWITH_PCRE2 -DPCRE2_CODE_UNIT_WIDTH=8 -DWITH_RADCLI -DWITH_ZLIB -DWITH_CURL -DWITH_PAM -DHAVE_SECURITY_PAM_APPL_H -DWITH_EPOLL -DWITH_POLL -DWITH_SELECT -DWITH_IPC -I/event-driven-servers   -c -o acct.o /event-driven-servers/tac_plus-ng/acct.c
gcc  -Wall -W -Wno-strict-prototypes -Wno-implicit-fallthrough -Werror -Wno-deprecated-declarations -Wno-unused-result -g -Og -ggdb -DOSTYPE=linux -DOSLEVEL=0x06010000 -DOS="\"linux-6.1.0-13-amd64-x86_64\"" -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -DDEBUG -DWITH_ARES -DWITH_DNS -DWITH_SSL -DWITH_CRYPTO -DWITH_PCRE2 -DPCRE2_CODE_UNIT_WIDTH=8 -DWITH_RADCLI -DWITH_ZLIB -DWITH_CURL -DWITH_PAM -DHAVE_SECURITY_PAM_APPL_H -DWITH_EPOLL -DWITH_POLL -DWITH_SELECT -DWITH_IPC -I/event-driven-servers   -c -o authen.o /event-driven-servers/tac_plus-ng/authen.c
gcc  -Wall -W -Wno-strict-prototypes -Wno-implicit-fallthrough -Werror -Wno-deprecated-declarations -Wno-unused-result -g -Og -ggdb -DOSTYPE=linux -DOSLEVEL=0x06010000 -DOS="\"linux-6.1.0-13-amd64-x86_64\"" -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -DDEBUG -DWITH_ARES -DWITH_DNS -DWITH_SSL -DWITH_CRYPTO -DWITH_PCRE2 -DPCRE2_CODE_UNIT_WIDTH=8 -DWITH_RADCLI -DWITH_ZLIB -DWITH_CURL -DWITH_PAM -DHAVE_SECURITY_PAM_APPL_H -DWITH_EPOLL -DWITH_POLL -DWITH_SELECT -DWITH_IPC -I/event-driven-servers   -c -o author.o /event-driven-servers/tac_plus-ng/author.c
gcc  -Wall -W -Wno-strict-prototypes -Wno-implicit-fallthrough -Werror -Wno-deprecated-declarations -Wno-unused-result -g -Og -ggdb -DOSTYPE=linux -DOSLEVEL=0x06010000 -DOS="\"linux-6.1.0-13-amd64-x86_64\"" -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -DDEBUG -DWITH_ARES -DWITH_DNS -DWITH_SSL -DWITH_CRYPTO -DWITH_PCRE2 -DPCRE2_CODE_UNIT_WIDTH=8 -DWITH_RADCLI -DWITH_ZLIB -DWITH_CURL -DWITH_PAM -DHAVE_SECURITY_PAM_APPL_H -DWITH_EPOLL -DWITH_POLL -DWITH_SELECT -DWITH_IPC -I/event-driven-servers   -c -o buffer.o /event-driven-servers/misc/buffer.c
gcc  -Wall -W -Wno-strict-prototypes -Wno-implicit-fallthrough -Werror -Wno-deprecated-declarations -Wno-unused-result -g -Og -ggdb -DOSTYPE=linux -DOSLEVEL=0x06010000 -DOS="\"linux-6.1.0-13-amd64-x86_64\"" -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -DDEBUG -DWITH_ARES -DWITH_DNS -DWITH_SSL -DWITH_CRYPTO -DWITH_PCRE2 -DPCRE2_CODE_UNIT_WIDTH=8 -DWITH_RADCLI -DWITH_ZLIB -DWITH_CURL -DWITH_PAM -DHAVE_SECURITY_PAM_APPL_H -DWITH_EPOLL -DWITH_POLL -DWITH_SELECT -DWITH_IPC -I/event-driven-servers   -c -o config.o /event-driven-servers/tac_plus-ng/config.c
gcc  -Wall -W -Wno-strict-prototypes -Wno-implicit-fallthrough -Werror -Wno-deprecated-declarations -Wno-unused-result -g -Og -ggdb -DOSTYPE=linux -DOSLEVEL=0x06010000 -DOS="\"linux-6.1.0-13-amd64-x86_64\"" -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -DDEBUG -DWITH_ARES -DWITH_DNS -DWITH_SSL -DWITH_CRYPTO -DWITH_PCRE2 -DPCRE2_CODE_UNIT_WIDTH=8 -DWITH_RADCLI -DWITH_ZLIB -DWITH_CURL -DWITH_PAM -DHAVE_SECURITY_PAM_APPL_H -DWITH_EPOLL -DWITH_POLL -DWITH_SELECT -DWITH_IPC -I/event-driven-servers   -c -o dump.o /event-driven-servers/tac_plus-ng/dump.c
gcc  -Wall -W -Wno-strict-prototypes -Wno-implicit-fallthrough -Werror -Wno-deprecated-declarations -Wno-unused-result -g -Og -ggdb -DOSTYPE=linux -DOSLEVEL=0x06010000 -DOS="\"linux-6.1.0-13-amd64-x86_64\"" -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -DDEBUG -DWITH_ARES -DWITH_DNS -DWITH_SSL -DWITH_CRYPTO -DWITH_PCRE2 -DPCRE2_CODE_UNIT_WIDTH=8 -DWITH_RADCLI -DWITH_ZLIB -DWITH_CURL -DWITH_PAM -DHAVE_SECURITY_PAM_APPL_H -DWITH_EPOLL -DWITH_POLL -DWITH_SELECT -DWITH_IPC -I/event-driven-servers   -c -o main.o /event-driven-servers/tac_plus-ng/main.c
/event-driven-servers/tac_plus-ng/main.c: In function 'accept_control_tls':
/event-driven-servers/tac_plus-ng/main.c:924:19: error: 'by_address' may be used uninitialized [-Werror=maybe-uninitialized]
  924 |         ctx->host = by_address;
      |         ~~~~~~~~~~^~~~~~~~~~~~
/event-driven-servers/tac_plus-ng/main.c:768:15: note: 'by_address' was declared here
  768 |     tac_host *by_address = ctx->host;
      |               ^~~~~~~~~~
cc1: all warnings being treated as errors
make[2]: *** [/event-driven-servers/Makefile.inc:49: main.o] Error 1
make[2]: Leaving directory '/event-driven-servers/build/linux-6.1.0-13-amd64-x86_64/tac_plus-ng'
make[1]: *** [GNUmakefile:24: build] Error 2
make[1]: Leaving directory '/event-driven-servers/tac_plus-ng'
make: *** [GNUmakefile:31: dirs] Error 1

To reproduce

To reproduce the build error in an Alpine Linux container, run the following commands.

docker run -it --rm alpine

apk add perl-io-socket-ssl \
        make \
        gcc \
        pcre2-dev \
        openssl-dev \
        curl-dev \
        libc-dev \
        musl-dev \
        git

git clone https://github.com/MarcJHuber/event-driven-servers/
cd event-driven-servers && ./configure --debug && make

Expected outcome

Successful build with debugging enabled, but instead, the error appears in main.c.

MarcJHuber commented 2 days ago

Hi Patrick,

thanks for reporting ... clang doesn't complain about this, and I can reproduce this with gcc but I've no idea why gcc complains. Looks like a false positive to me. I'll push a fix shortly.

Thanks,

Marc

MarcJHuber commented 2 days ago

Hi,

I've reverted that patch due to pre-processor issues. Instead, -Werror will no longer be set since 95362a061b59b4216011e0005f5dc72fb5d326a0.

Cheers,

Marc

MarcJHuber commented 2 days ago

Hi,

this was indeed an issue with the code, not with gcc. Thanks!

Cheers,

Marc