bugGNUstep - Bugs: bug #25720, validateValue:forKey:error broken...

Group
 
 

bug #25720: validateValue:forKey:error broken in base-1.18

Submitter:  Michael Johnston <mjohnston>
Submitted:  Fri 27 Feb 2009 11:51:56 AM 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 27 Feb 2009 01:39:27 PM UTC, comment #2: 

Do unto others ... ;-)


Michael Johnston <mjohnston>
Fri 27 Feb 2009 12:56:57 PM UTC, comment #1: 

Thanks ... wonderful bug report identifying exact problem , and with a solution too!
I added a call to -respondsToSelector: in svn. The fix will be in the next release.

Richard Frith-Macdonald <CaS>
Group Member
Fri 27 Feb 2009 11:51:56 AM UTC, original submission:  

Library version - gnustep-startup-0.22
gcc version - 4.3.2
OS - Fedora Core 10

Expected Behaviour

validateValue:forKey:error: should return YES by default if the receiver doesn't implement key-value validation for the key.

Actual Behaviour:

validateValue:forKey:error tries to call validate$KEY:error whether or not the reciver implements the method. This causes an exception to be raised.

Regression:

This problem does not exist in previous version of base.

Reason:

 I think this may be due to a difference in behaviour between using sel_get_uid (via GSSelectorFromName()) in 1.18)  and sel_get_any_uid used in previous versions.

In 1.18 validateValue:forKey:error uses the return value of GSSelectorFromName to decide whether to obtain a pointer to the method via methodForSelector: and call it.
However it seems that this function returns a selector regardless of whether such a method exists or not, whereas previously sel_get_any_uid would return 0 if the selector wasn't valid.

Next methodForSelector: returns a IMP for the (invalid) selector - it never checks it svalidity as it only expects real selectors. Finally the function pointer is called and the exception raised.

Possible Solution:

Add a respondsToSelector: call after obtaining the selector.






Michael Johnston <mjohnston>

 

(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 mjohnston (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 2 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2009-02-27 CaS StatusNone Fixed
        Open/ClosedOpen Closed

    Back to the top

    Powered by Savane 3.13-caa5.
    Corresponding source code