Skip to content

treewide: cleanup, const-correctness, and -Werror - #781

Open
intelfx wants to merge 1 commit into
sahib:developfrom
intelfx:work/werror-and-cleanup
Open

treewide: cleanup, const-correctness, and -Werror#781
intelfx wants to merge 1 commit into
sahib:developfrom
intelfx:work/werror-and-cleanup

Conversation

@intelfx

@intelfx intelfx commented Jul 24, 2026

Copy link
Copy Markdown
  • utils: make string search functions const-correct
    Usage of string search functions (str*{chr,str}()) in rmlint implicitly relies on const-laundering of its arguments. This is not the case anymore when building with glibc 2.41+ and C23 (which is the default on newer GCC), which surfaces a lot of annoying warnings.
    Constify all relevant places to avoid relying on implicit const-laundering.

  • pathtricia: use strlcpy(), get rid of -Wstringop-truncation warning
    Complete the refactoring started in 5a0ad6c and switch strncpy() to strlcpy() for better ergonomics and to squelch a -Wstringop-truncation warning.

  • -Werror, more warnings, and warning fixes
    This is a patch lifted from @cebtenzzre's tree (hopefully he won't object) with the rest of cleanups and -Werror.

@vassilit

Copy link
Copy Markdown
Collaborator

Hi @intelfx ! I owe you an apology.

I ended up merging a commit with g_strlcpy before realizing you had already opened a PR with partially the same idea. Since your PR wasn't passing CI, I hadn't looked at it yet, so I didn't notice this one. I planned for a long time to fix the utterly wrong approach of truncating the filepath and when I have done it yesterday I knew more about GLib than a year ago when I knew only libc and the rants about strlcpy (which is available for a long time under FreeBSD but glibc added it only in 2.38) and strscpy from the Linux kernel which is not available to us.

Even though my commit unfortunately overlapped with your work, I took a different approach in the end (size_t) but still made a mistake forgetting to change back the format specifier. I've mentionned your commit in a7d87ad (and AFAIK GH keep forever commits in PR branches even if they are from a deleted branch in the contributor own fork).

I haven't looked why the CI did not pass, but I think the CI need a rework, there might be false negatives. In 28ffb62 some distributions have been removed, that may help with newer compiler options.

@intelfx
intelfx force-pushed the work/werror-and-cleanup branch from cb2f962 to 18fac2d Compare August 14, 2026 02:45
@intelfx

intelfx commented Aug 14, 2026

Copy link
Copy Markdown
Author

Yep, your fix is better anyway (I merely "fixed" the truncation, while you made it a fatal error as it should be, and you did the const-correctness thing too). I'm going to push the -Werror commit again, just to see what the CI chokes on.

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.

3 participants