LibAFL
LibAFL copied to clipboard
Use `std::io::Error::last_os_error().raw_os_error().unwrap()` which gives us the errno string
There is `std::io::Error::last_os_error().raw_os_error().unwrap()` which gives us the errno string if I read this correctly, so that could be used for `Error` here
Originally posted by @domenukk in https://github.com/AFLplusplus/LibAFL/pull/1389#discussion_r1287043229
Hi , I am new here. Can you assign me this issue?
I plan to replace all perror with the error string returning line you mentioned in libafl_bolts/src/shmem.rs
Feel free to do it :)
@domenukk
while running the cargo clippy --all command I ran in one error , all other things were fine. Can you please guide me on this ? before I run the next set of commands to generate a PR.
I checked the folder where it points the error to, I do have the build_nyx_support.sh file in there.
@gerceboss No such file or directory might refer to the shell script's interpreter in the shebang in this case (Linux's error messages for process spawning issues are a bit weird..). Are you running on a system that does not provide bash under /bin/bash? Feel free to update the shebang to use #!/usr/bin/env bash instead, which should be more portable since /usr/bin/env is available on all Linux distros and avoids the hardcoded path to bash.
@domenukk , I switched to linux for the repository.
I am having this error while running cargo clippy --all , can you help me in this, please?
I don't see the actual error, but can you try if this works: LLVM_CONFIG_PATH=/usr/bin/llvm-config cargo build?
@domenukk can I just generate the PR? I think this error is occuring are related to the LLVM and clang installation . It says failed to build custom command for libafl_cc v0.11.2
Sure, the CI will check it anyway - but you probably want to fix your LLVM install at some point ;)
Surely, I will fix it soon.
I'm looking into this. I found that std::io::Error::last_os_error().raw_os_error().unwrap() is of type std::io::RawOsError, which is an alias to i32 type, and there doesn't seem to be a convenient way to convert it to a descriptive string.
Instead, as suggested in the deprecation warning of std::io::Error::description(), we can use std::io::Error::last_os_error().to_string(). This uses the Display trait and returns something like {sys::os::error_string(code)} (os error {code}) (src). For example, "No such file or directory (os error 2)".
This stack overflow question said that it does not seem "easy" to get rid of the "(os error {code})" part.
we don't need to get rid of it
https://github.com/am009/LibAFL/commit/bb2b63851ee38391c60865d0766bdf34b0f0de7f
this is fine
but we could add another enum like Error::UnixOSError(), instead of Error::unknown
see libafl_bolts::Error