exception in Mac OS X 10.4

Bug #512901 reported by abb
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Sparkle
New
Undecided
Unassigned

Bug Description

Hi,

I've found the only problem with Sparkle in Mac OS X 10.4 -- an exception is raised when the main app is started. The exception is caused by [NSString boolValue] selector usage. Is it possible to use another code there? Or is Sparkle completely incompatible with 10.4? As far as I can see, it is working OK but this exception, which does not stops the app though.

Thanks.

Revision history for this message
Andy Matuschak (andymatuschak) wrote :

You’re using 1.5b6, right? If so, I’m fairly certain we caught all the instances of this selector’s usage since then.

Revision history for this message
abb (openworld) wrote :

I'm sorry, but isn't this the reason?

from SUHost.m:

- (id)objectForInfoDictionaryKey:(NSString *)key
{
    return [bundle objectForInfoDictionaryKey:key];
}

- (BOOL)boolForInfoDictionaryKey:(NSString *)key
{
 return [[self objectForInfoDictionaryKey:key] boolValue];
}

You never check what type is returned. And exception occurs if this type is NSString. As I believe, a small fix like to check if returned value is NSString and if yes, to compare it explicitly with @"true" value could solve the issue.

Thanks.

Revision history for this message
Andy Matuschak (andymatuschak) wrote :

Oh, but wait, that would only be an issue if you stored a boolean value in a string key in your Info.plist. Which is not a legit thing to do anyway.

Revision history for this message
abb (openworld) wrote :

I don't know how boolean values are stored there, as I never modified it directly, but always used plist editor for that. Visually it's very dificult to detect if this is a boolean or a string value, because they look identically.

The fact is that I'm getting an exception. Could you modify your code and compile it into a framework, so I could test it with my projects?

Thanks.

Revision history for this message
Andy Matuschak (andymatuschak) wrote :

A boolean value has a checkbox for its value.

You can inspect and change the types in your Info.plist readily by choosing View > Property List Type > None.

Or, you can choose the row in question and go to Edit > Value Type > Boolean.

Revision history for this message
abb (openworld) wrote :

> A boolean value has a checkbox for its value.

Your description tells me to add few items into the info.plist. I've added them. I'm new in XCode, so I didn't know how to specify the value type. Therefore I just wrote "true" for boolean values like "SUEnableAutomaticChecks". I believe this is the reason.

One way or another but I don't understand why not to change the code to fix such possible problem. Your code allows to set boolean values as strings in 10.5+, so why not to extend this ability to 10.4?

Thanks.

Revision history for this message
Andy Matuschak (andymatuschak) wrote :

"Therefore I just wrote "true" for boolean values like "SUEnableAutomaticChecks". I believe this is the reason.”

Yes, that’s why it’s broken.

"Your code allows to set boolean values as strings in 10.5+, so why not to extend this ability to 10.4?”

That’s by accident, not by design. NSString just happened to add a “boolValue” method with 10.5+, which makes this work through the magic of duck typing. I don’t really want to hack in a workaround to make Sparkle support invalid inputs, especially since the inputs are entirely under developer control.

You’re right, though, that I didn’t explicitly specify the types of the keys in the documentation; that’s been fixed.

Revision history for this message
abb (openworld) wrote :

OK, let's close this discussin.

Thanks.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.