Skip to content

Fix fail to build with glibc 2.43#287

Merged
bostjan merged 1 commit intoa2o:masterfrom
sge-d-o:bugfix/fix-fail-to-build-with-glibc-2.43
Mar 4, 2026
Merged

Fix fail to build with glibc 2.43#287
bostjan merged 1 commit intoa2o:masterfrom
sge-d-o:bugfix/fix-fail-to-build-with-glibc-2.43

Conversation

@sge-d-o
Copy link
Copy Markdown
Contributor

@sge-d-o sge-d-o commented Feb 25, 2026

Checklists for Pull requests

About pull request itself:

  • I am submitting a pull request! :)
  • My submission does one logical thing only (one bugfix, one new feature). If I will want to supply multiple logical changes, I will submit multiple pull requests.
  • I have read and understood the CONTRIBUTING guide

Code quality:
(not applicable for non-code fixes)

  • My submission is passing the test suite run (./configure --enable-everything && make tests) - test suite reports zero unexpected failures.

Commits:

  • My commits are logical, easily readable, and with concise comments.
  • My commits follow the KISS principle: do one thing, and do it well.

Licensing:

  • I am the author of this submission or I have been authorized by the submission copyright holder to issue this pull request. By issuing this pull request the copyright holder agrees that their contribution is included in Snoopy and released under the current Snoopy license (currently GPLv2).

Branching:

  • My submission is based on master branch.
  • My submission is compatible with the latest master branch (no conflicts, I did a rebase if it was necessary).
  • The name of the branch I want to merge upstream is not master.
  • My branch name is feature/my-shiny-new-snoopy-feature-title (for new features).
  • My branch name is bugfix/my-totally-non-hackish-workaround (for bugfixes).
  • My branch name is doc/what-i-did-to-documentation (for documentation updates).

Continuous integration:

  • Once I submit this pull request, I will wait for a CI report (normally done in a few minutes) and fix any issues CI points out.

Pull request description

In Debian it was found glibc 2.43 comes with '#define _XOPEN_SOURCE 800' which causes the following errors:

In file included from utmp.c:31:
../../src/snoopy.h:31:10: error: '_XOPEN_SOURCE' redefined [-Werror]
31 | #define _XOPEN_SOURCE 700
| ^~~~~~~~~~~~~
In file included from /usr/include/utmp.h:21,
from utmp-snoopy.h:27,
from utmp.c:26:
/usr/include/features.h:234:10: note: this is the location of the previous definition
234 | # define _XOPEN_SOURCE 800
| ^~~~~~~~~~~~~

domain.c: In function 'snoopy_datasource_domain':
domain.c:126:17: error: assignment discards 'const' qualifier from pointer target type [-Werror=discarded-qualifiers]
126 | hashPtr = strchr(linePtr, '#');
| ^

This patch guards the '#define _XOPEN_SOURCE 700' in snoopy.h and drops the 'const' qualifier from the variable 'linePtr' resulting in building snoopy successfully using glibc 2.43.

Glibc 2.43 comes with '#define _XOPEN_SOURCE 800' which causes the
following errors:

In file included from utmp.c:31:
../../src/snoopy.h:31:10: error: '_XOPEN_SOURCE' redefined [-Werror]
   31 | #define  _XOPEN_SOURCE   700
      |          ^~~~~~~~~~~~~
In file included from /usr/include/utmp.h:21,
                 from utmp-snoopy.h:27,
                 from utmp.c:26:
/usr/include/features.h:234:10: note: this is the location of the previous definition
  234 | # define _XOPEN_SOURCE  800
      |          ^~~~~~~~~~~~~

domain.c: In function 'snoopy_datasource_domain':
domain.c:126:17: error: assignment discards 'const' qualifier from pointer target type [-Werror=discarded-qualifiers]
  126 |         hashPtr = strchr(linePtr, '#');
      |                 ^

This patch guards the '#define  _XOPEN_SOURCE   700' in snoopy.h and
drops the 'const' qualifier from the variable 'linePtr' resulting in
building snoopy successfully using glibc 2.43.
@sge-d-o sge-d-o requested a review from bostjan as a code owner February 25, 2026 20:33
@bostjan
Copy link
Copy Markdown
Member

bostjan commented Mar 4, 2026

I suppose this is Debian 13 you're talking about here?

Looks sane, will merge.

BTW that const thing, that I'll need to double check that later, as it's quite likely that SonarCloud will complain about it.

@bostjan bostjan self-assigned this Mar 4, 2026
@bostjan bostjan merged commit 6e9efe0 into a2o:master Mar 4, 2026
2 of 29 checks passed
@sge-d-o
Copy link
Copy Markdown
Contributor Author

sge-d-o commented Mar 4, 2026

I suppose this is Debian 13 you're talking about here?

Actually this issue showed up while working on Debian 14. There is no problem with Debian 13, as this is the stable release which will not see an upgrade of glibc.

@sge-d-o
Copy link
Copy Markdown
Contributor Author

sge-d-o commented Mar 4, 2026

To be clear, this PR is/was not about the packages you provide per https://a2o.github.io/snoopy-packages/ but about snoopy being packaged in Debian, see https://packages.debian.org/forky/snoopy. In this regard it is not related to #286.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants