Ticket #2966 (closed defect: fixed)

Opened 12 years ago

Last modified 10 years ago

Viewer hangs when viewing broken manpage

Reported by: onlyjob Owned by: andrew_b
Priority: major Milestone: 4.8.14
Component: mcview Version: master
Keywords: Cc: egmont@…
Blocked By: Blocking:
Branch state: merged Votes for changeset: committed-master

Description

The attached manpage contains errors: when you press F3 on it it shows
some problems. After pressing <ESC> mc will show the manpage (at least
the non-broken part) properly. However, there is no way (like <ESC> or
<F10> to leave the viewer again - I needed to kill the xterm to get
rid of this view.

Attachments

mast.1 (32.3 KB) - added by onlyjob 12 years ago.

Change History

Changed 12 years ago by onlyjob

comment:1 Changed 12 years ago by andrew_b

  • Summary changed from Viewer crashes when viewing broken manpage to Viewer hangs when viewing broken manpage

comment:2 Changed 10 years ago by andrew_b

  • Status changed from new to accepted
  • Owner set to andrew_b
  • Branch state changed from no branch to on review
  • Milestone changed from Future Releases to 4.8.13

Branch: 2966_view_broken_manpage
Initial changeset:ae8baae53a8c66bb0bbbae9369684ebe6248cc75

Version 0, edited 10 years ago by andrew_b (next)

comment:3 Changed 10 years ago by andrew_b

  • Branch state changed from on review to on rework

comment:4 Changed 10 years ago by andrew_b

  • Milestone changed from 4.8.13 to Future Releases

comment:5 Changed 10 years ago by egmont

My rewritten nroff parser and viewer (#3250) suffers from the same bug. So it's probably not the viewer, but something with the previous pipeline that produces the output mcview displays. Maybe it starts to read from stdin where it receives no data, or some similar lockup.

comment:6 Changed 10 years ago by egmont

  • Cc egmont@… added

comment:7 follow-up: ↓ 8 Changed 10 years ago by egmont

Manually running the manpage formatting command (that 4.8.13 uses):

MANROFFOPT=-c MAN_KEEP_FORMATTING=1 man -P cat -l ./mast.1

produces 80kB of stdout and 170kB of stderr and then exits properly.

mcview displays a few error messages, then the file contents up to 40kB only. The man/roff pipeline is still there, the processes do not exit. strace reveals that troff is blocked writing an error message to fd 2.

So I believe the problem is that mcview doesn't read the stderr of the filter any more, and that pipe becomes filled up. So the next write event blocks the man pipeline.

mcview should select() on both the stdout and stderr of its child, and read from whichever has data.

comment:8 in reply to: ↑ 7 Changed 10 years ago by andrew_b

Replying to egmont:

So I believe the problem is that mcview doesn't read the stderr of the filter any more, and that pipe becomes filled up. So the next write event blocks the man pipeline.

I believe so too.

mcview should select() on both the stdout and stderr of its child, and read from whichever has data.

This is implemented in the 2966_view_broken_manpage branch but not finished yet.

comment:9 Changed 10 years ago by andrew_b

  • Version changed from 4.8.6 to master
  • Branch state changed from on rework to on review
  • Milestone changed from Future Releases to 4.8.14

Please review branch 2966_view_broken_manpage
Initial changeset:ebc19fda04eac3a7777fd531db9e4844de7387a1

comment:10 Changed 10 years ago by slavazanko

  • Votes for changeset set to slavazanko

comment:11 Changed 10 years ago by angel_il

  • Votes for changeset changed from slavazanko to slavazanko angel_il
  • Branch state changed from on review to approved

comment:12 Changed 10 years ago by andrew_b

  • Status changed from accepted to testing
  • Votes for changeset changed from slavazanko angel_il to committed-master
  • Resolution set to fixed
  • Branch state changed from approved to merged

Merged to master: [fe8a0a410f058bcb1080efe77304210350ff2339].

git log --pretty=oneline 5bcc246..fe8a0a4

comment:13 Changed 10 years ago by andrew_b

  • Status changed from testing to closed

comment:14 Changed 10 years ago by andrew_b

  • Status changed from closed to reopened
  • Votes for changeset committed-master deleted
  • Resolution fixed deleted
  • Branch state changed from merged to on review

There is segfault in mcview after switch from parse to raw mode and back.
How to reproduce:

  1. Open some small man page: mcview mcview.1
  2. Press F8 to switch to raw mode.
  3. Press F8 to back to parse mode.
  4. Segfault due to double close of stdio pipe.

Branch: 2966_view_broken_manpage_fix.
changeset:766ad74f4c13d2c627f3d7fcc572599a5652def5

comment:15 Changed 10 years ago by slavazanko

  • Votes for changeset set to slavazanko
  • Branch state changed from on review to approved

Approved with my little fix

comment:16 Changed 10 years ago by andrew_b

  • Status changed from reopened to closed
  • Votes for changeset changed from slavazanko to committed-master
  • Resolution set to fixed
  • Branch state changed from approved to merged
Note: See TracTickets for help on using tickets.