Bug 1576608

Summary: System.TermInfoReader cannot handle new NCurses 6 TermInfo files
Product: [Fedora] Fedora Reporter: Dirk Hoffmann <hoffmann>
Component: monoAssignee: Xavier Lamien <lxtnow>
Status: CLOSED DUPLICATE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: high Docs Contact:
Priority: unspecified    
Version: 28CC: alexl, chkr, duffy, h.pillay, itamar, john.j5live, lxtnow, mbarnes, pokorra.mailinglists, rhughes, rstrode, sandmann
Target Milestone: ---   
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2018-06-07 04:41:20 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Dirk Hoffmann 2018-05-09 23:29:56 UTC
Description of problem:
pdfmod crashes at start

Version-Release number of selected component (if applicable):
pdfmod-0.9.1-18.fc28.x86_64

How reproducible:
Call "pdfmod" command at commandline
$ pdfmod

Actual results:
Unhandled Exception:
System.TypeInitializationException: The type initializer for 'System.Console' threw an exception. ---> System.TypeInitializationException: The type initializer for 'System.ConsoleDriver' threw an exception. ---> System.Exception: Magic number is wrong: 542
  at System.TermInfoReader.ReadHeader (System.Byte[] buffer, System.Int32& position) [0x0002b] in <373b6e083d6e45e498c9082a8eebd27f>:0 
  at System.TermInfoReader..ctor (System.String term, System.String filename) [0x00065] in <373b6e083d6e45e498c9082a8eebd27f>:0 
  at System.TermInfoDriver..ctor (System.String term) [0x00058] in <373b6e083d6e45e498c9082a8eebd27f>:0 
  at System.ConsoleDriver.CreateTermInfoDriver (System.String term) [0x00000] in <373b6e083d6e45e498c9082a8eebd27f>:0 
  at System.ConsoleDriver..cctor () [0x00062] in <373b6e083d6e45e498c9082a8eebd27f>:0 
   --- End of inner exception stack trace ---
  at System.Console.SetupStreams (System.Text.Encoding inputEncoding, System.Text.Encoding outputEncoding) [0x0000a] in <373b6e083d6e45e498c9082a8eebd27f>:0 
  at System.Console..cctor () [0x000a8] in <373b6e083d6e45e498c9082a8eebd27f>:0 
   --- End of inner exception stack trace ---
  at Hyena.Log.Commit (Hyena.LogEntryType type, System.String message, System.String details, System.Boolean showUser) [0x00108] in <d2bde5042d2b4c728acdbf713dfe8772>:0 
  at Hyena.Log.Debug (System.String message, System.String details) [0x0000c] in <d2bde5042d2b4c728acdbf713dfe8772>:0 
  at Hyena.Log.Debug (System.String message) [0x0000c] in <d2bde5042d2b4c728acdbf713dfe8772>:0 
  at Hyena.Log.DebugFormat (System.String format, System.Object[] args) [0x00013] in <d2bde5042d2b4c728acdbf713dfe8772>:0 
  at PdfMod.PdfMod.Main (System.String[] args) [0x0001a] in <8a959f5af7e94e12b2f71027f73493b5>:0 
[ERROR] FATAL UNHANDLED EXCEPTION: System.TypeInitializationException: The type initializer for 'System.Console' threw an exception. ---> System.TypeInitializationException: The type initializer for 'System.ConsoleDriver' threw an exception. ---> System.Exception: Magic number is wrong: 542
  at System.TermInfoReader.ReadHeader (System.Byte[] buffer, System.Int32& position) [0x0002b] in <373b6e083d6e45e498c9082a8eebd27f>:0 
  at System.TermInfoReader..ctor (System.String term, System.String filename) [0x00065] in <373b6e083d6e45e498c9082a8eebd27f>:0 
  at System.TermInfoDriver..ctor (System.String term) [0x00058] in <373b6e083d6e45e498c9082a8eebd27f>:0 
  at System.ConsoleDriver.CreateTermInfoDriver (System.String term) [0x00000] in <373b6e083d6e45e498c9082a8eebd27f>:0 
  at System.ConsoleDriver..cctor () [0x00062] in <373b6e083d6e45e498c9082a8eebd27f>:0 
   --- End of inner exception stack trace ---
  at System.Console.SetupStreams (System.Text.Encoding inputEncoding, System.Text.Encoding outputEncoding) [0x0000a] in <373b6e083d6e45e498c9082a8eebd27f>:0 
  at System.Console..cctor () [0x000a8] in <373b6e083d6e45e498c9082a8eebd27f>:0 
   --- End of inner exception stack trace ---
  at Hyena.Log.Commit (Hyena.LogEntryType type, System.String message, System.String details, System.Boolean showUser) [0x00108] in <d2bde5042d2b4c728acdbf713dfe8772>:0 
  at Hyena.Log.Debug (System.String message, System.String details) [0x0000c] in <d2bde5042d2b4c728acdbf713dfe8772>:0 
  at Hyena.Log.Debug (System.String message) [0x0000c] in <d2bde5042d2b4c728acdbf713dfe8772>:0 
  at Hyena.Log.DebugFormat (System.String format, System.Object[] args) [0x00013] in <d2bde5042d2b4c728acdbf713dfe8772>:0 
  at PdfMod.PdfMod.Main (System.String[] args) [0x0001a] in <8a959f5af7e94e12b2f71027f73493b5>:0 


Expected results:
GUI window showing up

Additional info:
Worked just before I upgraded from f27 to f28

Comment 1 Harish Pillay 2018-05-14 10:18:16 UTC
Exactly the same issue. I cleaned out pdfmod and reinstalled it and gave the same error.

System is a brand new Fedora 28 installation (ie not upgraded) (64bit).

Comment 2 Máirín Duffy 2018-06-06 12:48:41 UTC
It's a known bug in mono (pdfmod uses mono.) 

Here's info on the bug from upstream:
https://github.com/mono/mono/issues/6752

A workaround for the meanwhile is to set TERM=xterm before running pdfmod. That should let you run it.

There is a fix upstream already as I understand so for Fedora to fix this we'd need updated mono packages.

Comment 3 Harish Pillay 2018-06-06 12:50:40 UTC
I can confirm that the workaround does solve the issue for the time being on my systems.

Comment 4 Harish Pillay 2018-06-06 13:25:30 UTC
Since I use pdfmod as my viewer with mutt, I've added the following to the mailcap file:

application/pdf; { set -m \; /bin/mv -T %s %s.mv \; ( export TERM=xterm\; pdfmod %s.mv \; /bin/rm %s.mv \; ) & } \; disown -a

added the export TERM=xterm portion.

Comment 5 Timotheus Pokorra 2018-06-07 04:41:20 UTC

*** This bug has been marked as a duplicate of bug 1580447 ***

Comment 6 Dirk Hoffmann 2018-06-07 15:30:13 UTC
(In reply to Harish Pillay from comment #3)
> I can confirm that the workaround does solve the issue for the time being on
> my systems.

+1

Thanks!