bugGNUstep - Bugs: bug #29012, Service executable cannot read the...

Group
 
 

bug #29012: Service executable cannot read the service's info dictionary

Submitter:  Wolfgang Lux <wlux>
Submitted:  Fri 26 Feb 2010 02:22:00 PM UTC
   
 
Category:  Base/Foundation Severity:  3 - Normal
Item Group:  Bug Status:  Fixed
Privacy:  Public Assigned to:  None
Open/Closed:  Closed
* Mandatory Fields

Add a New Comment Rich Markup
   

Fri 26 Feb 2010 04:57:29 PM UTC, comment #2: 

Reported as working.

Richard Frith-Macdonald <CaS>
Group Member
Fri 26 Feb 2010 03:16:50 PM UTC, comment #1: 

Thanks.
I applied the suggested fix.

Richard Frith-Macdonald <CaS>
Group Member
Fri 26 Feb 2010 02:22:00 PM UTC, original submission:  

E.g., add the following lines to the main function of GSspell.service

  NSLog(@"mainBundle = %@", [NSBundle mainBundle]);
  NSLog(@"resourcePath = %@", [[NSBundle mainBundle] resourcePath]);
  NSLog(@"infoDictionary = %@", [[NSBundle mainBundle] infoDictionary]);

Running the modified service executable yields the output

2010-02-26 14:34:40.278 GSspell[28696] mainBundle = <NSBundle: 0x33d1e08> </usr/GNUstep/System/Library/Services/GSspell.service/Resources/GSspell>
2010-02-26 14:34:40.310 GSspell[28696] resourcePath = /usr/GNUstep/System/Library/Services/GSspell.service/Resources/GSspell/Resources
2010-02-26 14:34:40.313 GSspell[28696] infoDictionary = {}

The problem is caused by NSBundle's -mainBundle method, which IMO implements a wrong search order. It assumes that the executable is part of a bundle only when the parent directory ends in one of the known application suffixes and .service is not one of them. Of course, one could trivially add .service to the list of known suffixes, but I think this is just a stop gap measure, since it will break immediately when an application introduces its own kind of executable plugin bundles. The inclusion of .gswa and .woa in the list of known extensions looks to me a witness of this shortcoming.

I think that -mainBundle really should first check whether the executable is part of a bundle regardless of the parent directory's extension, i.e., check whether there is a Resources directory containing an Info.plist or Info-gnustep.plist file in the same directory as the executable. Only if that check fails, -mainBundle should look for a Resources directory in another place.

Wolfgang Lux <wlux>

 

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

Attach Files:
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by CaS (Posted a comment)
  • -email is unavailable- added by wlux (Submitted the item)
  •  

    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 3 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2010-02-26 CaS Open/ClosedIn Test Closed
    2010-02-26 CaS StatusNone Fixed
        Open/ClosedOpen In Test

    Back to the top

    Powered by Savane 3.13-caa5.
    Corresponding source code