libs-gui icon indicating copy to clipboard operation
libs-gui copied to clipboard

exception due to bad PPD whilesetting up page

Open rmottola opened this issue 10 months ago • 1 comments

I noticed a strange behaviour with Ink (happens on Solaris/sparc64 but I think it is just a coincidence) where I get a "white menu" instead of opening a page layout or print. In Graphos it works. From debugging, an exception is happening, not caught and this is due to invalid PPD file:

#0  -[NSException raise] (self=0x2f0c98, _cmd=0xfe961758 <_OBJC_SELECTOR_TABLE+240>) at NSException.m:1602
#1  0xfe5e6f00 in +[NSException raise:format:arguments:] (self=0xfe9618c4 <_OBJC_Class_NSException>, 
    _cmd=<optimized out>, name=0xff1a6cf8 <_OBJC_INSTANCE_23>, format=0xff180438 <_OBJC_INSTANCE_29>, 
    argList=<optimized out>) at NSException.m:1494
#2  0xfe5e7c90 in +[NSException raise:format:] (self=0xfe9618c4 <_OBJC_Class_NSException>, 
    _cmd=0xff17fd44 <_OBJC_SELECTOR_TABLE+512>, name=0xff1a6cf8 <_OBJC_INSTANCE_23>, 
    format=0xff180438 <_OBJC_INSTANCE_29>) at NSException.m:1479
#3  0xfee9f3f8 in -[NSPrinter(PPDParsingPrivate) loadPPDAtPath:symbolValues:inclusionSet:] (self=self@entry=0x40f7c8, 
    _cmd=_cmd@entry=0xff17fd24 <_OBJC_SELECTOR_TABLE+480>, ppdPath=ppdPath@entry=0x180558, 
    ppdSymbolValues=ppdSymbolValues@entry=0x3fabf0, inclusionSet=0x4162d8) at NSPrinter.m:917
#4  0xfee9eab4 in -[NSPrinter(PPDParsing) parsePPDAtPath:] (self=self@entry=0x40f7c8, 
    _cmd=_cmd@entry=0xfad75424 <_OBJC_SELECTOR_TABLE+72>, ppdPath=0x180558) at NSPrinter.m:790
#5  0xfad636a4 in +[GSLPRPrinter printerWithName:] (self=<optimized out>, _cmd=<optimized out>, name=<optimized out>)
    at GSLPRPrinter.m:100
#6  0xfee9d738 in +[NSPrinter printerWithName:] (self=<optimized out>, _cmd=<optimized out>, name=0x17f270)
    at NSPrinter.m:191
#7  0xfad62854 in +[GSLPRPrintInfo defaultPrinter] (self=0xfad74fc4 <_OBJC_Class_GSLPRPrintInfo>, 
    _cmd=0xff180674 <_OBJC_SELECTOR_TABLE+104>) at GSLPRPrintInfo.m:83
#8  0xfeea1a84 in +[NSPrintInfo defaultPrinter] (self=<optimized out>, _cmd=0xff180674 <_OBJC_SELECTOR_TABLE+104>)
    at NSPrintInfo.m:121
#9  0xfeea3118 in -[NSPrintInfo initWithDictionary:] (self=<optimized out>, _cmd=0xff18066c <_OBJC_SELECTOR_TABLE+96>, 
    aDict=0x0) at NSPrintInfo.m:175
#10 0xfeea1960 in +[NSPrintInfo sharedPrintInfo] (self=<optimized out>, _cmd=0xff16118c <_OBJC_SELECTOR_TABLE+1336>)
    at NSPrintInfo.m:96
#11 0xfee009a0 in -[NSDocument printInfo] (self=<optimized out>, _cmd=0x26018 <_OBJC_SELECTOR_TABLE+888>)
    at NSDocument.m:1341
#12 0x000120e4 in -[Document printShowingPrintPanel:] (self=0x26db88, _cmd=<optimized out>, flag=<optimized out>)
    at Document.m:174
