Le Thu, Oct 28, 2021 at 01:18:33PM +0200, Marcus MERIGHI a écrit :
> Hello!
> 
> This is just a heads-up for fellow SOGo users and a plea to 
> @landry: would you mind sharing your new gnustep/sogo packages?
> 
> After upgrading to OpenBSD 7.0 with the updates to:
> 
> -sogo-5.0.1p0        web based groupware server
> +sogo-5.2.0          web based groupware server
> -gnustep-base-1.27.0p0 GNUstep base library
> +gnustep-base-1.28.0p1 GNUstep base library
> 
> I experience a symptom of "you can create events but you cannot change
> them". Clients are DAVx5 for android and caldavsynchronizer for
> Outlook/Windows10. DAV access with e.g. cadaver(1) works.
> 
> While chasing the cause I soon found I'm not the first to do so, thank
> you, landry@, for beeing quicker:
> 
> SOGo bug report by landry@
> https://www.sogo.nu/bugs/view.php?id=5416
> 
> Gnustep bug report by landry@
> https://github.com/gnustep/libs-base/issues/212
> 
> The commit landry@ reverted to get www/sogo to a working state:
> https://github.com/gnustep/libs-base/commit/bd5f2909e6edc8012a0a6e44ea1402dfbe1353a4

I havent tested access with DAVx5 or anything else, only from
thunderbird/lightning. But if it's the same bug and reverting the commit
fixes it for you too, please add your voice to the sogo/gnustep bug
reports..

I use the attached diff on 7.0-stable, there's an (unsigned) package at
https://packages.rhaalovely.net/7.0/amd64/

Landry
Index: Makefile
===================================================================
RCS file: /cvs/ports/x11/gnustep/base/Makefile,v
retrieving revision 1.81
diff -u -r1.81 Makefile
--- Makefile    3 Sep 2021 11:47:42 -0000       1.81
+++ Makefile    26 Oct 2021 14:50:55 -0000
@@ -3,7 +3,7 @@
 COMMENT=       GNUstep base library
 
 DISTNAME=      gnustep-base-1.28.0
-REVISION=      1
+REVISION=      2
 
 SHARED_LIBS=   gnustep-base 10.4
 CATEGORIES=    devel
