View Issue Details

IDProjectCategoryView StatusLast Update
0001400SOGoSOPEpublic2011-10-05 09:16
Reporterbuzzdee Assigned To 
PrioritynormalSeveritycrashReproducibilityalways
Status closedResolutionfixed 
Product Version1.3.8 
Target VersionFixed in Version1.3.9 
Summary0001400: unhandled exception in OGo with sope/gnustep-base combination
DescriptionHi,

trying to enter a project in OGo webinterface, using sope linked against gnustep-base instead of libFoundation, leads to an unhandled exception in the
WOKeyPathAssociation. See the backtrace in the additional information. David verified on a Mac, that gnustep-base is right in this place with throwing an exception.

Answer I got from Helge:
That the missing key is consumed is actually right in this particular case. And yes, for the non-libFoundation variant, you would probably need to wrap it in an exception handler to accomplish the desired behavior. The SOPE WOKeyPathAssoc is(was?) highly optimized for libFoundation, I think the Cocoa/GS branches default to the standard KVC (it'll be muuuuch slower, but that might be perfectly fine on modern hardware ;-).

attached patch adds this mentioned exception handler, and makes OGo happy with this regard.

Could it please reviewed and added to SOPE.
As far as I can see, SOGo doesn't seem to use this at all, so should not affect it. At least with my SOGo instance, its working fine with the exception handler in place.

Additional Information#0 -[NSException raise] (self=0x843a3688, _cmd=0x250bb990) at NSException.m:956
0000001 0x05118453 in -[NSObject(KeyValueCoding) setValue:forUndefinedKey:] (self=0x85370f08, _cmd=0x25111400, anObject=0x7c0a5b68, aKey=0x843a3628) at NSKeyValueCoding.m:429
0000002 0x05215596 in GSObjCSetVal (self=0x85370f08, key=0xcfbcc3b0 "object", val=0x7c0a5b68, sel=0x0, type=0x0, size=6, offset=1) at GSObjCRuntime.m:1456
0000003 0x0511a1ab in -[NSObject(KeyValueCoding) takeValue:forKey:] (self=0x85370f08, _cmd=0x2c4164b0, anObject=0x7c0a5b68, aKey=0x7e9afaa8) at NSKeyValueCoding.m:854
0000004 0x0c49085e in _setValue (self=0x7ce652e8, _value=0x7c0a5b68, root=0x86b41908) at WOKeyPathAssociation.m:940
0000005 0x0c490efe in -[WOKeyPathAssociation setValue:inComponent:] (self=0x7ce652e8, _cmd=0x2c3e5d70, _value=0x7c0a5b68, _component=0x86b41908) at WOKeyPathAssociation.m:963
0000006 0x0c4327fb in WOComponent_syncToParent (self=0x87292508, _parent=0x86b41908) at WOComponent+Sync.m:181
0000007 0x0c437309 in WOContext_leaveComponent (self=0x85907408, _component=0x87292508) at WOContext.m:449
0000008 0x0c45b752 in -[WOChildComponentReference appendToResponse:inContext:] (self=0x7d4a59c8, _cmd=0x210d2ad8, _response=0x7f14a988, _ctx=0x85907408) at WOChildComponentReference.m:189
0000009 0x010f7753 in -[WETabItem _appendBodyToResponse:inContext:activeKey:key:] (self=0x89422b08, _cmd=0x210d2b08, _response=0x7f14a988, _ctx=0x85907408, tmp=0x7c914588, k=0x846eae48) at WETabItem.m:354
0000010 0x010f7c85 in -[WETabItem appendToResponse:inContext:] (self=0x89422b08, _cmd=0x2a4f2610, _response=0x7f14a988, _ctx=0x85907408) at WETabItem.m:419
0000011 0x0a5007b2 in -[SkySimpleTabItem appendToResponse:inContext:] (self=0x7d4a5e08, _cmd=0x2c433ef8, _response=0x7f14a988, _ctx=0x85907408) at SkySimpleTabItem.m:113
TagsNo tags attached.

Activities

2011-07-29 05:01

 

patch-sope-appserver_NGObjWeb_Associations_WOKeyPathAssociation_m (830 bytes)
$OpenBSD$
--- sope-appserver/NGObjWeb/Associations/WOKeyPathAssociation.m.orig	Thu Jul 28 14:21:39 2011
+++ sope-appserver/NGObjWeb/Associations/WOKeyPathAssociation.m	Thu Jul 28 20:13:04 2011
@@ -960,7 +964,17 @@ static BOOL _setValue(WOKeyPathAssociation *self, id _
   // we do not check the return value, because a set is allowed to fail
   // (in SOPE ;-) [if there is no accessor, a backsync is just ignored]
 #if 1
-  _setValue(self, _value, _component);
+  NS_DURING
+  {
+    _setValue(self, _value, _component);
+  }
+  NS_HANDLER
+  {
+    if ([[localException name] isEqualToString: @""])
+    [self logWithFormat:@"could not set value %@ component %@",
+	_value, _component];
+  }
+  NS_ENDHANDLER
 #else
   if (!_setValue(self, _value, _component)) {
     [self logWithFormat:@"could not set value %@ component %@",
buzzdee

buzzdee

2011-07-29 06:02

reporter   ~0002756

Another approach is to implement the missing KVC as a category to NSDictionary.
As Pointed out by Sergey Golovin, who initially created a patch for it for the "old" SOPE gnustep branch for OGo, see the old bug report here:

http://bugzilla.opengroupware.org/bugzilla/show_bug.cgi?id=1990

Both approaches tested and work fine with OGo.

2011-07-29 06:02

 

fix-for-OGo-otherwise-running-into-explicit-exception.diff (3,417 bytes)
$OpenBSD$
--- sope-core/NGExtensions/FdExt.subproj/GNUmakefile.orig	Fri Jul 29 11:38:47 2011
+++ sope-core/NGExtensions/FdExt.subproj/GNUmakefile	Fri Jul 29 11:38:27 2011
@@ -15,6 +15,7 @@ FdExt_OBJC_FILES = \
 	NSCalendarDate+matrix.m		\
 	NSData+gzip.m			\
 	NSData+misc.m			\
+	NSDictionary+KVC.m		\
 	NSDictionary+misc.m		\
 	NSEnumerator+misc.m		\
 	NSException+misc.m		\
$OpenBSD$
--- sope-core/NGExtensions/FdExt.subproj/NSDictionary+KVC.m.orig	Fri Jul 29 11:36:55 2011
+++ sope-core/NGExtensions/FdExt.subproj/NSDictionary+KVC.m	Fri Jul 29 11:36:55 2011
@@ -0,0 +1,57 @@
+/*
+  Copyright (C) 2000-2008 SKYRIX Software AG
+
+  This file is part of SOPE.
+
+  SOPE is free software; you can redistribute it and/or modify it under
+  the terms of the GNU Lesser General Public License as published by the
+  Free Software Foundation; either version 2, or (at your option) any
+  later version.
+
+  SOPE is distributed in the hope that it will be useful, but WITHOUT ANY
+  WARRANTY; without even the implied warranty of MERCHANTABILITY or
+  FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+  License for more details.
+
+  You should have received a copy of the GNU Lesser General Public
+  License along with SOPE; see the file COPYING.  If not, write to the
+  Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+  02111-1307, USA.
+*/
+
+#if GNUSTEP_BASE_LIBRARY
+
+#import "common.h"
+#import "NSDictionary+KVC.h"
+
+@implementation NSDictionary(KVC)
+
+// TODO: it should be addressed to gnustep-base
+
+- (id)valueForUndefinedKey:(NSString *)key
+{
+  return nil;
+}
+
+- (id)handleQueryWithUnboundKey:(NSString *)key
+{
+  return nil;
+}
+
+- (void)setValue:(id)value forUndefinedKey:(NSString *)key
+{
+  return;
+}
+
+- (void)handleTakeValue:(id)value forUnboundKey:(NSString *)key
+{
+  return;
+}
+
+@end /* NSDictionary(KVC) */
+
+void __link_NSDictionary_KVC() {
+  __link_NSDictionary_KVC();
+}
+
+#endif
$OpenBSD$
--- sope-core/NGExtensions/NGExtensions/NSDictionary+KVC.h.orig	Fri Jul 29 11:36:55 2011
+++ sope-core/NGExtensions/NGExtensions/NSDictionary+KVC.h	Fri Jul 29 11:36:55 2011
@@ -0,0 +1,39 @@
+/*
+  Copyright (C) 2000-2008 SKYRIX Software AG
+
+  This file is part of SOPE.
+
+  SOPE is free software; you can redistribute it and/or modify it under
+  the terms of the GNU Lesser General Public License as published by the
+  Free Software Foundation; either version 2, or (at your option) any
+  later version.
+
+  SOPE is distributed in the hope that it will be useful, but WITHOUT ANY
+  WARRANTY; without even the implied warranty of MERCHANTABILITY or
+  FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+  License for more details.
+
+  You should have received a copy of the GNU Lesser General Public
+  License along with SOPE; see the file COPYING.  If not, write to the
+  Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+  02111-1307, USA.
+*/
+
+#ifndef __NGExtensions_NSDictionary_KVC_H__
+#define __NGExtensions_NSDictionary_KVC_H__
+
+#import <Foundation/NSDictionary.h>
+
+@interface NSDictionary(KVC)
+
+- (id)valueForUndefinedKey:(NSString *)key;
+
+- (id)handleQueryWithUnboundKey:(NSString *)key;
+
+- (void)setValue:(id)value forUndefinedKey:(NSString *)key;
+
+- (void)handleTakeValue:(id)value forUnboundKey:(NSString *)key;
+
+@end
+
+#endif /* __NGExtensions_NSDictionary_KVC_H__ */
ludovic

ludovic

2011-07-29 08:53

administrator   ~0002762

I guest the second approach is faster than the first one.
buzzdee

buzzdee

2011-07-29 09:00

reporter   ~0002763

Yes, I did not measured any timings, nor felt any difference when using the web interface, but I guess you are generally right.
buzzdee

buzzdee

2011-10-05 05:56

reporter   ~0002866

Could the second patch be added to SOPE?
ludovic

ludovic

2011-10-05 09:16

administrator   ~0002868

Added, see: http://mtn.inverse.ca/revision/diff/1ae4b707df5b49bc1f28f570464f1da33b5590e0/with/b0432fdb98b2862ae32a89856985a7f182a91efc

Issue History

Date Modified Username Field Change
2011-07-29 05:01 buzzdee New Issue
2011-07-29 05:01 buzzdee File Added: patch-sope-appserver_NGObjWeb_Associations_WOKeyPathAssociation_m
2011-07-29 06:02 buzzdee Note Added: 0002756
2011-07-29 06:02 buzzdee File Added: fix-for-OGo-otherwise-running-into-explicit-exception.diff
2011-07-29 08:53 ludovic Note Added: 0002762
2011-07-29 09:00 buzzdee Note Added: 0002763
2011-10-05 05:56 buzzdee Note Added: 0002866
2011-10-05 09:16 ludovic Note Added: 0002868
2011-10-05 09:16 ludovic Status new => closed
2011-10-05 09:16 ludovic Resolution open => fixed
2011-10-05 09:16 ludovic Fixed in Version => 1.3.9