Menu

📰
0

Tracking down a Zsh history data loss bug 🐞

Michael Stapelberg·Michael Stapelberg·about 1 month ago
#20uLkNJu
#include#bpftrace#zsh#history#linux#article
Reading 0:00
15s threshold

Table of contents The good news first The symptom My Zsh history config Tracing the behavior inotify fatrace strace bpftrace Making it crash! What was the bug? Conclusion Appendix A: Bonus Footgun: exported HISTFILE Appendix B: Bonus Question: Can AI find this bug? Eval setup: symptom + bpftrace Eval variant: habit-hinted AI Conclusion For many years, I sometimes discovered that commands I was sure I had run were no longer present in my Z shell history file ( ~/.zsh_history ). In this article, I will show you how I tracked down the bug. Spoiler: ultimately, patching Zsh to make it crash loudly and analyzing the crash’s core dump was the winning strategy! The good news first Zsh 5.9.2 (released July 12th, 2026) contains a fix for this issue — open it after reading this investigation to not spoil the fun.…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.

Read More