Index: patches/patch-Headers_Foundation_NSString_h
===================================================================
RCS file: patches/patch-Headers_Foundation_NSString_h
diff -N patches/patch-Headers_Foundation_NSString_h
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ patches/patch-Headers_Foundation_NSString_h 26 Oct 2021 14:50:55 -0000
@@ -0,0 +1,19 @@
+$OpenBSD$
+
+Revert 
https://github.com/gnustep/libs-base/commit/bd5f2909e6edc8012a0a6e44ea1402dfbe1353a4
+https://github.com/gnustep/libs-base/issues/212
+
+Index: Headers/Foundation/NSString.h
+--- Headers/Foundation/NSString.h.orig
++++ Headers/Foundation/NSString.h
+@@ -482,10 +482,6 @@ GS_EXPORT_CLASS
+ // Working With Encodings
+ - (BOOL) canBeConvertedToEncoding: (NSStringEncoding)encoding;
+ - (NSData*) dataUsingEncoding: (NSStringEncoding)encoding;
+-/** Conversion to an encoding where byte order matters but is not specified
+- * (NSUnicodeStringEncoding, NSUTF16StringEncoding, NSUTF32StringEncoding)
+- * produces data with a Byte Order Marker (BOM) at the start of the data.
+- */
+ - (NSData*) dataUsingEncoding: (NSStringEncoding)encoding
+        allowLossyConversion: (BOOL)flag;
+ + (NSStringEncoding) defaultCStringEncoding;
Index: patches/patch-Source_GSString_m
===================================================================
RCS file: patches/patch-Source_GSString_m
diff -N patches/patch-Source_GSString_m
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ patches/patch-Source_GSString_m     26 Oct 2021 14:50:55 -0000
@@ -0,0 +1,196 @@
+$OpenBSD$
+
+Revert 
https://github.com/gnustep/libs-base/commit/bd5f2909e6edc8012a0a6e44ea1402dfbe1353a4
+https://github.com/gnustep/libs-base/issues/212
+
+Index: Source/GSString.m
+--- Source/GSString.m.orig
++++ Source/GSString.m
+@@ -2379,6 +2379,133 @@ cStringLength_u(GSStr self, NSStringEncoding enc)
+     }
+ }
+ 
++static inline NSData*
++dataUsingEncoding_c(GSStr self, NSStringEncoding encoding, BOOL lossy)
++{
++  unsigned    len = self->_count;
++
++  if (len == 0)
++    {
++      return [NSDataClass data];
++    }
++
++  if ((encoding == internalEncoding)
++    || ((internalEncoding == NSASCIIStringEncoding)
++      && (encoding == NSUTF8StringEncoding || isByteEncoding(encoding))))
++    {
++      unsigned char *buff;
++
++      buff = (unsigned char*)NSZoneMalloc(NSDefaultMallocZone(), len);
++      memcpy(buff, self->_contents.c, len);
++      return [NSDataClass dataWithBytesNoCopy: buff length: len];
++    }
++  else if (encoding == NSUnicodeStringEncoding)
++    {
++      unsigned int    l = 0;
++      unichar         *r = 0;
++      unsigned int    options = GSUniBOM;
++
++      if (lossy == NO)
++      {
++        options |= GSUniStrict;
++      }
++
++      if (GSToUnicode(&r, &l, self->_contents.c, self->_count, 
internalEncoding,
++      NSDefaultMallocZone(), options) == NO)
++      {
++        return nil;
++      }
++      return [NSDataClass dataWithBytesNoCopy: r length: l * sizeof(unichar)];
++    }
++  else
++    {
++      unichar         *u = 0;
++      unsigned                l = 0;
++      unsigned char   *r = 0;
++      unsigned                s = 0;
++
++      if (GSToUnicode(&u, &l, self->_contents.c, self->_count, 
internalEncoding,
++      NSDefaultMallocZone(), 0) == NO)
++      {
++        [NSException raise: NSCharacterConversionException
++                    format: @"Can't convert to Unicode string."];
++      }
++      if (GSFromUnicode(&r, &s, u, l, encoding, NSDefaultMallocZone(),
++      (lossy == NO) ? GSUniStrict : 0) == NO)
++      {
++        NSZoneFree(NSDefaultMallocZone(), u);
++        return nil;
++      }
++      NSZoneFree(NSDefaultMallocZone(), u);
++      return [NSDataClass dataWithBytesNoCopy: r length: s];
++    }
++}
++
++static inline NSData*
++dataUsingEncoding_u(GSStr self, NSStringEncoding encoding, BOOL lossy)
++{
++  unsigned    len = self->_count;
++
++  if (len == 0)
++    {
++      return [NSDataClass data];
++    }
++
++  if (encoding == NSUnicodeStringEncoding)
++    {
++      unichar *buff;
++      unsigned        l;
++      unsigned        from = 0;
++      unsigned        to = 1;
++
++      if ((l = GSUnicode(self->_contents.u, len, 0, 0)) != len)
++        {
++        if (lossy == NO)
++          {
++            return nil;
++          }
++      }
++      buff = (unichar*)NSZoneMalloc(NSDefaultMallocZone(),
++      sizeof(unichar)*(len+1));
++      buff[0] = 0xFEFF;
++
++      while (len > 0)
++        {
++        if (l > 0)
++          {
++            memcpy(buff + to, self->_contents.u + from, sizeof(unichar)*l);
++            from += l;
++            to += l;
++            len -= l;
++          }
++        if (len > 0)
++          {
++            // A bad character in the string ... skip it.
++            if (--len > 0)
++              {
++                // Not at end ... try another batch.
++                from++;
++                l = GSUnicode(self->_contents.u + from, len, 0, 0);
++              }
++          }
++      }
++      return [NSDataClass dataWithBytesNoCopy: buff
++                                     length: sizeof(unichar)*to];
++    }
++  else
++    {
++      unsigned char   *r = 0;
++      unsigned int    l = 0;
++
++      if (GSFromUnicode(&r, &l, self->_contents.u, self->_count, encoding,
++      NSDefaultMallocZone(), (lossy == NO) ? GSUniStrict : 0) == NO)
++      {
++        return nil;
++      }
++      return [NSDataClass dataWithBytesNoCopy: r length: l];
++    }
++}
++
+ static inline void
+ fillHole(GSStr self, unsigned index, unsigned size)
+ {
+@@ -3703,6 +3830,12 @@ agree, create a new GSCInlineString otherwise.
+   return cStringLength_c((GSStr)self, externalEncoding);
+ }
+ 
++- (NSData*) dataUsingEncoding: (NSStringEncoding)encoding
++       allowLossyConversion: (BOOL)flag
++{
++  return dataUsingEncoding_c((GSStr)self, encoding, flag);
++}
++
+ - (void) encodeWithCoder: (NSCoder*)aCoder
+ {
+   if ([aCoder allowsKeyedCoding])
+@@ -4063,6 +4196,12 @@ agree, create a new GSCInlineString otherwise.
+   return cStringLength_u((GSStr)self, externalEncoding);
+ }
+ 
++- (NSData*) dataUsingEncoding: (NSStringEncoding)encoding
++       allowLossyConversion: (BOOL)flag
++{
++  return dataUsingEncoding_u((GSStr)self, encoding, flag);
++}
++
+ - (void) encodeWithCoder: (NSCoder*)aCoder
+ {
+   if ([aCoder allowsKeyedCoding])
+@@ -4551,6 +4690,15 @@ agree, create a new GSUInlineString otherwise.
+     return cStringLength_c((GSStr)self, externalEncoding);
+ }
+ 
++- (NSData*) dataUsingEncoding: (NSStringEncoding)encoding
++       allowLossyConversion: (BOOL)flag
++{
++  if (_flags.wide == 1)
++    return dataUsingEncoding_u((GSStr)self, encoding, flag);
++  else
++    return dataUsingEncoding_c((GSStr)self, encoding, flag);
++}
++
+ - (void) dealloc
+ {
+   if (_contents.c != 0)
+@@ -5680,6 +5828,11 @@ literalIsEqual(NXConstantString *self, id anObject)
+   BOOL                ascii;
+   BOOL                latin1;
+   unsigned    length;
++
++  if (0 == nxcslen)
++    {
++      return [NSDataClass data];
++    }
+ 
+   /* Check what is actually in this string ... if it's corrupt an exception
+    * is raised.
Index: patches/patch-Source_NSString_m
===================================================================
RCS file: patches/patch-Source_NSString_m
diff -N patches/patch-Source_NSString_m
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ patches/patch-Source_NSString_m     26 Oct 2021 14:50:55 -0000
@@ -0,0 +1,78 @@
+$OpenBSD$
+
+Revert 
https://github.com/gnustep/libs-base/commit/bd5f2909e6edc8012a0a6e44ea1402dfbe1353a4
+https://github.com/gnustep/libs-base/issues/212
+
+Index: Source/NSString.m
+--- Source/NSString.m.orig
++++ Source/NSString.m
+@@ -4126,22 +4126,30 @@ GSICUCollatorOpen(NSStringCompareOptions mask, NSLocal
+   unsigned    len = [self length];
+   NSData      *d;
+ 
+-  if (NSUnicodeStringEncoding == encoding)
++  if (len == 0)
+     {
++      d = [NSDataClass data];
++    }
++  else if (encoding == NSUnicodeStringEncoding)
++    {
+       unichar *u;
+       unsigned        l;
+ 
+-      /* Fast path for Unicode (UTF16) without a specific byte order,
+-       * where we must prepend a byte order mark.
+-       * The case for UTF32 is handled in the slower branch.
+-       */
+       u = (unichar*)NSZoneMalloc(NSDefaultMallocZone(),
+       (len + 1) * sizeof(unichar));
+       *u = byteOrderMark;
+       [self getCharacters: u + 1];
+       l = GSUnicode(u, len, 0, 0);
+-      d = [NSDataClass dataWithBytesNoCopy: u
+-                                  length: (l + 1) * sizeof(unichar)];
++      if (l == len || flag == YES)
++      {
++        d = [NSDataClass dataWithBytesNoCopy: u
++                                      length: (l + 1) * sizeof(unichar)];
++      }
++      else
++      {
++        d = nil;
++        NSZoneFree(NSDefaultMallocZone(), u);
++      }
+     }
+   else
+     {
+@@ -4156,28 +4164,11 @@ GSICUCollatorOpen(NSStringCompareOptions mask, NSLocal
+        * We can then use our concrete subclass implementation to do the
+        * work of converting to the desired encoding.
+        */
+-      if (NSUTF32StringEncoding == encoding)
++      if (len >= 4096)
+       {
+-        /* For UTF32 without byte order specified, we must include a
+-         * BOM at the start of the data.
+-         */
+-        len++;
+-        if (len >= 4096)
+-          {
+-            u = NSZoneMalloc(NSDefaultMallocZone(), len * sizeof(unichar));
+-          }
+-        *u = byteOrderMark;
+-        [self getCharacters: u+1];
++        u = NSZoneMalloc(NSDefaultMallocZone(), len * sizeof(unichar));
+       }
+-      else
+-      {
+-        if (len >= 4096)
+-          {
+-            u = NSZoneMalloc(NSDefaultMallocZone(), len * sizeof(unichar));
+-          }
+-        [self getCharacters: u];
+-      }
+-
++      [self getCharacters: u];
+       if (flag == NO)
+         {
+         options = GSUniStrict;

Reply via email to