Skip to content

Fix include order in server_util.c for modern glibc compatibility#290

Open
seriv wants to merge 1 commit into
zmanda:masterfrom
umd-cs:fix/server-util-include-order
Open

Fix include order in server_util.c for modern glibc compatibility#290
seriv wants to merge 1 commit into
zmanda:masterfrom
umd-cs:fix/server-util-include-order

Conversation

@seriv

@seriv seriv commented Jun 22, 2026

Copy link
Copy Markdown

Summary

  • Move #include "amanda.h" above #include <sys/wait.h> in server-src/server_util.c

On modern glibc (as found on RHEL 10 / glibc 2.39+), including <sys/wait.h> before amanda.h
triggers a build failure:

gnulib/unistd.h:135:2: error: #error "Please include config.h first."

The include chain is:

  1. server_util.c includes <sys/wait.h>
  2. -I../gnulib intercepts signal.h, pulling in gnulib's wrapper
  3. That wrapper calls #include_next <signal.h>bits/sigstksz.h
  4. Which pulls in gnulib's unistd.h before config.h has been processed

amanda.h includes config.h as its first action. Moving it first satisfies gnulib's requirement.

Test plan

  • Build succeeds on RHEL 10.2 (glibc 2.39) with this fix
  • Build continues to succeed on RHEL 9 (glibc 2.34)
  • No functional change — include order only

🤖 Generated with Claude Code

On systems with newer glibc (e.g. RHEL 10), including <sys/wait.h>
before amanda.h causes a build failure: gnulib's signal.h is pulled
in transitively before config.h is set up, triggering:

  gnulib/unistd.h: #error "Please include config.h first."

amanda.h must be the first include in any Amanda source file, as it
sets up config.h via ../config/config.h.  Move it above <sys/wait.h>.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant