tags 554593 confirmed patch
thanks

On Sunday 15 November 2009 16:15:28, you wrote:
> There was an error while trying to autobuild your package:
> [..]
> > couch_js.c:1125: warning: unused variable 'readlen'
> > couch_js.c:1125: warning: unused variable 'charslen'
> > couch_js.c: In function 'main':
> > couch_js.c:1216: warning: implicit declaration of function
> > 'JS_SetBranchCallback' couch_js.c:1217: error:
> > 'JSOPTION_NATIVE_BRANCH_CALLBACK' undeclared (first use in this function)
> > couch_js.c:1217: error: (Each undeclared identifier is reported only once
> > couch_js.c:1217: error: for each function it appears in.)
> > make[3]: *** [couchjs-couch_js.o] Error 1
> > make[3]: Leaving directory `/build/buildd/couchdb-0.9.0/src/couchdb'
> > make[2]: *** [all-recursive] Error 1
> > make[2]: Leaving directory `/build/buildd/couchdb-0.9.0'
> > make[1]: *** [all] Error 2
> > make[1]: Leaving directory `/build/buildd/couchdb-0.9.0'
> > make: *** [debian/stamp-makefile-build] Error 2
> > dpkg-buildpackage: error: debian/rules build gave error exit status 2
> 
> A full build log can be found at:
> http://buildd.debian.org/build.php?arch=ia64&pkg=couchdb&ver=0.9.0-2+b2

I'm attaching a patch I found in the upstream tracker, the same exact bug.

Noah, I haven't NMUed this package because the bug is rather young, please 
tell me if I should or, better, make an upload yourself.

Kindly,
David

-- 
 . ''`.   Debian developer | http://wiki.debian.org/DavidPaleino
 : :'  : Linuxer #334216 --|-- http://www.hanskalabs.net/
 `. `'`  GPG: 1392B174 ----|---- http://snipr.com/qa_page
   `-   2BAB C625 4E66 E7B8 450A C3E1 E6AA 9017 1392 B174
From: David Paleino <da...@debian.org>
Subject: backport patches from upstream svn
Bug: http://issues.apache.org/jira/browse/COUCHDB-288
Bug-Debian: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=554593

---
 share/www/script/test/show_documents.js |    2 +-
 src/couchdb/couch_js.c                  |   26 +++++++++++++++++++++++++-
 2 files changed, 26 insertions(+), 2 deletions(-)

--- couchdb-0.9.0.orig/src/couchdb/couch_js.c
+++ couchdb-0.9.0/src/couchdb/couch_js.c
@@ -214,6 +214,8 @@ EvalInContext(JSContext *context, JSObje
         return JS_FALSE;
     }
 
+    JS_SetContextThread(sub_context);
+    JS_BeginRequest(sub_context);
     src = JS_GetStringChars(str);
     srclen = JS_GetStringLength(str);
 
@@ -229,12 +231,14 @@ EvalInContext(JSContext *context, JSObje
         *rval = OBJECT_TO_JSVAL(sandbox);
         ok = JS_TRUE;
     } else {
-        ok = JS_EvaluateUCScript(sub_context, sandbox, src, srclen, NULL, -1,
+        ok = JS_EvaluateUCScript(sub_context, sandbox, src, srclen, NULL, 0,
                                  rval);
     }
 
 out:
+    JS_EndRequest(sub_context);
     JS_DestroyContext(sub_context);
+    JS_ClearContextThread(sub_context);
     return ok;
 }
 
@@ -395,6 +399,7 @@ ExecuteScript(JSContext *context, JSObje
 
 static uint32 gBranchCount = 0;
 
+#if JS_VERSION <= 170
 static JSBool
 BranchCallback(JSContext *context, JSScript *script) {
     if ((++gBranchCount & 0x3fff) == 1) {
@@ -402,6 +407,16 @@ BranchCallback(JSContext *context, JSScr
     }
     return JS_TRUE;
 }
+#else
+static JSBool
+OperationCallback(JSContext *context)
+{
+    if ((++gBranchCount & 0x3fff) == 1) {
+        JS_MaybeGC(context);
+    }
+    return JS_TRUE;
+}
+#endif
 
 static void
 PrintError(JSContext *context, const char *message, JSErrorReport *report) {
@@ -1212,9 +1227,16 @@ main(int argc, const char * argv[]) {
     context = JS_NewContext(runtime, gStackChunkSize);
     if (!context)
         return 1;
+    JS_SetContextThread(context);
+    JS_BeginRequest(context);
+    /* FIXME: https://bugzilla.mozilla.org/show_bug.cgi?id=477187 */
     JS_SetErrorReporter(context, PrintError);
+#if JS_VERSION <= 170
     JS_SetBranchCallback(context, BranchCallback);
     JS_ToggleOptions(context, JSOPTION_NATIVE_BRANCH_CALLBACK);
+#else
+    JS_SetOperationCallback(context, OperationCallback);
+#endif
     JS_ToggleOptions(context, JSOPTION_XML);
 
     global = JS_NewObject(context, NULL, NULL, NULL);
@@ -1245,7 +1267,9 @@ main(int argc, const char * argv[]) {
 
     ExecuteScript(context, global, argv[1]);
 
+    JS_EndRequest(context);
     JS_DestroyContext(context);
+    JS_ClearContextThread(context);
     JS_DestroyRuntime(runtime);
     JS_ShutDown();
 
--- couchdb-0.9.0.orig/share/www/script/test/show_documents.js
+++ couchdb-0.9.0/share/www/script/test/show_documents.js
@@ -107,7 +107,7 @@ couchTests.show_documents = function(deb
             // Becase Safari can't stand to see that dastardly
             // E4X outside of a string. Outside of tests you
             // can just use E4X literals.
-            this.eval('xml.no...@foo = doc.word');
+            eval('xml.no...@foo = doc.word');
             return {
               body: xml
             };

Attachment: signature.asc
Description: This is a digitally signed message part.

Reply via email to