unofficial mirror of guix-patches@gnu.org 
 help / color / mirror / code / Atom feed
* bug#26462: Fix crashes in programs using system ICU
@ 2017-04-12 10:48 Clément Lassieur
  2017-04-12 10:53 ` bug#26462: [PATCH 1/2] gnu: icu4c: " Clément Lassieur
                   ` (2 more replies)
  0 siblings, 3 replies; 18+ messages in thread
From: Clément Lassieur @ 2017-04-12 10:48 UTC (permalink / raw)
  To: 26462

The first patch fixes system ICU.  This allows Icecat to use system ICU
without crashing, and it also fixes crashes in 0ad, which I'm working
on.

^ permalink raw reply	[flat|nested] 18+ messages in thread

* bug#26462: [PATCH 1/2] gnu: icu4c: Fix crashes in programs using system ICU.
  2017-04-12 10:48 bug#26462: Fix crashes in programs using system ICU Clément Lassieur
@ 2017-04-12 10:53 ` Clément Lassieur
  2017-04-12 10:53   ` bug#26462: [PATCH 2/2] gnu: icecat: Use " Clément Lassieur
  2017-04-12 11:51   ` bug#26462: [PATCH 1/2] gnu: icu4c: Fix crashes in programs using " Ludovic Courtès
  2017-04-12 10:55 ` bug#26462: " Clément Lassieur
  2017-04-12 11:22 ` ng0
  2 siblings, 2 replies; 18+ messages in thread
From: Clément Lassieur @ 2017-04-12 10:53 UTC (permalink / raw)
  To: 26462

* gnu/packages/patches/icu4c-reset-keyword-list-iterator.patch: New file.
* gnu/local.mk (dist_patch_DATA): Add it.
* gnu/packages/icu4c.scm (icu4c)[source]: Use it.
---
 gnu/local.mk                                       |   1 +
 gnu/packages/icu4c.scm                             |   5 +-
 .../icu4c-reset-keyword-list-iterator.patch        | 128 +++++++++++++++++++++
 3 files changed, 133 insertions(+), 1 deletion(-)
 create mode 100644 gnu/packages/patches/icu4c-reset-keyword-list-iterator.patch

diff --git a/gnu/local.mk b/gnu/local.mk
index 98dffff64..a6f3448a2 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -658,6 +658,7 @@ dist_patch_DATA =						\
   %D%/packages/patches/icu4c-CVE-2014-6585.patch		\
   %D%/packages/patches/icu4c-CVE-2015-1270.patch		\
   %D%/packages/patches/icu4c-CVE-2015-4760.patch		\
+  %D%/packages/patches/icu4c-reset-keyword-list-iterator.patch	\
   %D%/packages/patches/id3lib-CVE-2007-4460.patch			\
   %D%/packages/patches/ilmbase-fix-tests.patch			\
   %D%/packages/patches/isl-0.11.1-aarch64-support.patch	\
diff --git a/gnu/packages/icu4c.scm b/gnu/packages/icu4c.scm
index d842f03b4..3283811a0 100644
--- a/gnu/packages/icu4c.scm
+++ b/gnu/packages/icu4c.scm
@@ -2,6 +2,7 @@
 ;;; Copyright © 2013 Andreas Enge <andreas@enge.fr>
 ;;; Copyright © 2015, 2016 Mark H Weaver <mhw@netris.org>
 ;;; Copyright © 2016 Efraim Flashner <efraim@flashner.co.il>
+;;; Copyright © 2017 Clément Lassieur <clement@lassieur.org>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -39,7 +40,9 @@
                   (string-map (lambda (x) (if (char=? x #\.) #\_ x)) version)
                   "-src.tgz"))
             (sha256
-             (base32 "036shcb3f8bm1lynhlsb4kpjm9s9c2vdiir01vg216rs2l8482ib"))))
+             (base32 "036shcb3f8bm1lynhlsb4kpjm9s9c2vdiir01vg216rs2l8482ib"))
+            (patches
+             (search-patches "icu4c-reset-keyword-list-iterator.patch"))))
    (build-system gnu-build-system)
    (inputs
     `(("perl" ,perl)))
