Closed gzfuzz closed 3 months ago
It seems that fs::absolute("", ec) behaves differently on Ubuntu ("" with error code) and macOS (cwd() without error code?)... Should empty input be treated as a special case?
from https://en.cppreference.com/w/cpp/filesystem/absolute:
For POSIX-based operating systems, std::filesystem::absolute(p) is equivalent to std::filesystem::current_path() / p except for when p is the empty path.
Doesn't really says what the expected result is if p
is empty. Likely just OS dependent. I lean towards adding a special #ifdef __APPLE__
check in the test.
π¦ Bug fix
Fixes #614
Summary
The current version of common::absPath may cause crash when calling the /gazebo/resource_paths/resolve service with empty request. By changing filesystem::absolute to the non-throwing version, and check the error_code accordingly, the crash could be avoided.
Checklist
codecheck
passed (See contributing)Note to maintainers: Remember to use Squash-Merge and edit the commit message to match the pull request summary while retaining
Signed-off-by
messages.πΈπΈπΈπΈπΈπΈπΈπΈπΈπΈπΈπΈπΈπΈπΈπΈπΈπΈπΈπΈπΈπΈπΈπΈπΈπΈπΈπΈπΈπΈπΈπΈπΈπΈπΈπΈπΈ