NSPredicate also lacks NSSecureCoding and -allowEvaluation
Maintainers usually reply within 2 days
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 48/100
- Issue type
- Feature
- Clarity
- Clearly specified
- Activity status
- Quiet
- Tech stack
- objective-c
- Domain
- backend
Research direction
Start by reading NSPredicate and its concrete predicate subclasses, especially their encodeWithCoder: implementations; the issue notes that current master already implements coding for compound and comparison predicates and expressions. Compare the GNUstep APIs with the stated NSSecureCoding and allowEvaluation requirements, then run or extend tests for archiving, secure decoding, and predicate evaluation. Done means predicate archives round-trip without crashing and the missing API behavior is covered.
Written by the indexing model from the issue text.
Description
Environment: gnustep-base 1.29.0 (Ubuntu 24.04 packages, GCC ObjC runtime, libobjc.so.4)
Summary:
- Archiving any
NSPredicatewithNSKeyedArchivercrashes with SIGSEGV — even[NSPredicate predicateWithValue:YES]. In 1.29.0, -[NSPredicate encodeWithCoder:]and the concrete subclass implementations are// FIXMEstubs calling[self subclassResponsibility: _cmd];instead of a catchableNSInvalidArgumentException, the process segfaults insideobjc_msg_lookupduring the archive. (Current master`` implements coding for compound/comparison predicates and expressions, so newer builds are partly fixed, but 1.29.x, as shipped by distros, crashes.) NSPredicatedoes not conform toNSSecureCoding(Apple: conforms since macOS 10.13/iOS 11).NSPredicatedoes not implement-allowEvaluation(Apple API since macOS 10.9/iOS 7, used after secure decoding). Code portable with Apple Foundation that unarchives predicates must call it, so its absence forcesrespondsToSelector:workarounds.
Reproduction:
#import <Foundation/Foundation.h>
int main(void)
{
NSAutoreleasePool *pool = [NSAutoreleasePool new];
NSPredicate *p = [NSPredicate predicateWithValue:YES]; // simplest case
// Also crashes with: [NSPredicate predicateWithFormat:@"NOT (SELF < 0)"]
NSLog(@"responds to allowEvaluation: %d",
[p respondsToSelector:NSSelectorFromString(@"allowEvaluation")]); // 0
NSLog(@"conforms to NSSecureCoding: %d",
[[p class] conformsToProtocol:@protocol(NSSecureCoding)]); // 0
NS_DURING
NSData *d = [NSKeyedArchiver archivedDataWithRootObject:p]; // SIGSEGV here
NSLog(@"archived %lu bytes", (unsigned long)[d length]);
NS_HANDLER
NSLog(@"EXCEPTION: %@", localException); // never reached
NS_ENDHANDLER
[pool drain];
return 0;
}
Actual output:
responds to allowEvaluation: 0
conforms to NSSecureCoding: 0
Segmentation fault (core dumped)
Expected: On Apple Foundation the same program archives the predicate successfully and round-trips it via NSKeyedUnarchiver (with -allowEvaluation needed before evaluating a securely decoded predicate). At minimum, an unimplemented encodeWithCoder: should raise a catchable exception rather than segfault.
Impact: Any framework that archives model metadata containing predicates (e.g., CoreData-style validationPredicates in a compiled model) cannot serialize predicates on GNUstep and must fall back to storing predicate format strings.
- Dominant language
- Objective-C
- Stars
- 997
- Forks
- 305
- Avg merge
- 1d 20h
- Merged PRs (30d)
- 56
Getting set up
This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from gnustep/libs-base
-
Rewrite runloop event polling for simplification/efficiency, implement common modes for eventPossibly taken @rfm claimed this 10 days ago. Openenhancement
gnustep/libs-base#865 · 1 comment · 1 assignee ·
Maintainers usually reply within 2 days
-
Optimise -performSelector:withObject:afterDelay: and -performSelector:withObject:afterDelay:inModes:Openenhancement
Difficulty 5/5 Over a week Newbie friendliness 35/100
Maintainers usually reply within 2 days
-
Difficulty 3/5 Half a day Newbie friendliness 45/100
gnustep/libs-base#850 · 5 comments ·
Maintainers usually reply within 2 days
-
enhancement
Difficulty 5/5 Over a week Newbie friendliness 35/100
Maintainers usually reply within 2 days
-
1.32 release?Open
Difficulty 5/5 Over a week Newbie friendliness 20/100
gnustep/libs-base#784 · 3 comments ·
Maintainers usually reply within 2 days
All issues in gnustep/libs-base
Similar issues
-
[FEATURE REQUEST] Replace "Nothing to see here-yet" text string with "This Tweet has been deleted"Openenhancement
Difficulty 1/5 Under an hour Newbie friendliness 70/100
NeoFreeBird/app#204 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 80/100
lynx-family/lynx#10587 ·
Maintainers usually reply within 1 day
-
Difficulty 1/5 Under an hour Newbie friendliness 65/100
SwiftOldDriver/iOS-Weekly#5480 ·
-
Difficulty 1/5 Under an hour Newbie friendliness 88/100
Hammerspoon/hammerspoon#3913 ·
-
Difficulty 1/5 Under an hour Newbie friendliness 78/100
dkhamsing/open-source-ios-apps#2484 · 1 reaction ·
Maintainers usually reply within 1 day