diff --git a/gnu/packages/patches/icu4c-reset-keyword-list-iterator.patch b/gnu/packages/patches/icu4c-reset-keyword-list-iterator.patch
new file mode 100644
index 000000000..ddedc56de
--- /dev/null
+++ b/gnu/packages/patches/icu4c-reset-keyword-list-iterator.patch
@@ -0,0 +1,128 @@
+Copied from upstream: http://bugs.icu-project.org/trac/changeset/39484/.
+
+Paths and line endings have been adapted.
+
+Index: icu/source/common/ulist.c
+===================================================================
+--- icu/source/common/ulist.c	(revision 39483)
++++ icu/source/common/ulist.c	(revision 39484)
+@@ -30,5 +30,4 @@
+     
+     int32_t size;
+-    int32_t currentIndex;
+ };
+ 
+@@ -52,5 +51,4 @@
+     newList->tail = NULL;
+     newList->size = 0;
+-    newList->currentIndex = -1;
+     
+     return newList;
+@@ -81,6 +79,7 @@
+         p->next->previous = p->previous;
+     }
+-    list->curr = NULL;
+-    list->currentIndex = 0;
++    if (p == list->curr) {
++        list->curr = p->next;
++    }
+     --list->size;
+     if (p->forceDelete) {
+@@ -151,5 +150,4 @@
+         list->head->previous = newItem;
+         list->head = newItem;
+-        list->currentIndex++;
+     }
+     
+@@ -194,5 +192,4 @@
+     curr = list->curr;
+     list->curr = curr->next;
+-    list->currentIndex++;
+     
+     return curr->data;
+@@ -210,5 +207,4 @@
+     if (list != NULL) {
+         list->curr = list->head;
+-        list->currentIndex = 0;
+     }
+ }
+@@ -273,3 +269,2 @@
+     return (UList *)(en->context);
+ }
+-
+Index: icu/source/i18n/ucol_res.cpp
+===================================================================
+--- icu/source/i18n/ucol_res.cpp	(revision 39483)
++++ icu/source/i18n/ucol_res.cpp	(revision 39484)
+@@ -681,4 +681,5 @@
+     }
+     memcpy(en, &defaultKeywordValues, sizeof(UEnumeration));
++    ulist_resetList(sink.values);  // Initialize the iterator.
+     en->context = sink.values;
+     sink.values = NULL;  // Avoid deletion in the sink destructor.
+Index: icu/source/test/intltest/apicoll.cpp
+===================================================================
+--- icu/source/test/intltest/apicoll.cpp	(revision 39483)
++++ icu/source/test/intltest/apicoll.cpp	(revision 39484)
+@@ -82,14 +82,7 @@
+     col = Collator::createInstance(Locale::getEnglish(), success);
+     if (U_FAILURE(success)){
+-        errcheckln(success, "Default Collator creation failed. - %s", u_errorName(success));
+-        return;
+-    }
+-
+-    StringEnumeration* kwEnum = col->getKeywordValuesForLocale("", Locale::getEnglish(),true,success);
+-    if (U_FAILURE(success)){
+-        errcheckln(success, "Get Keyword Values for Locale failed. - %s", u_errorName(success));
+-        return;
+-    }
+-    delete kwEnum;
++        errcheckln(success, "English Collator creation failed. - %s", u_errorName(success));
++        return;
++    }
+ 
+     col->getVersion(versionArray);
+@@ -230,4 +223,27 @@
+     delete aFrCol;
+     delete junk;
++}
++
++void CollationAPITest::TestKeywordValues() {
++    IcuTestErrorCode errorCode(*this, "TestKeywordValues");
++    LocalPointer<Collator> col(Collator::createInstance(Locale::getEnglish(), errorCode));
++    if (errorCode.logIfFailureAndReset("English Collator creation failed")) {
++        return;
++    }
++
++    LocalPointer<StringEnumeration> kwEnum(
++        col->getKeywordValuesForLocale("collation", Locale::getEnglish(), TRUE, errorCode));
++    if (errorCode.logIfFailureAndReset("Get Keyword Values for English Collator failed")) {
++        return;
++    }
++    assertTrue("expect at least one collation tailoring for English", kwEnum->count(errorCode) > 0);
++    const char *kw;
++    UBool hasStandard = FALSE;
++    while ((kw = kwEnum->next(NULL, errorCode)) != NULL) {
++        if (strcmp(kw, "standard") == 0) {
++            hasStandard = TRUE;
++        }
++    }
++    assertTrue("expect at least the 'standard' collation tailoring for English", hasStandard);
+ }
+ 
+@@ -2467,4 +2483,5 @@
+     TESTCASE_AUTO_BEGIN;
+     TESTCASE_AUTO(TestProperty);
++    TESTCASE_AUTO(TestKeywordValues);
+     TESTCASE_AUTO(TestOperators);
+     TESTCASE_AUTO(TestDuplicate);
+Index: icu/source/test/intltest/apicoll.h
+===================================================================
+--- icu/source/test/intltest/apicoll.h	(revision 39483)
++++ icu/source/test/intltest/apicoll.h	(revision 39484)
+@@ -36,4 +36,5 @@
+      */
+     void TestProperty(/* char* par */);
++    void TestKeywordValues();
+ 
+     /**
-- 
2.12.2

^ permalink raw reply related	[flat|nested] 18+ messages in thread

* bug#26462: [PATCH 2/2] gnu: icecat: Use system ICU.
  2017-04-12 10:53 ` bug#26462: [PATCH 1/2] gnu: icu4c: " Clément Lassieur
@ 2017-04-12 10:53   ` Clément Lassieur
  2017-04-12 11:51   ` bug#26462: [PATCH 1/2] gnu: icu4c: Fix crashes in programs using " Ludovic Courtès
  1 sibling, 0 replies; 18+ messages in thread
From: Clément Lassieur @ 2017-04-12 10:53 UTC (permalink / raw)
  To: 26462

* gnu/packages/gnuzilla.scm (icecat)[arguments] <#:configure-flags>: Remove
comment for "--with-system-icu".
---
 gnu/packages/gnuzilla.scm | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)

diff --git a/gnu/packages/gnuzilla.scm b/gnu/packages/gnuzilla.scm
index 4a2e784ee..a6c1a07cf 100644
--- a/gnu/packages/gnuzilla.scm
+++ b/gnu/packages/gnuzilla.scm
@@ -509,11 +509,7 @@ standards.")
                            "--with-system-jpeg"        ; must be libjpeg-turbo
                            "--with-system-libevent"
                            "--with-system-libvpx"
-
-                           ;; FIXME: It is preferable to build with system
-                           ;; libraries, but this fixes crashes.
-                           ;; "--with-system-icu"
-
+                           "--with-system-icu"
                            "--with-system-nspr"
                            "--with-system-nss"
                            "--enable-system-pixman"
-- 
2.12.2

^ permalink raw reply related	[flat|nested] 18+ messages in thread

* bug#26462: Fix crashes in programs using system ICU
  2017-04-12 10:48 bug#26462: Fix crashes in programs using system ICU Clément Lassieur
  2017-04-12 10:53 ` bug#26462: [PATCH 1/2] gnu: icu4c: " Clément Lassieur
@ 2017-04-12 10:55 ` Clément Lassieur
  2017-04-12 11:22 ` ng0
  2 siblings, 0 replies; 18+ messages in thread
From: Clément Lassieur @ 2017-04-12 10:55 UTC (permalink / raw)
  To: 26462

Clément Lassieur <clement@lassieur.org> writes:

> The first patch fixes system ICU.  This allows Icecat to use system ICU
> without crashing, and it also fixes crashes in 0ad, which I'm working
> on.

They should probably be applied to core-updates.

^ permalink raw reply	[flat|nested] 18+ messages in thread

* bug#26462: Fix crashes in programs using system ICU
  2017-04-12 10:48 bug#26462: Fix crashes in programs using system ICU Clément Lassieur
  2017-04-12 10:53 ` bug#26462: [PATCH 1/2] gnu: icu4c: " Clément Lassieur
  2017-04-12 10:55 ` bug#26462: " Clément Lassieur
@ 2017-04-12 11:22 ` ng0
  2017-04-12 11:31   ` Clément Lassieur
  2 siblings, 1 reply; 18+ messages in thread
From: ng0 @ 2017-04-12 11:22 UTC (permalink / raw)
  To: Clément Lassieur; +Cc: 26462

Clément Lassieur transcribed 0.1K bytes:
> The first patch fixes system ICU.  This allows Icecat to use system ICU

Cool :)

> without crashing, and it also fixes crashes in 0ad, which I'm working
> on.
> 
> 
> 
Woooo. You picked up my 0ad work (or started from scratch)? I was stuck on mozjs38 for an eternity
and gave up.
Do you need further help or something? I unpublished the repo this was
in, so the last progress isn't public.
-- 
PGP and more: https://people.pragmatique.xyz/ng0/

^ permalink raw reply	[flat|nested] 18+ messages in thread

* bug#26462: Fix crashes in programs using system ICU
  2017-04-12 11:22 ` ng0
@ 2017-04-12 11:31   ` Clément Lassieur
  2017-04-12 11:42     ` Clément Lassieur
  2017-04-12 11:47     ` ng0
  0 siblings, 2 replies; 18+ messages in thread
From: Clément Lassieur @ 2017-04-12 11:31 UTC (permalink / raw)
  To: ng0; +Cc: 26462

ng0 <contact.ng0@cryptolab.net> writes:

> Clément Lassieur transcribed 0.1K bytes:
>> The first patch fixes system ICU.  This allows Icecat to use system ICU
>
> Cool :)
>
>> without crashing, and it also fixes crashes in 0ad, which I'm working
>> on.
>> 
>> 
>> 
> Woooo. You picked up my 0ad work (or started from scratch)? I was stuck on mozjs38 for an eternity
> and gave up.
> Do you need further help or something? I unpublished the repo this was
> in, so the last progress isn't public.

:-) I picked up your work, of course.  The mozjs issue is fixed (a patch
that was applied to the bundled mozjs had to be applied to the system
mozjs we use), and with this ICU patch, I can play!  I just played for
5min without a problem.  I just need to cleanup things, to package NVTT
(did you do it?), and then I can send the patch.

^ permalink raw reply	[flat|nested] 18+ messages in thread

* bug#26462: Fix crashes in programs using system ICU
  2017-04-12 11:31   ` Clément Lassieur
@ 2017-04-12 11:42     ` Clément Lassieur
  2017-04-12 11:53       ` ng0
  2017-04-12 11:47     ` ng0
  1 sibling, 1 reply; 18+ messages in thread
From: Clément Lassieur @ 2017-04-12 11:42 UTC (permalink / raw)
  To: ng0; +Cc: 26462

Clément Lassieur <clement@lassieur.org> writes:

> ng0 <contact.ng0@cryptolab.net> writes:
>
>> Clément Lassieur transcribed 0.1K bytes:
>>> The first patch fixes system ICU.  This allows Icecat to use system ICU
>>
>> Cool :)
>>
>>> without crashing, and it also fixes crashes in 0ad, which I'm working
>>> on.
>>> 
>>> 
>>> 
>> Woooo. You picked up my 0ad work (or started from scratch)? I was stuck on mozjs38 for an eternity
>> and gave up.
>> Do you need further help or something? I unpublished the repo this was
>> in, so the last progress isn't public.

I'd like to have a look at your unpublished work, if this is possible.
:-)

> :-) I picked up your work, of course.  The mozjs issue is fixed (a patch
> that was applied to the bundled mozjs had to be applied to the system
> mozjs we use), and with this ICU patch, I can play!  I just played for
> 5min without a problem.  I just need to cleanup things, to package NVTT
> (did you do it?), and then I can send the patch.

^ permalink raw reply	[flat|nested] 18+ messages in thread

* bug#26462: Fix crashes in programs using system ICU
  2017-04-12 11:31   ` Clément Lassieur
  2017-04-12 11:42     ` Clément Lassieur
@ 2017-04-12 11:47     ` ng0
  2017-04-13 23:01       ` Clément Lassieur
  1 sibling, 1 reply; 18+ messages in thread
From: ng0 @ 2017-04-12 11:47 UTC (permalink / raw)
  To: Clément Lassieur; +Cc: 26462

Clément Lassieur transcribed 0.8K bytes:
> ng0 <contact.ng0@cryptolab.net> writes:
> 
> > Clément Lassieur transcribed 0.1K bytes:
> >> The first patch fixes system ICU.  This allows Icecat to use system ICU
> >
> > Cool :)
> >
> >> without crashing, and it also fixes crashes in 0ad, which I'm working
> >> on.
> >> 
> >> 
> >> 
> > Woooo. You picked up my 0ad work (or started from scratch)? I was stuck on mozjs38 for an eternity
> > and gave up.
> > Do you need further help or something? I unpublished the repo this was
> > in, so the last progress isn't public.
> 
> :-) I picked up your work, of course.  The mozjs issue is fixed (a patch
> that was applied to the bundled mozjs had to be applied to the system
> mozjs we use), and with this ICU patch, I can play!  I just played for
> 5min without a problem.  I just need to cleanup things, to package NVTT
> (did you do it?), and then I can send the patch.

Wow :) That is so exciting... really. And you only get to add the
package on top of every package list "0" and "a" once :D
I don't want to sound pushy or anything, I don't even know how much I
messed up or not, but it would be cool to mention me as co-authored
depending on the code :)
If you don't do it, it's fine aswell because I'm so happy you picked it up!

No, I left NVTT as "to do". But when I had an github account, I made
Nvidia publish a new release for NVTT. So it's just a matter of
packaging the NVTT dependencies. This should not block the 0ad package
commit in my opinion. As no release happened for a long time - until I requested them to
do so - every project which makes use of NVTT just bundled a working state of NVTT.


-- 
PGP and more: https://people.pragmatique.xyz/ng0/

^ permalink raw reply	[flat|nested] 18+ messages in thread

* bug#26462: [PATCH 1/2] gnu: icu4c: Fix crashes in programs using system ICU.
  2017-04-12 10:53 ` bug#26462: [PATCH 1/2] gnu: icu4c: " Clément Lassieur
  2017-04-12 10:53   ` bug#26462: [PATCH 2/2] gnu: icecat: Use " Clément Lassieur
@ 2017-04-12 11:51   ` Ludovic Courtès
  2017-04-14 14:51     ` bug#26462: [PATCH] " Clément Lassieur
  2017-04-14 14:55     ` bug#26462: [PATCH 1/2] " Clément Lassieur
  1 sibling, 2 replies; 18+ messages in thread
From: Ludovic Courtès @ 2017-04-12 11:51 UTC (permalink / raw)
  To: Clément Lassieur; +Cc: 26462

Clément Lassieur <clement@lassieur.org> skribis:

> * gnu/packages/patches/icu4c-reset-keyword-list-iterator.patch: New file.
> * gnu/local.mk (dist_patch_DATA): Add it.
> * gnu/packages/icu4c.scm (icu4c)[source]: Use it.

[...]

> +++ b/gnu/packages/patches/icu4c-reset-keyword-list-iterator.patch
> @@ -0,0 +1,128 @@
> +Copied from upstream: http://bugs.icu-project.org/trac/changeset/39484/.
> +
> +Paths and line endings have been adapted.

Woow, good catch!

1,700 packages depend on icu4c so the update would have to go to
‘core-updates’, but that won’t be merged until several weeks.

For ‘master’, in the meantime, I see two solutions:

  1. If the bug only affects specific applications, we could add an
     icu4c variant and use that only where needed (icecat, 0ad, etc.).

  2. If the bug manifests itself pervasively we could graft it in
     ‘master’ (I guess it’s ABI-compatible, right?).

Thoughts?

Thank you for addressing it!

Ludo’.

^ permalink raw reply	[flat|nested] 18+ messages in thread

* bug#26462: Fix crashes in programs using system ICU
  2017-04-12 11:42     ` Clément Lassieur
@ 2017-04-12 11:53       ` ng0
  2017-04-13 22:53         ` Clément Lassieur
  0 siblings, 1 reply; 18+ messages in thread
From: ng0 @ 2017-04-12 11:53 UTC (permalink / raw)
  To: Clément Lassieur; +Cc: 26462

Clément Lassieur transcribed 1.0K bytes:
> Clément Lassieur <clement@lassieur.org> writes:
> 
> > ng0 <contact.ng0@cryptolab.net> writes:
> >
> >> Clément Lassieur transcribed 0.1K bytes:
> >>> The first patch fixes system ICU.  This allows Icecat to use system ICU
> >>
> >> Cool :)
> >>
> >>> without crashing, and it also fixes crashes in 0ad, which I'm working
> >>> on.
> >>> 
> >>> 
> >>> 
> >> Woooo. You picked up my 0ad work (or started from scratch)? I was stuck on mozjs38 for an eternity
> >> and gave up.
> >> Do you need further help or something? I unpublished the repo this was
> >> in, so the last progress isn't public.
> 
> I'd like to have a look at your unpublished work, if this is possible.
> :-)

I was wrong. It is published, I just moved the branch into my personal
main repo.
You can find it in the 'package/games/0ad' branch at
https://gitweb.pragmatique.xyz/pragmatique/guix.git/ (which will be
moved within the next few days/weeks to a pagure instance). Naming was
unfortunate, it is my personal "pick this up for inspiration or work" repo :)

> > :-) I picked up your work, of course.  The mozjs issue is fixed (a patch
> > that was applied to the bundled mozjs had to be applied to the system
> > mozjs we use), and with this ICU patch, I can play!  I just played for
> > 5min without a problem.  I just need to cleanup things, to package NVTT
> > (did you do it?), and then I can send the patch.
> 

-- 
PGP and more: https://people.pragmatique.xyz/ng0/

^ permalink raw reply	[flat|nested] 18+ messages in thread

* bug#26462: Fix crashes in programs using system ICU
  2017-04-12 11:53       ` ng0
@ 2017-04-13 22:53         ` Clément Lassieur
  0 siblings, 0 replies; 18+ messages in thread
From: Clément Lassieur @ 2017-04-13 22:53 UTC (permalink / raw)
  To: ng0; +Cc: 26462

ng0 <contact.ng0@cryptolab.net> writes:

> Clément Lassieur transcribed 1.0K bytes:
>
>> I'd like to have a look at your unpublished work, if this is possible.
>> :-)
>>
> I was wrong. It is published, I just moved the branch into my personal
> main repo.
> You can find it in the 'package/games/0ad' branch at
> https://gitweb.pragmatique.xyz/pragmatique/guix.git/ (which will be
> moved within the next few days/weeks to a pagure instance). Naming was
> unfortunate, it is my personal "pick this up for inspiration or work" repo :)

I cloned it.  Thanks!

^ permalink raw reply	[flat|nested] 18+ messages in thread

* bug#26462: Fix crashes in programs using system ICU
  2017-04-12 11:47     ` ng0
@ 2017-04-13 23:01       ` Clément Lassieur
  0 siblings, 0 replies; 18+ messages in thread
From: Clément Lassieur @ 2017-04-13 23:01 UTC (permalink / raw)
  To: ng0; +Cc: 26462

ng0 <contact.ng0@cryptolab.net> writes:
> Clément Lassieur transcribed 0.8K bytes:
>> ng0 <contact.ng0@cryptolab.net> writes:
>> 
>> > Clément Lassieur transcribed 0.1K bytes:
>> >> The first patch fixes system ICU.  This allows Icecat to use system ICU
>> >
>> > Cool :)
>> >
>> >> without crashing, and it also fixes crashes in 0ad, which I'm working
>> >> on.
>> >> 
>> >> 
>> >> 
>> > Woooo. You picked up my 0ad work (or started from scratch)? I was stuck on mozjs38 for an eternity
>> > and gave up.
>> > Do you need further help or something? I unpublished the repo this was
>> > in, so the last progress isn't public.
>> 
>> :-) I picked up your work, of course.  The mozjs issue is fixed (a patch
>> that was applied to the bundled mozjs had to be applied to the system
>> mozjs we use), and with this ICU patch, I can play!  I just played for
>> 5min without a problem.  I just need to cleanup things, to package NVTT
>> (did you do it?), and then I can send the patch.
>
> Wow :) That is so exciting... really. And you only get to add the
> package on top of every package list "0" and "a" once :D

Cool! ;)

> I don't want to sound pushy or anything, I don't even know how much I
> messed up or not, but it would be cool to mention me as co-authored
> depending on the code :)
> If you don't do it, it's fine aswell because I'm so happy you picked it up!

Of course I'll do it!  You did most of the work :)

> No, I left NVTT as "to do". But when I had an github account, I made
> Nvidia publish a new release for NVTT. So it's just a matter of
> packaging the NVTT dependencies. This should not block the 0ad package
> commit in my opinion. As no release happened for a long time - until I requested them to
> do so - every project which makes use of NVTT just bundled a working state of NVTT.

Ok, so I'll let it as is if you think it's fine.

^ permalink raw reply	[flat|nested] 18+ messages in thread

* bug#26462: [PATCH] gnu: icu4c: Fix crashes in programs using system ICU.
  2017-04-12 11:51   ` bug#26462: [PATCH 1/2] gnu: icu4c: Fix crashes in programs using " Ludovic Courtès
@ 2017-04-14 14:51     ` Clément Lassieur
  2017-04-16  9:54       ` Ludovic Courtès
  2017-04-14 14:55     ` bug#26462: [PATCH 1/2] " Clément Lassieur
  1 sibling, 1 reply; 18+ messages in thread
From: Clément Lassieur @ 2017-04-14 14:51 UTC (permalink / raw)
  To: 26462

* gnu/packages/patches/icu4c-reset-keyword-list-iterator.patch: New file.
* gnu/local.mk (dist_patch_DATA): Add it.
* gnu/packages/icu4c.scm (icu4c)[replacement]: New field.
(icu4c/fixed): New variable.
---
 gnu/local.mk                                       |   1 +
 gnu/packages/icu4c.scm                             |  11 ++
 .../icu4c-reset-keyword-list-iterator.patch        | 128 +++++++++++++++++++++
 3 files changed, 140 insertions(+)
 create mode 100644 gnu/packages/patches/icu4c-reset-keyword-list-iterator.patch

diff --git a/gnu/local.mk b/gnu/local.mk
index 82e94171b..a006000a2 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -657,6 +657,7 @@ dist_patch_DATA =						\
   %D%/packages/patches/icu4c-CVE-2014-6585.patch		\
   %D%/packages/patches/icu4c-CVE-2015-1270.patch		\
   %D%/packages/patches/icu4c-CVE-2015-4760.patch		\
+  %D%/packages/patches/icu4c-reset-keyword-list-iterator.patch	\
   %D%/packages/patches/id3lib-CVE-2007-4460.patch			\
   %D%/packages/patches/ilmbase-fix-tests.patch			\
   %D%/packages/patches/isl-0.11.1-aarch64-support.patch	\
diff --git a/gnu/packages/icu4c.scm b/gnu/packages/icu4c.scm
index d842f03b4..2b5144100 100644
--- a/gnu/packages/icu4c.scm
+++ b/gnu/packages/icu4c.scm
@@ -2,6 +2,7 @@
 ;;; Copyright © 2013 Andreas Enge <andreas@enge.fr>
 ;;; Copyright © 2015, 2016 Mark H Weaver <mhw@netris.org>
 ;;; Copyright © 2016 Efraim Flashner <efraim@flashner.co.il>
+;;; Copyright © 2017 Clément Lassieur <clement@lassieur.org>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -30,6 +31,7 @@
   (package
    (name "icu4c")
    (version "58.2")
+   (replacement icu4c/fixed)
    (source (origin
             (method url-fetch)
             (uri (string-append
@@ -63,3 +65,12 @@ globalisation support for software applications.  This package contains the
 C/C++ part.")
    (license x11)
    (home-page "http://site.icu-project.org/")))
+
+(define icu4c/fixed
+  (package
+    (inherit icu4c)
+    (replacement #f)
+    (source (origin
+              (inherit (package-source icu4c))
+              (patches
+               (search-patches "icu4c-reset-keyword-list-iterator.patch"))))))
diff --git a/gnu/packages/patches/icu4c-reset-keyword-list-iterator.patch b/gnu/packages/patches/icu4c-reset-keyword-list-iterator.patch
new file mode 100644
index 000000000..ddedc56de
--- /dev/null
+++ b/gnu/packages/patches/icu4c-reset-keyword-list-iterator.patch
@@ -0,0 +1,128 @@
+Copied from upstream: http://bugs.icu-project.org/trac/changeset/39484/.
+
+Paths and line endings have been adapted.
+
+Index: icu/source/common/ulist.c
+===================================================================
+--- icu/source/common/ulist.c	(revision 39483)
++++ icu/source/common/ulist.c	(revision 39484)
+@@ -30,5 +30,4 @@
+     
+     int32_t size;
+-    int32_t currentIndex;
+ };
+ 
+@@ -52,5 +51,4 @@
+     newList->tail = NULL;
+     newList->size = 0;
+-    newList->currentIndex = -1;
+     
+     return newList;
+@@ -81,6 +79,7 @@
+         p->next->previous = p->previous;
+     }
+-    list->curr = NULL;
+-    list->currentIndex = 0;
++    if (p == list->curr) {
++        list->curr = p->next;
++    }
+     --list->size;
+     if (p->forceDelete) {
+@@ -151,5 +150,4 @@
+         list->head->previous = newItem;
+         list->head = newItem;
+-        list->currentIndex++;
+     }
+     
+@@ -194,5 +192,4 @@
+     curr = list->curr;
+     list->curr = curr->next;
+-    list->currentIndex++;
+     
+     return curr->data;
+@@ -210,5 +207,4 @@
+     if (list != NULL) {
+         list->curr = list->head;
+-        list->currentIndex = 0;
+     }
+ }
+@@ -273,3 +269,2 @@
+     return (UList *)(en->context);
+ }
+-
+Index: icu/source/i18n/ucol_res.cpp
+===================================================================
+--- icu/source/i18n/ucol_res.cpp	(revision 39483)
++++ icu/source/i18n/ucol_res.cpp	(revision 39484)
+@@ -681,4 +681,5 @@
+     }
+     memcpy(en, &defaultKeywordValues, sizeof(UEnumeration));
++    ulist_resetList(sink.values);  // Initialize the iterator.
+     en->context = sink.values;
+     sink.values = NULL;  // Avoid deletion in the sink destructor.
+Index: icu/source/test/intltest/apicoll.cpp
+===================================================================
+--- icu/source/test/intltest/apicoll.cpp	(revision 39483)
++++ icu/source/test/intltest/apicoll.cpp	(revision 39484)
+@@ -82,14 +82,7 @@
+     col = Collator::createInstance(Locale::getEnglish(), success);
+     if (U_FAILURE(success)){
+-        errcheckln(success, "Default Collator creation failed. - %s", u_errorName(success));
+-        return;
+-    }
+-
+-    StringEnumeration* kwEnum = col->getKeywordValuesForLocale("", Locale::getEnglish(),true,success);
+-    if (U_FAILURE(success)){
+-        errcheckln(success, "Get Keyword Values for Locale failed. - %s", u_errorName(success));
+-        return;
+-    }
+-    delete kwEnum;
++        errcheckln(success, "English Collator creation failed. - %s", u_errorName(success));
++        return;
++    }
+ 
+     col->getVersion(versionArray);
+@@ -230,4 +223,27 @@
+     delete aFrCol;
+     delete junk;
++}
++
++void CollationAPITest::TestKeywordValues() {
++    IcuTestErrorCode errorCode(*this, "TestKeywordValues");
++    LocalPointer<Collator> col(Collator::createInstance(Locale::getEnglish(), errorCode));
++    if (errorCode.logIfFailureAndReset("English Collator creation failed")) {
++        return;
++    }
++
++    LocalPointer<StringEnumeration> kwEnum(
++        col->getKeywordValuesForLocale("collation", Locale::getEnglish(), TRUE, errorCode));
++    if (errorCode.logIfFailureAndReset("Get Keyword Values for English Collator failed")) {
++        return;
++    }
++    assertTrue("expect at least one collation tailoring for English", kwEnum->count(errorCode) > 0);
++    const char *kw;
++    UBool hasStandard = FALSE;
++    while ((kw = kwEnum->next(NULL, errorCode)) != NULL) {
++        if (strcmp(kw, "standard") == 0) {
++            hasStandard = TRUE;
++        }
++    }
++    assertTrue("expect at least the 'standard' collation tailoring for English", hasStandard);
+ }
+ 
+@@ -2467,4 +2483,5 @@
+     TESTCASE_AUTO_BEGIN;
+     TESTCASE_AUTO(TestProperty);
++    TESTCASE_AUTO(TestKeywordValues);
+     TESTCASE_AUTO(TestOperators);
+     TESTCASE_AUTO(TestDuplicate);
+Index: icu/source/test/intltest/apicoll.h
+===================================================================
+--- icu/source/test/intltest/apicoll.h	(revision 39483)
++++ icu/source/test/intltest/apicoll.h	(revision 39484)
+@@ -36,4 +36,5 @@
+      */
+     void TestProperty(/* char* par */);
++    void TestKeywordValues();
+ 
+     /**
-- 
2.12.2

^ permalink raw reply related	[flat|nested] 18+ messages in thread

* bug#26462: [PATCH 1/2] gnu: icu4c: Fix crashes in programs using system ICU.
  2017-04-12 11:51   ` bug#26462: [PATCH 1/2] gnu: icu4c: Fix crashes in programs using " Ludovic Courtès
  2017-04-14 14:51     ` bug#26462: [PATCH] " Clément Lassieur
@ 2017-04-14 14:55     ` Clément Lassieur
  2017-04-14 14:59       ` Clément Lassieur
  1 sibling, 1 reply; 18+ messages in thread
From: Clément Lassieur @ 2017-04-14 14:55 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: 26462

Ludovic Courtès <ludo@gnu.org> writes:

> Clément Lassieur <clement@lassieur.org> skribis:
>
>> * gnu/packages/patches/icu4c-reset-keyword-list-iterator.patch: New file.
>> * gnu/local.mk (dist_patch_DATA): Add it.
>> * gnu/packages/icu4c.scm (icu4c)[source]: Use it.
>
> [...]
>
>> +++ b/gnu/packages/patches/icu4c-reset-keyword-list-iterator.patch
>> @@ -0,0 +1,128 @@
>> +Copied from upstream: http://bugs.icu-project.org/trac/changeset/39484/.
>> +
>> +Paths and line endings have been adapted.
>
> Woow, good catch!
>
> 1,700 packages depend on icu4c so the update would have to go to
> ‘core-updates’, but that won’t be merged until several weeks.
>
> For ‘master’, in the meantime, I see two solutions:
>
>   1. If the bug only affects specific applications, we could add an
>      icu4c variant and use that only where needed (icecat, 0ad, etc.).
>
>   2. If the bug manifests itself pervasively we could graft it in
>      ‘master’ (I guess it’s ABI-compatible, right?).
>
> Thoughts?

I prefer the second solution, in case the bug appears in other
applications as well, and I think it is ABI-compatible.  I just sent the
patch for the graft in master.  I'll do the patch for core-updates
later, when master is merged into it.

^ permalink raw reply	[flat|nested] 18+ messages in thread

* bug#26462: [PATCH 1/2] gnu: icu4c: Fix crashes in programs using system ICU.
  2017-04-14 14:55     ` bug#26462: [PATCH 1/2] " Clément Lassieur
@ 2017-04-14 14:59       ` Clément Lassieur
  2017-04-14 15:18         ` Ludovic Courtès
  0 siblings, 1 reply; 18+ messages in thread
From: Clément Lassieur @ 2017-04-14 14:59 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: 26462

Clément Lassieur <clement@lassieur.org> writes:

> Ludovic Courtès <ludo@gnu.org> writes:
>
>> Clément Lassieur <clement@lassieur.org> skribis:
>>
>>> * gnu/packages/patches/icu4c-reset-keyword-list-iterator.patch: New file.
>>> * gnu/local.mk (dist_patch_DATA): Add it.
>>> * gnu/packages/icu4c.scm (icu4c)[source]: Use it.
>>
>> [...]
>>
>>> +++ b/gnu/packages/patches/icu4c-reset-keyword-list-iterator.patch
>>> @@ -0,0 +1,128 @@
>>> +Copied from upstream: http://bugs.icu-project.org/trac/changeset/39484/.
>>> +
>>> +Paths and line endings have been adapted.
>>
>> Woow, good catch!
>>
>> 1,700 packages depend on icu4c so the update would have to go to
>> ‘core-updates’, but that won’t be merged until several weeks.
>>
>> For ‘master’, in the meantime, I see two solutions:
>>
>>   1. If the bug only affects specific applications, we could add an
>>      icu4c variant and use that only where needed (icecat, 0ad, etc.).
>>
>>   2. If the bug manifests itself pervasively we could graft it in
>>      ‘master’ (I guess it’s ABI-compatible, right?).
>>
>> Thoughts?
>
> I prefer the second solution, in case the bug appears in other
> applications as well, and I think it is ABI-compatible.  I just sent the
> patch for the graft in master.  I'll do the patch for core-updates
> later, when master is merged into it.

But I might be wrong :)  If you think the first solution is better,
don't hesitate to tell me, I'll do another patch.

^ permalink raw reply	[flat|nested] 18+ messages in thread

* bug#26462: [PATCH 1/2] gnu: icu4c: Fix crashes in programs using system ICU.
  2017-04-14 14:59       ` Clément Lassieur
@ 2017-04-14 15:18         ` Ludovic Courtès
  0 siblings, 0 replies; 18+ messages in thread
From: Ludovic Courtès @ 2017-04-14 15:18 UTC (permalink / raw)
  To: Clément Lassieur; +Cc: 26462

Clément Lassieur <clement@lassieur.org> skribis:

> Clément Lassieur <clement@lassieur.org> writes:
>
>> Ludovic Courtès <ludo@gnu.org> writes:
>>
>>> Clément Lassieur <clement@lassieur.org> skribis:
>>>
>>>> * gnu/packages/patches/icu4c-reset-keyword-list-iterator.patch: New file.
>>>> * gnu/local.mk (dist_patch_DATA): Add it.
>>>> * gnu/packages/icu4c.scm (icu4c)[source]: Use it.
>>>
>>> [...]
>>>
>>>> +++ b/gnu/packages/patches/icu4c-reset-keyword-list-iterator.patch
>>>> @@ -0,0 +1,128 @@
>>>> +Copied from upstream: http://bugs.icu-project.org/trac/changeset/39484/.
>>>> +
>>>> +Paths and line endings have been adapted.
>>>
>>> Woow, good catch!
>>>
>>> 1,700 packages depend on icu4c so the update would have to go to
>>> ‘core-updates’, but that won’t be merged until several weeks.
>>>
>>> For ‘master’, in the meantime, I see two solutions:
>>>
>>>   1. If the bug only affects specific applications, we could add an
>>>      icu4c variant and use that only where needed (icecat, 0ad, etc.).
>>>
>>>   2. If the bug manifests itself pervasively we could graft it in
>>>      ‘master’ (I guess it’s ABI-compatible, right?).
>>>
>>> Thoughts?
>>
>> I prefer the second solution, in case the bug appears in other
>> applications as well, and I think it is ABI-compatible.  I just sent the
>> patch for the graft in master.  I'll do the patch for core-updates
>> later, when master is merged into it.
>
> But I might be wrong :)  If you think the first solution is better,
> don't hesitate to tell me, I'll do another patch.

No no, I trust you!  I mean, making a graft in master is the safest
approach anyway.

Ludo’.

^ permalink raw reply	[flat|nested] 18+ messages in thread

* bug#26462: [PATCH] gnu: icu4c: Fix crashes in programs using system ICU.
  2017-04-14 14:51     ` bug#26462: [PATCH] " Clément Lassieur
@ 2017-04-16  9:54       ` Ludovic Courtès
  2017-04-17 18:45         ` Clément Lassieur
  0 siblings, 1 reply; 18+ messages in thread
From: Ludovic Courtès @ 2017-04-16  9:54 UTC (permalink / raw)
  To: Clément Lassieur; +Cc: 26462

Hi Clément,

Clément Lassieur <clement@lassieur.org> skribis:

> * gnu/packages/patches/icu4c-reset-keyword-list-iterator.patch: New file.
> * gnu/local.mk (dist_patch_DATA): Add it.
> * gnu/packages/icu4c.scm (icu4c)[replacement]: New field.
> (icu4c/fixed): New variable.

Please add “Fixes <http://bugs.gnu.org/26462>.” in the log.

[...]

> +++ b/gnu/packages/patches/icu4c-reset-keyword-list-iterator.patch
> @@ -0,0 +1,128 @@
> +Copied from upstream: http://bugs.icu-project.org/trac/changeset/39484/.
> +
> +Paths and line endings have been adapted.

Could you add a line saying what this fixes?

OK with these changes.  Thanks for taking care of it!

Ludo’.

^ permalink raw reply	[flat|nested] 18+ messages in thread

* bug#26462: [PATCH] gnu: icu4c: Fix crashes in programs using system ICU.
  2017-04-16  9:54       ` Ludovic Courtès
@ 2017-04-17 18:45         ` Clément Lassieur
  0 siblings, 0 replies; 18+ messages in thread
From: Clément Lassieur @ 2017-04-17 18:45 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: 26462-done

Ludovic Courtès <ludo@gnu.org> writes:

> Hi Clément,
>
> Clément Lassieur <clement@lassieur.org> skribis:
>
>> * gnu/packages/patches/icu4c-reset-keyword-list-iterator.patch: New file.
>> * gnu/local.mk (dist_patch_DATA): Add it.
>> * gnu/packages/icu4c.scm (icu4c)[replacement]: New field.
>> (icu4c/fixed): New variable.
>
> Please add “Fixes <http://bugs.gnu.org/26462>.” in the log.
>
> [...]
>
>> +++ b/gnu/packages/patches/icu4c-reset-keyword-list-iterator.patch
>> @@ -0,0 +1,128 @@
>> +Copied from upstream: http://bugs.icu-project.org/trac/changeset/39484/.
>> +
>> +Paths and line endings have been adapted.
>
> Could you add a line saying what this fixes?
>
> OK with these changes.  Thanks for taking care of it!

Done, and pushed.  Thanks for the review!

Clément

^ permalink raw reply	[flat|nested] 18+ messages in thread

end of thread, other threads:[~2017-04-17 18:46 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-04-12 10:48 bug#26462: Fix crashes in programs using system ICU Clément Lassieur
2017-04-12 10:53 ` bug#26462: [PATCH 1/2] gnu: icu4c: " Clément Lassieur
2017-04-12 10:53   ` bug#26462: [PATCH 2/2] gnu: icecat: Use " Clément Lassieur
2017-04-12 11:51   ` bug#26462: [PATCH 1/2] gnu: icu4c: Fix crashes in programs using " Ludovic Courtès
2017-04-14 14:51     ` bug#26462: [PATCH] " Clément Lassieur
2017-04-16  9:54       ` Ludovic Courtès
2017-04-17 18:45         ` Clément Lassieur
2017-04-14 14:55     ` bug#26462: [PATCH 1/2] " Clément Lassieur
2017-04-14 14:59       ` Clément Lassieur
2017-04-14 15:18         ` Ludovic Courtès
2017-04-12 10:55 ` bug#26462: " Clément Lassieur
2017-04-12 11:22 ` ng0
2017-04-12 11:31   ` Clément Lassieur
2017-04-12 11:42     ` Clément Lassieur
2017-04-12 11:53       ` ng0
2017-04-13 22:53         ` Clément Lassieur
2017-04-12 11:47     ` ng0
2017-04-13 23:01       ` Clément Lassieur

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).