Skip to content

pfixtools: pcre -> pcre2 - #532824

Closed
jerith666 wants to merge 2 commits into
NixOS:masterfrom
jerith666:pfixtools-pcre2
Closed

jerith666 wants to merge 2 commits into
NixOS:masterfrom
jerith666:pfixtools-pcre2

Conversation

@jerith666

@jerith666 jerith666 commented Jun 18, 2026 •

Copy link
Copy Markdown
Contributor

#356387

these patches were constructed by Claude from the following prompts:

Can you scope out what would be involved in migrating
https://github.com/Fruneau/pfixtools and
https://github.com/Fruneau/libcommon to use pcre2?

tell me more about the code unit width definition.

okay, that makes sense. please prepare a patch against libcommon
that carries out this migration.

please prepare a patch for the pfixtools repo as well.

the key bit of explanation from the 2nd prompt was:

For this codebase, 8 is the only sensible choice. The strings being
matched are email addresses and SMTP protocol data — plain
ASCII/UTF-8 byte strings, exactly what PCRE1 was already treating
them as.

the changes look plausible to me, but I have not done any real C programming since college 25+ years ago. link to full chat session: https://claude.ai/share/9ec35d1c-e9fe-442a-ab33-3ecf4468c015

no attempt is being made to upstream these changes, as neither repo has seen any activity in 10 years.

Assisted-by: Claude:claude-4.6-sonnet

Things done

@nixpkgs-ci nixpkgs-ci Bot added 10.rebuild-linux: 1-10 This PR causes between 1 and 10 packages to rebuild on Linux. 10.rebuild-darwin: 0 This PR does not cause any packages to rebuild on Darwin. 11.by: package-maintainer This PR was created by a maintainer of all the package it changes. 10.rebuild-linux: 1 This PR causes 1 package to rebuild on Linux. labels Jun 18, 2026
@jerith666
jerith666 marked this pull request as ready for review July 6, 2026 00:45
@jerith666

Copy link
Copy Markdown
Contributor Author

I've finally gotten a chance to test the pfix-srsd binary with these patches applied on my mailserver, and it seems to work just fine. So, marking ready for review.

@nixpkgs-ci nixpkgs-ci Bot added the 9.needs: reviewer This PR currently has no reviewers requested and needs attention. label Jul 6, 2026
@jerith666

Copy link
Copy Markdown
Contributor Author

Let me also say explicitly that I'm aware this is stretching the boundaries of the AI contribution policy. If we need to drop this from nixpkgs rather than accept this PR, I understand!

@jerith666
jerith666 requested review from emilazy and mweinelt July 11, 2026 14:46
@nixpkgs-ci nixpkgs-ci Bot removed the 9.needs: reviewer This PR currently has no reviewers requested and needs attention. label Jul 11, 2026
@jackrosenberg

Copy link
Copy Markdown
Member

Hey, I'm curious as to why you think this is within the bounds of the AI policy? It looks to me like you have pasted claude's output verbatim.

Before submission, they must establish a reasonable level of understanding of the contribution and expectation of its correctness.

I do not get the sense that if this ends up breaking, that you have the understanding to diagnose and traige what broke.

The purpose of the AI policy (as i interpret it) is to ensure that contributions are done by humans. This way the humans gain the understanding necessary to work in nixpkgs. When something breaks, these humans can fix it, since they wrote what broke in the first place.

I understand you only want to help with a quick fix! Unfortunately, if nobody owns and understands your code, we're not actually fixing anything. Just creating tech debt.

@jerith666

Copy link
Copy Markdown
Contributor Author

This is indeed Claude's output verbatim.

