From: Otto Moerbeek Subject: Re: tog: 'q' exits instead of quitting view (FreeBSD) To: Christian Weisgerber Cc: gameoftrees@openbsd.org Date: Sun, 15 Nov 2020 08:11:03 +0100 On Sun, Nov 15, 2020 at 12:20:16AM +0100, Christian Weisgerber wrote: > Stefan Sperling: > > > > I start tog log, > > > hit 't' to switch to tree view, > > > hit 'l' to switch to log view for a file, > > > hit enter for the latest diff, > > > hit 'q' and ... > > > > > > ... on FreeBSD, tog exits. No error. It's as if I had hit 'Q'. > > > > Can you find out which condition causes view_loop() to exit? > > dead_view == main_view && new_view == NULL > > It's a bug hidden by memory randomization, which FreeBSD does not > have, at least by default. but but but randomization is supposed to find bugs ... :-) > The sequence above is: > 1. open first log view > => this view is remembered in main_view > 2. open tree view > 3. open second log view, closes first log view and tree view > => the memory of the first log view and the tree view is free()ed > 4. open diff view > => malloc() returns the memory previously occupied by the first > log view > => the new diff view now matches main_view This scenario can happen on OpenBSD as wel, it is just less likely. -Otto