Daily blog july 28 by Catcream

Today worked on some different things. The first one was making another libexecinfo based on libunwind. The issue was that the current libexecinfo (resslinux/libexecinfo on github) sometimes segfaults. For me it segfaulted when emerging Emacs because temacs (Emacs bootstrap) used it, and I think it backtraced too far (into libc). After reading some GitHub issues/ML posts it seemed like everyone recommended libunwind instead, and there were some issues with libexecinfo due to __builtin_frame_address. Because the execinfo interface is so simple: basically one function that returns a list of pointers to previous function calls, and two other functions that retrieves the symbol names for these addresses, I thought it would be neat to just use libunwind for the backtrace()-function (the one that returns list of ptrs) and then just copy paste the symbol lookup funcs. I tried it and it “just works” without the __builtin_* hackery! The current version is improved over libexecinfo in 4 ways:

  1. Uses meson so that a .pc file gets generated automatically.
  2. Doesn’t generate source files with a Python script (https://github.com/resslinux/libexecinfo/blob/master/gen.py).
  3.  Doesn’t segfault (yay).
  4. Includes various fixes for backtrace_symbols https://git.alpinelinux.org/aports/tree/main/libexecinfo/10-execinfo.patch.

ebuild: https://github.com/alfredfo/catcream_repo/blob/master/sys-libs/libexecinfo/libexecinfo-1.0.0.ebuild
source: https://github.com/alfredfo/libexecinfo-unw

see: https://github.com/mikroskeem/libexecinfo/issues/2, https://www.openwall.com/lists/musl/2019/08/22/2.

I’ve also learnt how to set up clean musl build systems with ebuildtester.
Example: ebuildtester --portage-dir /home/cat/gentoo --atom sys-process/htop --docker-image gentoo/stage3:musl
Spent some time with Docker images before I realized that there was already a gentoo/stage3:musl image ready.

I have continued to research the Konsole test thing from monday. The TerminalInterfaceTest only fails when using zsh and ebuild konsole-ver.ebuild test (not executing test manually). I still don’t know really what causes it but when using bash it works.

currentDirectory = QStringLiteral("/tmp");
terminal->sendInput(QStringLiteral("cd") + currentDirectory + QLatin1Char('\n')); <- THIS
QCOMPARE(stateSpy.count(), 1);

This code fails, but changing it to
currentDirectory = QStringLiteral("/tmp");
terminal->sendInput(QStringLiteral("\ncd") + currentDirectory + QLatin1Char('\n'));
QCOMPARE(stateSpy.count(), 1);

currentDirectory = QStringLiteral("/tmp");
terminal->sendInput(QStringLiteral(";cd") + currentDirectory + QLatin1Char('\n'));
QCOMPARE(stateSpy.count(), 1);

works just fine. Really weird! It acts like there’s some garbage text inputted at the start.

I also never posted anything yesterday because I was up really late working on gsoc and just went to sleep :). Yesterday I messed around with Emacs to figure out the libexecinfo bug and I also looked into how to use libunwind, which got me the idea to implement libexecinfo using it. I also spent some time with the Konsole test thing.

This entry was posted in Uncategorized. Bookmark the permalink.

Leave a Reply

Your email address will not be published.