Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

i#2522 strcasestr prototype error: Remove const from result type #2526

Merged
merged 2 commits into from
Jan 15, 2025

Conversation

xdje42
Copy link
Contributor

@xdje42 xdje42 commented Oct 4, 2024

The definition of strcasestr is

char *strcasestr(const char *text, const char *pattern);

but drmemory uses

const char *strcasestr(const char *text, const char *pattern);

This causes build errors when both /usr/include/string.h and common/utils.h are included in linux. The definition for strcasestr for C has always not had the const in the result type (going back to its original addition to glibc in 1997). Thus we're pretty safe in not breaking anything on *nix. The other main use case of drmemory's strcasestr is on Windows, which does not have strcasestr.

Tested:
$ cmake && make
Also, there are failures in the clang and x86 workflows, but comparing the logs before/after
shows all failures pre-exist this patch, no new failures.

Here is the complete audit, all failures are pre-existing.

Recorded (errantly) as i#1938 failures:

Note: The above are marked as expected failures but runsuite_wrapper.pl hardwires the addition of "i#1938" to test output. #2534

Not currently recorded as expected failures (all #2491 - vsyscall incorrect assumption):

  • selfmod
  • syscalls_unix
  • clone
  • pthread_test
  • realloc

Fixes #2522

The definition of strcasestr is

char *strcasestr(const char *text, const char *pattern);

but drmemory uses

const char *strcasestr(const char *text, const char *pattern);

This causes build errors when both /usr/include/string.h and common/utils.h
are included in linux. The definition for strcasestr for C has always not
had the `const` in the result type (going back to its original addition
to glibc in 1997). Thus we're pretty safe in not breaking anything on *nix.
The other main use case of drmemory's strcasestr is on Windows, which does
not have strcasestr.

Tested:
$ cmake && make

Fixes #2522
@derekbruening
Copy link
Contributor

@xdje42 external users seem to be hitting this issue, would be good to get this merged: https://groups.google.com/g/dynamorio-users/c/WeQqxjwuPDI

@xdje42 xdje42 requested a review from derekbruening January 14, 2025 00:36
common/utils.h Show resolved Hide resolved
@derekbruening derekbruening merged commit 6b457eb into master Jan 15, 2025
5 of 7 checks passed
@derekbruening derekbruening deleted the i2522-strcasestr branch January 15, 2025 21:12
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.

BUILD: drmemory build failure caused by strcasestr declaration error
2 participants