bugGNUstep - Bugs: bug #17112, Unarchiving XML-based nibs...

Group
 
 

bug #17112: Unarchiving XML-based nibs containing control characters fails....

Submitter:  Gregory John Casamento <gcasa>
Submitted:  Sat 15 Jul 2006 08:25:05 PM UTC
   
 
Category:  Base/Foundation Severity:  3 - Normal
Item Group:  Bug Status:  Fixed
Privacy:  Public Assigned to:  CaS
Open/Closed:  Closed
* Mandatory Fields

Add a New Comment Rich Markup
   

Jump to the original submission

Thu 19 Jun 2008 08:43:14 PM UTC, comment #11: 

I created a nib file to check for this specific case.  It loads properly.

Gregory John Casamento <gcasa>
Group administrator
Thu 19 Jun 2008 08:35:30 PM UTC, comment #10: 

Now I get an exception saying a class named RBSplitView can't be decoded.  This is normal since the class isn't present in the palettes or the standard library.

Further testing is necessary, but I believe this bug is fixed.  GC

Gregory John Casamento <gcasa>
Group administrator
Mon 05 Nov 2007 11:34:39 AM UTC, comment #9: 

Fixed call to sloppy xml parser handling illegal xml produced by apple.

Richard Frith-Macdonald <CaS>
Group Member
Thu 18 Oct 2007 05:15:55 PM UTC, comment #8: 

This still fails for me. When I try to load the provided NIB file I get:
at line: 8209 column: 11 ... PCDATA invalid Char value 27

Now line 8209 looks like this:
<string> </string>
Emacs displays the string as "^[", so we are still talking about the ESC here.

I don't get any error message from the second XML parser, so I have no glue, why this is failing.

Fred Kiefer <FredKiefer>
Group Member
Mon 19 Feb 2007 07:56:49 PM UTC, comment #7: 

Hopefully there is now a fix in place ... if parsing of a property list fails, we now retry with a less funtional but more tolerant parser which should accept illegal characters in the xml and thus work around the bug in Cocoa.

Can't test using the supplied nib though, because current Gorm on my system crashes before it tries to read the propertly list.  Will add that as a new bug report.

Richard Frith-Macdonald <CaS>
Group Member
Mon 19 Feb 2007 05:22:33 PM UTC, comment #6: 

Changed to a base bug, as it is not NIB file specific.

Fred Kiefer <FredKiefer>
Group Member
Mon 31 Jul 2006 06:25:35 PM UTC, comment #5: 

As I understand it, the problem is essentially that MacOS-X generates illegal XML, and the libxml2 parser used by GNUstep-base does not accept illegal XML.

I've (so far) been unable to find any way of getting libxml2 to accept the bad characters... which leaves two fixes I can see ...

1. do an inefficient scan for illegal characters first, replacing them with some unusual sequence.  parse the XML, and scan the parsed output for the sequence we put in, and change it back to the illegal character. Euch!

2. use another parser to handle MacOS-X plists ... one that tolerates illegal characters.
I've put some work into that, but it's not ready yet.

Richard Frith-Macdonald <CaS>
Group Member
Mon 31 Jul 2006 05:23:21 PM UTC, comment #4: 

This isn't a really helpful comment, but I just would like to add I observed the problem when trying to build an application ported to GNUstep from Cocoa. gnustep-make complains about the application plist being invalid. I usually work around the problem by maintaining two different plists (one for Cocoa and another one for GNUstep).

Quentin.

Quentin Mathé <qmathe>
Group Member
Sun 16 Jul 2006 03:07:33 PM UTC, comment #3: 

The work around for this problem is to not save the nib in the text-based XML format.  If it's a binary-keyed archive, it can read these characters just fine.

We still need to find a more permanent solution to this issue.

Gregory John Casamento <gcasa>
Group administrator
Sat 15 Jul 2006 09:16:30 PM UTC, comment #2: 

Shows how to handle illegal characters:
http://www.w3.org/International/questions/qa-controls

