Bug #4733
openDecode exception descriptions don't show function name
0%
Description
Using in progress import code with a bad data file shows that thrown exception has bad description. The PRETTY_FUNCTION isn't a macro but rather a string.
$ ./ceph_filestore_dump --filestore-path dev/osd1 --journal-path dev/osd1.journal --type import --file badfile
Importing pgid 3.0
do_import threw exception error buffer::malformed_input: PRETTY_FUNCTION decode past end of struct encoding
Corrupt input for import
Example of possible fix for one of the macros:
$ git diff include
diff --git a/src/include/encoding.h b/src/include/encoding.h
index eb445e3..fa66f49 100644
--- a/src/include/encoding.h
+++ b/src/include/encoding.h@ -718,8 +718,16
@ inline void decode(std::deque<T>& ls, bufferlist::iterator& p)
#define DECODE_ERR_OLDVERSION(func, v) \
"" #func " no longer understand old encoding version < " #v
#if 0
#define DECODE_ERR_PAST(func) \
"" #func " decode past end of struct encoding"
#endif
+inline const char *DECODE_ERR_PAST(const char *func) {
static std::string foo(func);
+ foo = " decode past end of struct encoding";
return foo.c_str();
+}
/**
* check for very old encoding
$ ./ceph_filestore_dump --filestore-path dev/osd1 --journal-path dev/osd1.journal --type import --file foo.couldabort
Importing pgid 3.0
do_import threw exception error buffer::malformed_input: void pg_stat_t::decode(ceph::buffer::list::iterator&) decode past end of struct encoding
Corrupt input for import