[2017-05-09 16:51] Philipp Takacs <phil...@bureaucracy.de>
> [2017-05-06 12:30] Vasily Kolobkov <polezaivs...@openmailbox.org>
> > When a pager sprang up by `show +folder msgs` terminates prior to
> > consuming all the input, the show(1) will fall victim to SIGPIPE
> > trying to feed more data into a widowed pipe. As a result context
> > doesn't get saved.
> 
> This bug/feature[0] is a general problem in mmh. The implicit folder
> change is saved after the program is finished. This has has the
> problem, you mention. On the other side the rest of the context should
> saved only if there wasn't a problem.
> 
> As an example: You want to show all unread mails, but your pager is
> broken and fails. At this situation you don't want to change the
> unread sequence, because you haven't read the mails.
> 
> > I can think of couple ways to fix this:
> > 
> > 1. ignore the SIGPIPE and handle EPIPE errors
> > 2. save the context early
> > 
> > First approach would _probably_ mean quite a bunch of extra error
> > checking code. The second one seems more elegant, though i can't
> > judge it's soundness.
> >
> > What's your opinion on this?
> 
> Both your solution miss the problem with the rest of the context.

Why do you think the first one won't do it? My idea was that an
EPIPE return of any i/o call (between m_popen and m_pclose) together
with 0 exit status of the pager can be read as pager having done
it's job and thus proceed updating context at the end.

> As a solution I would say we can save the context after the chdir
> and at the end of the program the rest, but for all tools.

Got it!

Reply via email to