Gregory John Casamento <gcasa>
Group administrator
Sat 15 Jul 2006 09:07:38 PM UTC, comment #1: 

The problem with the:

"2006-07-15 13:58:38.550 Gorm[97219] Unable to parse XML archive as the base library was not configured with libxml2 support."

is due to a missing include in the NSKeyedUnarchiver.m file.  It should include config.h.  This eliminates that problem.   The other issue is that the XML file contains a "^[" (ESCAPE) character as indicated by this part of the error:

"at line: 8209 column: 11 ... PCDATA invalid Char value 27"

ESCAPE is illegal in XML and should be represented by an XML entity, if the XML has been canonicalized.  Apparently Apple's XML isn't.   This is what the parser is tripping over at that point.

I am testing a fix for the first issue, which I will commit shortly.   I'm not sure how to handle the second issue.

GJC

Gregory John Casamento <gcasa>
Group administrator
Sat 15 Jul 2006 08:25:05 PM UTC, original submission:  

Chris Vetter reported the following problem to me:

2006-07-15 13:58:38.517 Gorm[97219] don't know how to load entity
'http://www.apple.com/DTDs/PropertyList-1.0.dtd' id '-//Apple
Computer//DTD PLIST 1.0//EN'
.:3: validity error : Validation failed: no DTD found !
<plist version="1.0">
                     ^
at line: 8209 column: 11 ... PCDATA invalid Char value 27
2006-07-15 13:58:38.550 Gorm[97219] Unable to parse XML archive as the
base library was not configured with libxml2 support.

:0> ldd /Library/Libraries/libgnustep-base.so
[...]
         libxslt.so.2 => /usr/local/lib/libxslt.so.2 (0x2849d000)
         libxml2.so.5 => /usr/local/lib/libxml2.so.5 (0x284d0000)
[...]

I have reproduced this on two intel machines, my P4 Dual Core EM64T box and my P3 laptop.   Oddly, libxml is present and other nibs which are XML are parsable by the archiver.

As you can see libxml2 is linked in, but the error message shown is the one defined in NSKeyedUnarchiver in initForReadingWithData: in the #ifndef HAVE_LIBXML.   I have done a clean build and compile on both platforms to be sure this is not a build issue.   I have attached the nib file which is giving the error, it is called MainMenu.nib and is from Smultron, the other "viewinbox" is a simple test nib which is also in XML format.

Gregory John Casamento <gcasa>
Group administrator

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

Attached Files
file #15877:  menutest.nib.tgz added by gcasa (2KiB - application/x-compressed-tar - Test to check for this specific case.)
file #10362:  viewinbox.zip added by gcasa (3KiB - application/zip - XML based nib which works properly.)
file #10361:  MainMenu.nib.tgz added by gcasa (34KiB - application/x-gtar - XML based nib which causes the unarchiver to fail.)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by gcasa (Posted a comment)
  • -email is unavailable- added by CaS (Posted a comment)
  • -email is unavailable- added by FredKiefer (Posted a comment)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only logged-in users can vote.

     

    Follow 12 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2008-06-19 gcasa Attached File- Added menutest.nib.tgz, #15877
    2007-11-05 CaS Open/ClosedOpen Closed
    2007-10-18 FredKiefer Open/ClosedIn Test Open
    2007-02-19 CaS StatusIn Progress Fixed
        Open/ClosedOpen In Test
    2007-02-19 FredKiefer CategoryGui/AppKit Base/Foundation
        Assigned togcasa CaS
    2006-07-16 gcasa StatusNone In Progress
        Assigned toNone gcasa
    2006-07-16 gcasa SummaryUnarchiving some (not all) XML-based nibs using NSKeyedUnarchiver fails Unarchiving XML-based nibs containing control characters fails....
    2006-07-15 gcasa Attached File- Added viewinbox.zip, #10362
    2006-07-15 gcasa Attached File- Added MainMenu.nib.tgz, #10361

    Back to the top

    Powered by Savane 3.13-d3ae.
    Corresponding source code