From: Christian Weisgerber Subject: Loss of original errors To: gameoftrees@openbsd.org Date: Tue, 11 Jul 2023 20:22:20 +0200 There are a few places in got(1) where, if an error occurs, a clean-up action is executed, whose potential error is ignored, and the original error is returned. Or at least that's the intent. In practice, the original error can be lost because the custom_errors[] ring buffer is too small. Specifically, there are three instances in cmd_histedit(): error = histedit_...(...); if (error) { got_worktree_histedit_abort(...); print_merge_progress_stats(...); goto done; } Here got_worktree_histedit_abort() creates a number of ignored errors that overrun the ring buffer. I first tried increasing the buffer size, but a mkdir(2) is run on every directory in the worktree, filling the buffer with ignored EEXIST errors, so that doesn't scale. There is similar-ish code in cmd_integrate() with calls to got_worktree_integrate_abort(), but that routine probably doesn't do enough work to cause problems. The obvious solution would be to save *error into a variable before calling the clean-up action, but I haven't found a precedent in the code, and it can't be a local variable... Suggestions? -- Christian "naddy" Weisgerber naddy@mips.inka.de