Skip to content

fix clang warnings that are bugs#3917

Merged
ptitSeb merged 3 commits into
ptitSeb:mainfrom
peppergrayxyz:clang_warnings_bugs
May 29, 2026
Merged

fix clang warnings that are bugs#3917
ptitSeb merged 3 commits into
ptitSeb:mainfrom
peppergrayxyz:clang_warnings_bugs

Conversation

@peppergrayxyz
Copy link
Copy Markdown
Contributor

@peppergrayxyz peppergrayxyz commented May 29, 2026

I split this PR from the previous, because these are not just fixes to warnings, but to behaviour, because the warning is caused by bugs (see also #3916)

  • remove suffix only if present
    the suffix is always removed, not only when present due to an assignment
    that should be a comparison
  • fix isProcAny check
    the pid should only be returned, when the path matches w, but is always
    returned. Pass p as is (is already a pointer)
  • add missing parameter
    pid is missing in path construction

the suffix is always removed, not only when present due to an assignment
that should be a comparission

See-also: ptitSeb#3916
Signed-off-by: Pepper Gray <hello@peppergray.xyz>
- the pid should only be returned, when the path matches w, but is always
returned.
- pass p as is (is already a pointer)

See-Also: ptitSeb#3916
Signed-off-by: Pepper Gray <hello@peppergray.xyz>
pid is missing in path construction

See-Also: ptitSeb#3916
Signed-off-by: Pepper Gray <hello@peppergray.xyz>
@peppergrayxyz peppergrayxyz changed the title Clang warnings bugs fix clang warnings that are bugs May 29, 2026
Comment thread src/wrapped/wrappedlibc.c
if(sscanf(path, "/proc/%d/%s", &pid, &p)==2)
if(p && !strcmp(p, w))
if(sscanf(path, "/proc/%d/%s", &pid, p)==2)
if(strcmp(p, w) == 0)
Copy link
Copy Markdown
Owner

@ptitSeb ptitSeb May 29, 2026

Choose a reason for hiding this comment

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

The change from !strcmp(...) tp strcmp(...) == 0 smells a lot like A.I. A human would have just removed the leading p && ...

(the comments of the PR/Tickets are also very verbose)

Just a reminder, we ask everyone to declare if they use A.I for a PR, and not to let A.I. do all the comunication (creating tickets), as we are human handling the tickets.

Also also, it's always nice to see wich agent are use to do stuffs.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

The form strcmp(...) == 0 is used on the lines just below (L2059-64), so I thought I'll keep the style consistent:

  if(strcmp((const char*)path, tmp)==0)
      return 1;
  // check if self PID ....
  pid_t pid = getpid();
  sprintf(tmp, "/proc/%d/%s", pid, w);
  if(strcmp((const char*)path, tmp)==0)

I used to get feedback on my PRs that I'm too minimalistic, so I started being more verbose. Also I'm on arm64 Gentoo/musl/libcxx which is usually not supported by projects, so I try to make it easy for maintainers in the hopes to get them more likely upstreamed.

Sorry for not acting human enough 😅

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Ah well, sorry, I ted to be more and more paranoiac...

Oh, musl, interesting...

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

No worries. Crazy times...

I'm not familiar with the source base, so I'm curious if I can get musl to work or hit a roadblock. But so far it looks good and Android doesn't use glibc either, so it shouldn't be I'm cautiously optimistic 🤞

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Well, there is no specific musl support, but having a build that does run musl x64 binry should be possible without too much trouble... Running glibc x64 binary is another story tho....

@ptitSeb ptitSeb merged commit 87f896e into ptitSeb:main May 29, 2026
28 checks passed
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.

2 participants