zenfs
zenfs copied to clipboard
zenfs list crashes when binary is built with gcc-11
While testing Percona Server 8.0.30-22 on a new platform (Oracle Linux 9), where default compiler is gcc-11
I discovered a crash when executing zenfs list --zbd=nullb0
#0 0x00007ffff7a1a43c in __pthread_kill_implementation () from /lib64/libc.so.6
#1 0x00007ffff79cdd06 in raise () from /lib64/libc.so.6
#2 0x00007ffff79a07d3 in abort () from /lib64/libc.so.6
#3 0x00007ffff7d3f9d8 in std::__replacement_assert(char const*, int, char const*, char const*) () from /lib64/libstdc++.so.6
#4 0x00007ffff7dc26b3 in std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::back() () from /lib64/libstdc++.so.6
#5 0x00000000004141ce in rocksdb::AddDirSeparatorAtEnd (path="")
at /home/yura/ws/percona-server/storage/rocksdb/rocksdb_plugins/zenfs/util/zenfs.cc:53
#6 0x0000000000415440 in rocksdb::zenfs_tool_list () at /home/yura/ws/percona-server/storage/rocksdb/rocksdb_plugins/zenfs/util/zenfs.cc:244
#7 0x00000000004191cf in main (argc=2, argv=0x7fffffffe2c0)
at /home/yura/ws/percona-server/storage/rocksdb/rocksdb_plugins/zenfs/util/zenfs.cc:798
It looks like the problem is here
https://github.com/westerndigitalcorporation/zenfs/blob/fe35959e66cdc6874ed1b589a6217ab514a34c03/util/zenfs.cc#L54
back()
cannot be called on an empty string "".
The fix is straightforward
if (!path.empty() && path.back() != '/') path = path + "/";
@yhr Could you create a separate branch in your repo (say, 2.0
) based on the current v2.1.0
tag, apply this patch there and create another tag v2.1.1
. We still have a couple of days to include this into the upcoming Percona Server release.
@percona-ysorokin thanks for reporting and for providing the fix! @MaisenbacherD will create a tag with the fix applied on a separate branch(2.1) based on the v2.1.0 tag