Maybe I was never a good candidate to maintain this package in the first place? It's not just these patches that are C code that I don't deeply grok, the whole pfixtools package is C code that I don't deeply grok! :) And as mentioned it appears abandoned upstream, so that means perhaps there's nobody left who groks it? :(

Is it worth waiting a bit to see if someone else involved with the overall effort in #356387 might have a look and say "yep, that looks pretty much like what we did for packages X, Y, and Z"? Or is that not enough?

I hope this doesn't come off as a waste of everyone's time, I'm certainly still learning best practices when using these LLM tools!

@jackrosenberg

Copy link
Copy Markdown
Member

I don't mean to discourage you from contributing or maintaining, only from pushing code you don't grok :). If this is something you use or find useful, it may be worth taking the time to familiarize yourself. If not, I think it's safe to drop it.

Rest assured you've wasted nobody's time. Learning best practices is never a waste :)

@jerith666

Copy link
Copy Markdown
Contributor Author

It is something I'm actively using (with these patches) on my mail server, and it's been working fine.

I'll leave this open for a while to see if anyone else wants to endorse these patches; if not, I can close this PR and open one to drop the package instead.

@fliiiix

fliiiix commented Jul 13, 2026 •

Copy link
Copy Markdown
Contributor

Diff seems small enough and ok to me and i would probably keep it as long as there is someone (you) that maintains the package somewhat 🤷 but im not sure what the nixpkg policy is here

I assume you check that this test actually is run and still works https://github.com/Fruneau/pfixtools/blob/master/tests/regexp.c#L132

@jerith666

Copy link
Copy Markdown
Contributor Author

I assume you check that this test actually is run and still works https://github.com/Fruneau/pfixtools/blob/master/tests/regexp.c#L132

No, I had no idea those tests existed! 🤦

I've pushed a new commit here that runs them. That new commit comes first, because I've confirmed the same set of tests pass before and after this pcre2 change.

Here's the full glibc malloc error, mentioned in the commit message, from tst-spf, in case anyone wants to dig into it:

Fatal glibc error: malloc.c:2610 (sysmalloc): assertion failed: (old_top == initial_top (av) && old_size == 0) || ((unsigned long) (old_size) >= MINSIZE && prev_inuse (old_top) && ((unsigned long) old_end & (pagesize - 1)) == 0)

@fliiiix

fliiiix commented Jul 15, 2026

Copy link
Copy Markdown
Contributor

I looked a bit into the spf test it seems that there is some lib collision between
libev.so.4 => /nix/store/2hgrlmw9zk1kwlmdvszxccmq8j49ajac-libev-4.33/lib/libev.so.4 (0x00007ffff7ca3000) and libevent-2.1.so.7 => /nix/store/fbsplavcyrgy4xxd03z7ws6ijvns2p7c-libevent-2.1.12/lib/libevent-2.1.so.7 (0x00007ffff79a8000)

If you run it with libevent first it seem to do the trick:
LD_PRELOAD="/nix/store/fbsplavcyrgy4xxd03z7ws6ijvns2p7c-libevent-2.1.12/lib/libevent-2.1.so.7" ./tests/tst-spf

I ran out of time to look why still most of the tests fail and it would be some work to replace libev with libevent i think.

What i would fix is this warning here: WARNING: '--replace' is deprecated, use --replace-{fail,warn,quiet}. in the patch phase.

upstream Makefile is not set up to run these via 'make test', so we
have to execute them manually.

one of the tests triggers a malloc assertion error in glibc, so we
skip it.

also update substitutions to use --replace-fail per current best
practice
these patches were constructed by Claude from the following prompts:

> Can you scope out what would be involved in migrating
  https://github.com/Fruneau/pfixtools and
  https://github.com/Fruneau/libcommon to use pcre2?

> tell me more about the code unit width definition.

> okay, that makes sense.  please prepare a patch against libcommon
  that carries out this migration.

> please prepare a patch for the pfixtools repo as well.

the key bit of explanation from the 2nd prompt was:

> For this codebase, 8 is the only sensible choice. The strings being
  matched are email addresses and SMTP protocol data — plain
  ASCII/UTF-8 byte strings, exactly what PCRE1 was already treating
  them as.

