You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm trying to port some tests over to kyua on illumos, and have problem with kyua itself -- I'm compiling all the dependencies (except system libraries) statically into one big executable. The same process works on FreeBSD (same Makefile and sources) and nearly follows what FreeBSD does in base system, so that should not be an issue.
Now running ~/kyua/kyua test in sed tests subdirectory copied over from FreeBSD's /usr/tests/usr.bin/sed make kyua crash:
$ ~/kyua/kyua test
*** Fatal signal 11 received
*** Log file is /home/yuripv/.kyua/logs/kyua.20200721-043513.log
*** Please report this problem to kyua-discuss@googlegroups.com detailing what you were doing before the crash happened; if possible, include the log file mentioned above
zsh: segmentation fault (core dumped) ~/kyua/kyua test
...gives me the following in the log when run with --loglevel=debug:
...
20200721-042945 I 717229 src/kyua/utils/process/executor.cpp:368: Cleaning up exit_handle for exec_handle 717230
20200721-042945 D 717229 src/kyua/utils/fs/directory.cpp:211: old=0
20200721-042945 D 717229 src/kyua/utils/fs/directory.cpp:213: new=0xaa2d30
20200721-042945 D 717229 src/kyua/utils/fs/directory.cpp:211: old=0xaa2d30
20200721-042945 D 717229 src/kyua/utils/fs/directory.cpp:213: new=0xaa2d90
20200721-042945 D 717229 src/kyua/utils/fs/directory.cpp:211: old=0xaa2d90
20200721-042945 D 717229 src/kyua/utils/fs/directory.cpp:213: new=0xaa2cd0
20200721-042945 D 717229 src/kyua/utils/fs/operations.cpp:703: Descending into /tmp/kyua.CIqRXR/1/work
20200721-042945 D 717229 src/kyua/utils/fs/directory.cpp:211: old=0
20200721-042945 D 717229 src/kyua/utils/fs/directory.cpp:213: new=0xaa0360
20200721-042945 D 717229 src/kyua/utils/fs/directory.cpp:211: old=0xaa0360
20200721-042945 D 717229 src/kyua/utils/fs/directory.cpp:213: new=0xaa2eb0
20200721-042945 D 717229 src/kyua/utils/fs/operations.cpp:711: Removing empty directory /tmp/kyua.CIqRXR/1/work
20200721-042945 D 717229 src/kyua/utils/fs/directory.cpp:211: old=0x7478742e
I'm really lost as C++ is still uncharted territory for me, but last pointer seems to be stomped on.
The build is done using different gcc versions (7, 9, 10) all producing the same result.
Any hints on debugging this further?
The text was updated successfully, but these errors were encountered:
Of course, this has nothing to do with c++, it's the difference in d_name member of struct dirent being char d_name[256] in linux and FreeBSD and char d_name[1] in illumos (Solaris), so we have memory corruption here reading into d_name not having the actual storage allocated.
I see #184 filed to make kyua use readdir() instead, can that be integrated?
For the moment I'll just use the following as (ugly) workaround:
diff --git a/utils/fs/directory.cpp b/utils/fs/directory.cpp
index ff7ad5e..a6fc9aa 100644
--- a/utils/fs/directory.cpp
+++ b/utils/fs/directory.cpp
@@ -32,6 +32,7 @@ extern "C" {
#include <sys/types.h>
#include <dirent.h>
+#include <limits.h>
}
#include <cerrno>
@@ -133,6 +134,10 @@ struct utils::fs::detail::directory_iterator::impl : utils::noncopyable {
/// readdir_r(3) function.
::dirent _dirent;
+ /// Solaris and derivatives define d_name member of struct dirent
+ /// as char d_name[1], so we need to provide the actual storage.
+ char _d_name[NAME_MAX];
+
/// Custom representation of the directory entry.
///
/// This is separate from _dirent because this is the type we return to the
I'm trying to port some tests over to kyua on illumos, and have problem with kyua itself -- I'm compiling all the dependencies (except system libraries) statically into one big executable. The same process works on FreeBSD (same Makefile and sources) and nearly follows what FreeBSD does in base system, so that should not be an issue.
Now running
~/kyua/kyua test
in sed tests subdirectory copied over from FreeBSD's /usr/tests/usr.bin/sed make kyua crash:Apparently, it's:
https://github.com/jmmv/kyua/blob/a685f911237e7badddbfb71f1301f640c71673d0/utils/fs/directory.cpp#L210
Adding debug prints before and after the line as following:
...gives me the following in the log when run with
--loglevel=debug
:I'm really lost as C++ is still uncharted territory for me, but last pointer seems to be stomped on.
The build is done using different gcc versions (7, 9, 10) all producing the same result.
Any hints on debugging this further?
The text was updated successfully, but these errors were encountered: