compat: Add support for getprogname(3)#620
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
🚧 Files skipped from review as they are similar to previous changes (2)
WalkthroughAdds a compat implementation and header for getprogname/setprogname, updates configure to detect native support and enable the compat source when needed, and removes duplicate local implementations from setproctitle and logerr. ChangesCentralize program name handling
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Warning There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure. 🔧 Infer (1.2.0)compat/getprogname.ccompat/getprogname.c:32:10: fatal error: 'config.h' file not found ... [truncated 683 characters] ... pt/infer-linux-x86_64-v1.2.0/lib/infer/facebook-clang-plugins/clang/install/lib/clang/18/include" Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 2
🧹 Nitpick comments (1)
configure (1)
1078-1094: 💤 Low valueVariable name
GETPROCNAMEdoesn't match the featuregetprogname.Every other feature gate uses the function name (
STRLCPY,REALLOCARRAY,SETPROCTITLE, ...), but this one isGETPROCNAME(procname) while detectinggetprogname(progname). An operator trying to pre-set the override viaGETPROGNAME=...would be silently ignored. Consider renaming toGETPROGNAMEfor consistency.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@configure` around lines 1078 - 1094, The feature variable is misnamed: change all uses of GETPROCNAME to GETPROGNAME so it matches the detected symbol getprogname; update the initial test (the if [ -z "$GETPROCNAME" ] branch), the assignment branches setting GETPROCNAME=yes/no, the echo/rm lines if needed, and the later conditional if [ "$GETPROCNAME" = no ] to use GETPROGNAME instead, ensuring the test wrapper file name (_getprogname.c) and function getprogname remain unchanged so pre-set overrides via GETPROGNAME=... work correctly.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@compat/getprogname.c`:
- Around line 50-84: The getprogname() implementation must never return NULL;
change all paths that currently return NULL (calloc/readlink failures and the
progname[0] == '[' check) to return PACKAGE as a safe fallback, and ensure the
non-Linux `#else` branch returns progname if it was set by setprogname() (i.e., if
progname != NULL) otherwise PACKAGE so setprogname() actually takes effect;
update uses of progname, progname_free, progname_atexit, getprogname(), and
freeprogname() accordingly so callers always receive a valid C string.
In `@configure`:
- Line 1096: Remove the stray backslash after the quoted include in the echo
command that writes to CONFIG_H: the line that calls echo with the string
"`#include` \"compat/getprogname.h\"" should not have a trailing backslash
before the redirect, so update the echo invocation that appends to CONFIG_H (the
echo ... >>$CONFIG_H line) to remove the backslash and match the other compat
blocks, ensuring no trailing whitespace is written.
---
Nitpick comments:
In `@configure`:
- Around line 1078-1094: The feature variable is misnamed: change all uses of
GETPROCNAME to GETPROGNAME so it matches the detected symbol getprogname; update
the initial test (the if [ -z "$GETPROCNAME" ] branch), the assignment branches
setting GETPROCNAME=yes/no, the echo/rm lines if needed, and the later
conditional if [ "$GETPROCNAME" = no ] to use GETPROGNAME instead, ensuring the
test wrapper file name (_getprogname.c) and function getprogname remain
unchanged so pre-set overrides via GETPROGNAME=... work correctly.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 55a2091f-3634-492f-971c-a94fc5affcad
📒 Files selected for processing (6)
compat/getprogname.ccompat/getprogname.hcompat/setproctitle.ccompat/setproctitle.hconfiguresrc/logerr.c
💤 Files with no reviewable changes (1)
- compat/setproctitle.h
logerr and pidfile will use it commonly.