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

Use rm instead instead of custom function for purging #347

Merged
merged 11 commits into from
Sep 22, 2022
Merged

Conversation

andy5995
Copy link
Member

@andy5995 andy5995 commented Sep 10, 2022

Co-authored-by: Andy5995 arch_stanton5995@protonmail.com

WIP: valgrind tests still need to pass

@andy5995 andy5995 added this to the 0.8.2 milestone Sep 10, 2022
src/purging_rmw.c Fixed Show fixed Hide fixed
@andy5995
Copy link
Member Author

andy5995 commented Sep 11, 2022

@Jammyjamjamman I need to update the tests to make it more clear, but a valgrind test is done on the gcc-11 build, and it passed.

In your builddir, note the output if you run

valgrind --leak-check=full ./rmw -l

==168976== Memcheck, a memory error detector
==168976== Copyright (C) 2002-2022, and GNU GPL'd, by Julian Seward et al.
==168976== Using Valgrind-3.19.0 and LibVEX; rerun with -h for copyright info
==168976== Command: ./rmw -l
==168976== 

valgrind:  Fatal error at startup: a function redirection
valgrind:  which is mandatory for this platform-tool combination
valgrind:  cannot be set up.  Details of the redirection are:
valgrind:  
valgrind:  A must-be-redirected function
valgrind:  whose name matches the pattern:      strlen
valgrind:  in an object with soname matching:   ld-linux-x86-64.so.2
valgrind:  was not found whilst processing
valgrind:  symbols from the object with soname: ld-linux-x86-64.so.2
valgrind:  
valgrind:  Possible fixes: (1, short term): install glibc's debuginfo
valgrind:  package on this machine.  (2, longer term): ask the packagers
valgrind:  for your Linux distribution to please in future ship a non-
valgrind:  stripped ld.so (or whatever the dynamic linker .so is called)
valgrind:  that exports the above-named function using the standard
valgrind:  calling conventions for this platform.  The package you need
valgrind:  to install for fix (1) is called
valgrind:  
valgrind:    On Debian, Ubuntu:                 libc6-dbg
valgrind:    On SuSE, openSuSE, Fedora, RHEL:   glibc-debuginfo
valgrind:  
valgrind:  Note that if you are debugging a 32 bit process on a
valgrind:  64 bit system, you will need a corresponding 32 bit debuginfo
valgrind:  package (e.g. libc6-dbg:i386).

I found a couple threads about it, but no solution has worked for me yet:

https://www.reddit.com/r/archlinux/comments/vdu47o/valgrind_fatal_error_at_startup_a_function/

https://stackoverflow.com/questions/15721919/install-valgrind-fatal-error-at-startup

@andy5995
Copy link
Member Author

andy5995 commented Sep 11, 2022

valgrind: Fatal error at startup: a function redirection
valgrind: which is mandatory for this platform-tool combination

I'm pretty sure the answer is https://forum.manjaro.org/t/unable-to-use-valgrind/120042/14

by pobrn:

The issue is that the Arch Linux debuginfod servers only store data for the latest version of a package. So when the Manjaro and Arch Linux glibc packages are out of sync, you can no longer download the debug information for glibc available in the Manjaro repositories, and valgrind needs that to work.

In effect, there isn't anything we need to do about it. It's passing in the CI.

src/purging_rmw.c Fixed Show fixed Hide fixed
src/purging_rmw.c Fixed Show fixed Hide fixed
src/purging_rmw.c Fixed Show fixed Hide fixed
src/purging_rmw.c Fixed Show fixed Hide fixed
@andy5995 andy5995 marked this pull request as ready for review September 20, 2022 16:16
src/utils_rmw.c Outdated

// remove the top directory, which should now be empty
assert(rmdir(h) == 0);
char rm_args[BUFSIZ];
Copy link
Member Author

Choose a reason for hiding this comment

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

Oops... I gotta update this test

status =
rmdir_recursive(purge_target, 1, cli_user_options->force,
&ctr);
status = remove(purge_target);

Check failure

Code scanning / CodeQL

Time-of-check time-of-use filesystem race condition

The [filename](1) being operated upon was previously [checked](2), but the underlying file may have been changed since then. The [filename](1) being operated upon was previously [checked](3), but the underlying file may have been changed since then.
@andy5995 andy5995 merged commit 66ad93b into master Sep 22, 2022
@andy5995 andy5995 deleted the use-rm branch September 22, 2022 04:29
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