#13 0xfee00e94 in -[NSDocument printDocumentWithSettings:showPrintPanel:delegate:didPrintSelector:contextInfo:] (
    self=self@entry=0x26db88, _cmd=_cmd@entry=0xff161204 <_OBJC_SELECTOR_TABLE+1456>, settings=0x195178, 
    flag=flag@entry=1 '\001', delegate=delegate@entry=0x0, sel=sel@entry=0x0, context=context@entry=0x0)
    at NSDocument.m:1449
#14 0xfee00dd8 in -[NSDocument printDocument:] (self=0x26db88, _cmd=0xff197d60 <_OBJC_SELECTOR_TABLE+856>, 
    sender=0x300830) at NSDocument.m:1434
#15 0xfed7f590 in -[NSApplication sendAction:to:from:] (self=self@entry=0x1380f0, 
    _cmd=_cmd@entry=0xff175618 <_OBJC_SELECTOR_TABLE+1248>, 
    aSelector=aSelector@entry=0xff197d60 <_OBJC_SELECTOR_TABLE+856>, aTarget=<optimized out>, 

specific:

(gdb) po self
<NSException: 0x2e54b8> NAME:NSPPDParseException REASON:PPD file '/opt/GNUstep/Local/Library/PostScript/PPD/English.lproj/Generic-PostScript_Printer-Postscript.ppd' isn't readable

The PPD doesn't exist in that location and I was quite puzzled of why Ink misbehaved

It is in the defaults. Ink has:

org.gnustep.Ink NSRecentDocuments '(
    "file:///home/multix/gnustep-src/tests-examples/gui/Ink/Readme.rtf"
)'
org.gnustep.Ink NSDefaultOpenDirectory /home/multix/gnustep-src/tests-examples/gui/Ink
org.gnustep.Ink GSLPRPrinters '{
    Unnamed = {
        Host = localhost;
        Note = "Automatically Generated";
        PPDPath = "/opt/GNUstep/Local/Library/PostScript/PPD/English.lproj/Generic-PostScript_Printer-Postscript.ppd";
        Type = Unknown;
    };
}'
org.gnustep.Ink NSMenuLocations '{
    "\033" = "0 695 90 202 0 0  1600 900 ";
}'

While e.g Graphos has in the same domain:

org.gap.Graphos GSLPRPrinters '{
    Unnamed = {
        Host = localhost;
        Note = "Automatically Generated";
        PPDPath = "/opt/GNUstep/System/Library/PostScript/PPD/English.lproj/Generic-PostScript_Printer-Postscript.ppd";
        Type = Unknown;
    };
}'

If I, as test, change Graphos' PPDPath to something invalid, Graphos will show an exception about the file bing non valid at startup and abort.

I think neither Ink nor Graphos show a decent behaviour and it comes from GNUstep itself

In the case of Ink I guess it is an invalid because of a past installation in Local, but it doesn't really mattter. PPD could come and go depending on printers, installations.. they are not solely GS domain. I think we have multiple issues

  • [ ] If on Open a PPD is not existent, it should not be an aborting exception, but fall-back to default
  • [ ] If on Print or Page Setup the PPD is not existent or anyway there is an error, it should not have an uncaught exception, but catch it an fallback to default
  • [ ] Is storing the PPD per-app necessary at all?

rmottola avatar Apr 23 '25 20:04 rmottola

I did some further tests on a couple of systems... and wonder.

  • On my Linux workstation, Ink and GNUstep does not appear to have stored the Printer and PPD in preferences, so "no issue"
  • On my FreeBSD workstation, the preferences are set and look the same as on Solaris, but apparently they get ignored and a Dummy printer gets reinitialized. If i fake the path to something wrong, I do not get an exception either, but on application exit, the wrong path remains

I wonder if this default is still used or only "read". If it is dependent on CUPS presence or not. If it is obsolete or not. If it is obsolete it shouldn't "disturb" the application, though.

rmottola avatar Apr 29 '25 08:04 rmottola