the changes look plausible to me, but I have not done any real C
programming since college 25+ years ago.  link to full chat session:
https://claude.ai/share/9ec35d1c-e9fe-442a-ab33-3ecf4468c015

no attempt is being made to upstream these changes, as neither repo
has seen any activity in 10 years.

Assisted-by: Claude:claude-4.6-sonnet
@jerith666

Copy link
Copy Markdown
Contributor Author

What i would fix is this warning here: WARNING: '--replace' is deprecated, use --replace-{fail,warn,quiet}. in the patch phase.

Done! :)

@fliiiix fliiiix left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM ✨

@nixpkgs-ci nixpkgs-ci Bot added the 12.approvals: 1 This PR was reviewed and approved by one person. label Jul 16, 2026
@ethancedwards8 ethancedwards8 added the llm-assisted Contributions that include code generation with LLMs label Jul 18, 2026

@jackrosenberg jackrosenberg left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, I do not feel that the following has been established.

Before submission, they must establish a reasonable level of understanding of the contribution and expectation of its correctness. (AI poilcy)

@fliiiix

fliiiix commented Jul 22, 2026

Copy link
Copy Markdown
Contributor

For me this clears the reasonable level of understanding 🤷 thats why i approved it

When output from automated tooling is used in contributions, a contributor must establish confidence in that output. This can be achieved by establishing confidence in the correctness of the tooling’s logic, manual review of the included output, or using further automation to verify the output

@jerith666 manually inspected the changes, he tested the output and we even worked on running the upstream tests now as part of the package

But no idea how this gets decided at the end and i personally as a non user of this package are also fine with just removing it from nixpkgs.

@mweinelt

mweinelt commented Jul 23, 2026 •

Copy link
Copy Markdown
Member

Looking at upstream having last made a change a decade ago, why not migrate to postsrsd, if what you want is Sender Rewriting Scheme support?

Then we could drop this dead package.

@jerith666

jerith666 commented Aug 13, 2026 •

Copy link
Copy Markdown
Contributor Author

Looking at upstream having last made a change a decade ago, why not migrate to postsrsd, if what you want is Sender Rewriting Scheme support?

Then we could drop this dead package.

Sorry for the delayed response, I was mostly offline for the last 3 weeks.

SRS is indeed what I'm interested in, so I will look into switching my mail server to use postsrsd and, if that works, am happy to drop pfixtools from nixpkgs.

@jerith666 jerith666 mentioned this pull request Aug 15, 2026
2 of 13 tasks
jerith666 added a commit to jerith666/nixpkgs that referenced this pull request Aug 15, 2026
as discussed in NixOS#532824, upstream has not made any changes in a
decade, there is no nixpkgs maintainer with sufficient knowledge of C
to update this package to use pcre2 (NixOS#356387), and postsrsd provides a
ready alternative that is currently maintained.
@jerith666

Copy link
Copy Markdown
Contributor Author

postsrsd is working fine for me; closing in favor of removal via #553098.

@jerith666 jerith666 closed this Aug 15, 2026
jerith666 added a commit to jerith666/nixpkgs that referenced this pull request Aug 20, 2026
as discussed in NixOS#532824, upstream has not made any changes in a
decade, there is no nixpkgs maintainer with sufficient knowledge of C
to update this package to use pcre2 (NixOS#356387), and postsrsd provides a
ready alternative that is currently maintained.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

10.rebuild-darwin: 0 This PR does not cause any packages to rebuild on Darwin. 10.rebuild-linux: 1-10 This PR causes between 1 and 10 packages to rebuild on Linux. 10.rebuild-linux: 1 This PR causes 1 package to rebuild on Linux. 11.by: package-maintainer This PR was created by a maintainer of all the package it changes. 12.approvals: 1 This PR was reviewed and approved by one person. llm-assisted Contributions that include code generation with LLMs

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants