svn commit: r766407 - /couchdb/trunk/share/Makefile.am
Author: jan Date: Sat Apr 18 23:56:53 2009 New Revision: 766407 URL: http://svn.apache.org/viewvc?rev=766407&view=rev Log: fix make distcheck, thanks Noah Modified: couchdb/trunk/share/Makefile.am Modified: couchdb/trunk/share/Makefile.am URL: http://svn.apache.org/viewvc/couchdb/trunk/share/Makefile.am?rev=766407&r1=766406&r2=766407&view=diff == --- couchdb/trunk/share/Makefile.am (original) +++ couchdb/trunk/share/Makefile.am Sat Apr 18 23:56:53 2009 @@ -27,7 +27,7 @@ CLEANFILES = server/main.js nobase_dist_localdata_DATA = \ -server/main.js \ +$(MAKEJS_FILES) \ www/dialog/_compact_database.html \ www/dialog/_create_document.html \ www/dialog/_create_database.html \
svn commit: r766406 - in /couchdb/trunk/share: Makefile.am server/main.js server/mainjs.sh server/render.js
Author: jan Date: Sat Apr 18 23:32:56 2009 New Revision: 766406 URL: http://svn.apache.org/viewvc?rev=766406&view=rev Log: move main.js generation to Makefile Removed: couchdb/trunk/share/server/main.js couchdb/trunk/share/server/mainjs.sh Modified: couchdb/trunk/share/Makefile.am couchdb/trunk/share/server/render.js Modified: couchdb/trunk/share/Makefile.am URL: http://svn.apache.org/viewvc/couchdb/trunk/share/Makefile.am?rev=766406&r1=766405&r2=766406&view=diff == --- couchdb/trunk/share/Makefile.am (original) +++ couchdb/trunk/share/Makefile.am Sat Apr 18 23:32:56 2009 @@ -10,16 +10,19 @@ ## License for the specific language governing permissions and limitations ## under the License. +# loop.js MUST be last! MAKEJS_FILES = \ -server/loop.js \ server/render.js \ server/state.js \ server/util.js \ server/validate.js \ -server/views.js +server/views.js \ +server/loop.js server/main.js: $(MAKEJS_FILES) - server/mainjs.sh + @echo "// Generated from *.js by make on `date`" > server/main.js + @echo "// DO NOT EDIT BY HAND\n" >> server/main.js + @cat $(MAKEJS_FILES) >> server/main.js CLEANFILES = server/main.js Modified: couchdb/trunk/share/server/render.js URL: http://svn.apache.org/viewvc/couchdb/trunk/share/server/render.js?rev=766406&r1=766405&r2=766406&view=diff == --- couchdb/trunk/share/server/render.js (original) +++ couchdb/trunk/share/server/render.js Sat Apr 18 23:32:56 2009 @@ -10,7 +10,6 @@ // License for the specific language governing permissions and limitations under // the License. - // mimeparse.js // http://code.google.com/p/mimeparse/ // Code with comments: http://mimeparse.googlecode.com/svn/trunk/mimeparse.js
[Couchdb Wiki] Update of "How-To Guides" by AlexanderKosenkov
Dear Wiki user, You have subscribed to a wiki page or wiki category on "Couchdb Wiki" for change notification. The following page has been changed by AlexanderKosenkov: http://wiki.apache.org/couchdb/How-To_Guides -- * ["Nginx_As_a_Reverse_Proxy"] * ["How to add client-side security"] * ["How to change the front page"] + * ["How to import your SQL dump to CouchDB"]
[Couchdb Wiki] Update of "EntityRelationship" by AlexanderKosenkov
Dear Wiki user, You have subscribed to a wiki page or wiki category on "Couchdb Wiki" for change notification. The following page has been changed by AlexanderKosenkov: http://wiki.apache.org/couchdb/EntityRelationship -- "phones":[{"number":"(650) 555 - 2200","type":"home"},{"number":"(650) 555 - 2201","type":"mobile"}], } }}} + + or even + + {{{ + { + "_id":"Scott", + "type":"contact", + "name":"My Friend Scott", + "phones":[{"home":"(650) 555 - 2200"},{"mobile":"(650) 555 - 2201"}], + } + }}} + Note how only the fields that we know are stored. Also note that the phone numbers are not simply an array, they are an array of associative hashes. We could extend this with no effort to add email addresses, IM names etc, even if IM names would need an extra attribute that has the service type. In essence, you're embedding child documents in the master document. That is the power of schema-less databases. == Many to Many ==
svn commit: r766399 - /couchdb/trunk/share/server/mainjs.sh
Author: jan Date: Sat Apr 18 22:18:52 2009 New Revision: 766399 URL: http://svn.apache.org/viewvc?rev=766399&view=rev Log: add generation-notice Modified: couchdb/trunk/share/server/mainjs.sh Modified: couchdb/trunk/share/server/mainjs.sh URL: http://svn.apache.org/viewvc/couchdb/trunk/share/server/mainjs.sh?rev=766399&r1=766398&r2=766399&view=diff == --- couchdb/trunk/share/server/mainjs.sh (original) +++ couchdb/trunk/share/server/mainjs.sh Sat Apr 18 22:18:52 2009 @@ -12,7 +12,12 @@ # License for the specific language governing permissions and limitations under # the License. +TARGET="main.js" + cd server +echo "// Generated from *.js by makejs.sh on `date`" > $TARGET +echo "// DO NOT EDIT BY HAND\n" >> $TARGET + cat \ render.js \ state.js \ @@ -20,5 +25,5 @@ validate.js \ views.js \ loop.js \ - > main.js + >> $TARGET cd .. \ No newline at end of file
svn commit: r766392 - /couchdb/trunk/share/Makefile.am
Author: jan Date: Sat Apr 18 20:58:24 2009 New Revision: 766392 URL: http://svn.apache.org/viewvc?rev=766392&view=rev Log: run mainjs.sh if one of the source files changed Modified: couchdb/trunk/share/Makefile.am Modified: couchdb/trunk/share/Makefile.am URL: http://svn.apache.org/viewvc/couchdb/trunk/share/Makefile.am?rev=766392&r1=766391&r2=766392&view=diff == --- couchdb/trunk/share/Makefile.am (original) +++ couchdb/trunk/share/Makefile.am Sat Apr 18 20:58:24 2009 @@ -10,7 +10,15 @@ ## License for the specific language governing permissions and limitations ## under the License. -server/main.js: +MAKEJS_FILES = \ +server/loop.js \ +server/render.js \ +server/state.js \ +server/util.js \ +server/validate.js \ +server/views.js + +server/main.js: $(MAKEJS_FILES) server/mainjs.sh CLEANFILES = server/main.js
svn commit: r766390 - in /couchdb/trunk/share: Makefile.am server/mainjs.sh
Author: jan Date: Sat Apr 18 20:50:25 2009 New Revision: 766390 URL: http://svn.apache.org/viewvc?rev=766390&view=rev Log: integrate main.js split-up into build system Modified: couchdb/trunk/share/Makefile.am couchdb/trunk/share/server/mainjs.sh Modified: couchdb/trunk/share/Makefile.am URL: http://svn.apache.org/viewvc/couchdb/trunk/share/Makefile.am?rev=766390&r1=766389&r2=766390&view=diff == --- couchdb/trunk/share/Makefile.am (original) +++ couchdb/trunk/share/Makefile.am Sat Apr 18 20:50:25 2009 @@ -10,11 +10,16 @@ ## License for the specific language governing permissions and limitations ## under the License. +server/main.js: + server/mainjs.sh + +CLEANFILES = server/main.js + nobase_dist_localdata_DATA = \ server/main.js \ www/dialog/_compact_database.html \ -www/dialog/_create_database.html \ www/dialog/_create_document.html \ +www/dialog/_create_database.html \ www/dialog/_delete_database.html \ www/dialog/_delete_document.html \ www/dialog/_save_view_as.html \ Modified: couchdb/trunk/share/server/mainjs.sh URL: http://svn.apache.org/viewvc/couchdb/trunk/share/server/mainjs.sh?rev=766390&r1=766389&r2=766390&view=diff == --- couchdb/trunk/share/server/mainjs.sh (original) +++ couchdb/trunk/share/server/mainjs.sh Sat Apr 18 20:50:25 2009 @@ -12,13 +12,13 @@ # License for the specific language governing permissions and limitations under # the License. -dirname=`dirname $0` - +cd server cat \ - $dirname/render.js \ - $dirname/state.js \ - $dirname/util.js \ - $dirname/validate.js \ - $dirname/views.js \ - $dirname/loop.js \ - > $dirname/main.js + render.js \ + state.js \ + util.js \ + validate.js \ + views.js \ + loop.js \ + > main.js +cd .. \ No newline at end of file
svn commit: r766388 - in /couchdb/branches/0.9.x: ./ etc/default/couchdb share/server/main.js src/couchdb/couch_js.c src/couchdb/couch_os_process.erl
Author: jchris Date: Sat Apr 18 20:42:19 2009 New Revision: 766388 URL: http://svn.apache.org/viewvc?rev=766388&view=rev Log: merge 765479 (better JS error handling) into 0.9.x branch Modified: couchdb/branches/0.9.x/ (props changed) couchdb/branches/0.9.x/etc/default/couchdb (props changed) couchdb/branches/0.9.x/share/server/main.js couchdb/branches/0.9.x/src/couchdb/couch_js.c couchdb/branches/0.9.x/src/couchdb/couch_os_process.erl Propchange: couchdb/branches/0.9.x/ -- --- svn:mergeinfo (original) +++ svn:mergeinfo Sat Apr 18 20:42:19 2009 @@ -1,3 +1,3 @@ /couchdb/branches/design_resources:751716-751803 /couchdb/branches/form:729440-730015 -/couchdb/trunk:758717,760442,760503,760532,760535,760537-760539,761343,761347-761348,761352-761353,761355,762016,765420,766347,766353,766358,766373 +/couchdb/trunk:758717,760442,760503,760532,760535,760537-760539,761343,761347-761348,761352-761353,761355,762016,765420,765479,766347,766353,766358,766373 Propchange: couchdb/branches/0.9.x/etc/default/couchdb -- --- svn:mergeinfo (original) +++ svn:mergeinfo Sat Apr 18 20:42:19 2009 @@ -1,4 +1,4 @@ /couchdb/branches/design_resources/etc/default/couchdb:751716-751803 /couchdb/branches/form/etc/default/couchdb:729440-730015 -/couchdb/trunk/etc/default/couchdb:758717,760442,760503,760532,760535,760537-760539,761343,761347-761348,761352-761353,761355,762016,765420,766347,766353,766358,766373 +/couchdb/trunk/etc/default/couchdb:758717,760442,760503,760532,760535,760537-760539,761343,761347-761348,761352-761353,761355,762016,765420,765479,766347,766353,766358,766373 /incubator/couchdb/trunk/etc/default/couchdb:642419-694440 Modified: couchdb/branches/0.9.x/share/server/main.js URL: http://svn.apache.org/viewvc/couchdb/branches/0.9.x/share/server/main.js?rev=766388&r1=766387&r2=766388&view=diff == --- couchdb/branches/0.9.x/share/server/main.js [utf-8] (original) +++ couchdb/branches/0.9.x/share/server/main.js [utf-8] Sat Apr 18 20:42:19 2009 @@ -414,7 +414,8 @@ } catch(e) { log("function raised error: "+e.toString()); log("stacktrace: "+e.stack); -respond({error:"render_error",reason:e}); +var errorMessage = "function raised error: "+e.toString()+"\nstacktrace: "+e.stack; +respond({error:"render_error",reason:errorMessage}); } }; Modified: couchdb/branches/0.9.x/src/couchdb/couch_js.c URL: http://svn.apache.org/viewvc/couchdb/branches/0.9.x/src/couchdb/couch_js.c?rev=766388&r1=766387&r2=766388&view=diff == --- couchdb/branches/0.9.x/src/couchdb/couch_js.c (original) +++ couchdb/branches/0.9.x/src/couchdb/couch_js.c Sat Apr 18 20:42:19 2009 @@ -231,6 +231,7 @@ } else { ok = JS_EvaluateUCScript(sub_context, sandbox, src, srclen, NULL, -1, rval); +ok = JS_TRUE; } out: Modified: couchdb/branches/0.9.x/src/couchdb/couch_os_process.erl URL: http://svn.apache.org/viewvc/couchdb/branches/0.9.x/src/couchdb/couch_os_process.erl?rev=766388&r1=766387&r2=766388&view=diff == --- couchdb/branches/0.9.x/src/couchdb/couch_os_process.erl (original) +++ couchdb/branches/0.9.x/src/couchdb/couch_os_process.erl Sat Apr 18 20:42:19 2009 @@ -51,7 +51,13 @@ gen_server:call(Pid, read). prompt(Pid, Data) -> -gen_server:call(Pid, {prompt, Data}, infinity). +case gen_server:call(Pid, {prompt, Data}, infinity) of +{ok, Result} -> +Result; +{error, Error} -> +?LOG_DEBUG("OS Process Error ~p",[Error]), +throw(Error) +end. async(Pid, Data, CallBack) -> gen_server:cast(Pid, {async, Data, CallBack}). @@ -138,7 +144,13 @@ handle_call({prompt, Data}, _From, OsProc) -> #os_proc{writer=Writer, reader=Reader} = OsProc, Writer(OsProc, Data), -{reply, Reader(OsProc), OsProc}. +Result = try Reader(OsProc) of +Ok -> {ok, Ok} +catch +throw:OsError -> +{error, OsError} +end, +{reply, Result, OsProc}. handle_cast({async, Data, CallBack}, OsProc) -> #os_proc{writer=Writer, reader=Reader} = OsProc,
svn commit: r766383 - in /couchdb/trunk: share/server/ share/www/script/test/ src/couchdb/
Author: jchris Date: Sat Apr 18 20:15:44 2009 New Revision: 766383 URL: http://svn.apache.org/viewvc?rev=766383&view=rev Log: refactor main.js into many files and improve show/list error handling Added: couchdb/trunk/share/server/loop.js (with props) couchdb/trunk/share/server/mainjs.sh (with props) couchdb/trunk/share/server/render.js (with props) couchdb/trunk/share/server/state.js (with props) couchdb/trunk/share/server/util.js (with props) couchdb/trunk/share/server/validate.js (with props) couchdb/trunk/share/server/views.js (with props) Modified: couchdb/trunk/share/server/main.js couchdb/trunk/share/www/script/test/list_views.js couchdb/trunk/share/www/script/test/show_documents.js couchdb/trunk/src/couchdb/couch_httpd.erl couchdb/trunk/src/couchdb/couch_httpd_show.erl couchdb/trunk/src/couchdb/couch_httpd_view.erl Added: couchdb/trunk/share/server/loop.js URL: http://svn.apache.org/viewvc/couchdb/trunk/share/server/loop.js?rev=766383&view=auto == --- couchdb/trunk/share/server/loop.js (added) +++ couchdb/trunk/share/server/loop.js Sat Apr 18 20:15:44 2009 @@ -0,0 +1,62 @@ +// Licensed under the Apache License, Version 2.0 (the "License"); you may not +// use this file except in compliance with the License. You may obtain a copy +// of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +// License for the specific language governing permissions and limitations under +// the License. + +var sandbox = null; + +try { + // if possible, use evalcx (not always available) + sandbox = evalcx(''); + sandbox.emit = emit; + sandbox.sum = sum; + sandbox.log = log; + sandbox.toJSON = toJSON; + sandbox.respondWith = respondWith; + sandbox.registerType = registerType; +} catch (e) {} + +// Commands are in the form of json arrays: +// ["commandname",..optional args...]\n +// +// Responses are json values followed by a new line ("\n") + +var cmd, cmdkey; + +var dispatch = { + "reset" : State.reset, + "add_fun": State.addFun, + "map_doc": Views.mapDoc, + "reduce" : Views.reduce, + "rereduce" : Views.rereduce, + "validate" : Validate.validate, + "show_doc" : Render.showDoc, + "list_begin" : Render.listBegin, + "list_row" : Render.listRow, + "list_tail" : Render.listTail +}; + +while (cmd = eval(readline())) { + try { +cmdkey = cmd.shift(); +if (dispatch[cmdkey]) { + // run the correct responder with the cmd body + dispatch[cmdkey].apply(this, cmd); +} else { + // unknown command, quit and hope the restarted version is better + respond({ +error: "query_server_error", +reason: "unknown command '" + cmdkey + "'"}); + quit(); +} + } catch(e) { +respond(e); + } +}; Propchange: couchdb/trunk/share/server/loop.js -- svn:eol-style = native Modified: couchdb/trunk/share/server/main.js URL: http://svn.apache.org/viewvc/couchdb/trunk/share/server/main.js?rev=766383&r1=766382&r2=766383&view=diff == --- couchdb/trunk/share/server/main.js [utf-8] (original) +++ couchdb/trunk/share/server/main.js [utf-8] Sat Apr 18 20:15:44 2009 @@ -10,33 +10,6 @@ // License for the specific language governing permissions and limitations under // the License. -var cmd; -var funs = [];// holds functions used for computation -var map_results = []; // holds temporary emitted values during doc map -var row_line = {}; // holds row number in list per func - -var sandbox = null; - -emit = function(key, value) { - map_results.push([key, value]); -} - -sum = function(values) { - var rv = 0; - for (var i in values) { -rv += values[i]; - } - return rv; -} - -log = function(message) { - if (typeof message == "undefined") { -message = "Error: attempting to log message of 'undefined'."; - } else if (typeof message != "string") { -message = toJSON(message); - } - print(toJSON({log: message})); -} // mimeparse.js // http://code.google.com/p/mimeparse/ @@ -46,12 +19,12 @@ var Mimeparse = (function() { function strip(string) { -return string.replace(/^\s+/, '').replace(/\s+$/, '') +return string.replace(/^\s+/, '').replace(/\s+$/, ''); }; function parseRanges(ranges) { var parsedRanges = [], rangeParts = ranges.split(","); for (var i=0; i < rangeParts.length; i++) { - parsedRanges.push(publicMethods.parseMediaRange(rangeParts[i])) + parsedRanges.push(publicMethods.parseMediaRange(rangeParts[i])); }; return parsedRanges; }; @@
svn commit: r766374 - in /couchdb/branches/0.9.x: ./ etc/default/couchdb share/www/script/test/basics.js share/www/script/test/view_errors.js src/couchdb/couch_httpd_db.erl src/couchdb/couch_httpd_vie
Author: davisp Date: Sat Apr 18 18:36:47 2009 New Revision: 766374 URL: http://svn.apache.org/viewvc?rev=766374&view=rev Log: Merged 766373 from trunk. Modified: couchdb/branches/0.9.x/ (props changed) couchdb/branches/0.9.x/etc/default/couchdb (props changed) couchdb/branches/0.9.x/share/www/script/test/basics.js couchdb/branches/0.9.x/share/www/script/test/view_errors.js couchdb/branches/0.9.x/src/couchdb/couch_httpd_db.erl couchdb/branches/0.9.x/src/couchdb/couch_httpd_view.erl Propchange: couchdb/branches/0.9.x/ -- --- svn:mergeinfo (original) +++ svn:mergeinfo Sat Apr 18 18:36:47 2009 @@ -1,3 +1,3 @@ /couchdb/branches/design_resources:751716-751803 /couchdb/branches/form:729440-730015 -/couchdb/trunk:758717,760442,760503,760532,760535,760537-760539,761343,761347-761348,761352-761353,761355,762016,765420,766347,766353,766358 +/couchdb/trunk:758717,760442,760503,760532,760535,760537-760539,761343,761347-761348,761352-761353,761355,762016,765420,766347,766353,766358,766373 Propchange: couchdb/branches/0.9.x/etc/default/couchdb -- --- svn:mergeinfo (original) +++ svn:mergeinfo Sat Apr 18 18:36:47 2009 @@ -1,4 +1,4 @@ /couchdb/branches/design_resources/etc/default/couchdb:751716-751803 /couchdb/branches/form/etc/default/couchdb:729440-730015 -/couchdb/trunk/etc/default/couchdb:758717,760442,760503,760532,760535,760537-760539,761343,761347-761348,761352-761353,761355,762016,765420,766347,766353,766358 +/couchdb/trunk/etc/default/couchdb:758717,760442,760503,760532,760535,760537-760539,761343,761347-761348,761352-761353,761355,762016,765420,766347,766353,766358,766373 /incubator/couchdb/trunk/etc/default/couchdb:642419-694440 Modified: couchdb/branches/0.9.x/share/www/script/test/basics.js URL: http://svn.apache.org/viewvc/couchdb/branches/0.9.x/share/www/script/test/basics.js?rev=766374&r1=766373&r2=766374&view=diff == --- couchdb/branches/0.9.x/share/www/script/test/basics.js (original) +++ couchdb/branches/0.9.x/share/www/script/test/basics.js Sat Apr 18 18:36:47 2009 @@ -145,4 +145,32 @@ // deleting a non-existent doc should be 404 xhr = CouchDB.request("DELETE", "/test_suite_db/doc-does-not-exist"); T(xhr.status == 404); + +// Check some common error responses. +// PUT body not an object +xhr = CouchDB.request("PUT", "/test_suite_db/bar", {body: "[]"}); +T(xhr.status == 400); +result = JSON.parse(xhr.responseText); +T(result.error == "bad_request"); +T(result.reason == "Document must be a JSON object"); + +// Body of a _bulk_docs is not an object +xhr = CouchDB.request("POST", "/test_suite_db/_bulk_docs", {body: "[]"}); +T(xhr.status == 400); +result = JSON.parse(xhr.responseText); +T(result.error == "bad_request"); +T(result.reason == "Body must be a JSON object"); + +// Body of an _all_docs multi-get is not a {"key": [...]} structure. +xhr = CouchDB.request("POST", "/test_suite_db/_all_docs", {body: "[]"}); +T(xhr.status == 400); +result = JSON.parse(xhr.responseText); +T(result.error == "bad_request"); +T(result.reason == "Body must be a JSON object"); +var data = "{\"keys\": 1}"; +xhr = CouchDB.request("POST", "/test_suite_db/_all_docs", {body:data}); +T(xhr.status == 400); +result = JSON.parse(xhr.responseText); +T(result.error == "bad_request"); +T(result.reason == "`keys` member must be a array."); }; Modified: couchdb/branches/0.9.x/share/www/script/test/view_errors.js URL: http://svn.apache.org/viewvc/couchdb/branches/0.9.x/share/www/script/test/view_errors.js?rev=766374&r1=766373&r2=766374&view=diff == --- couchdb/branches/0.9.x/share/www/script/test/view_errors.js (original) +++ couchdb/branches/0.9.x/share/www/script/test/view_errors.js Sat Apr 18 18:36:47 2009 @@ -94,4 +94,18 @@ } catch(e) { T(e.error == "query_parse_error"); } + + // Check error responses for invalid multi-get bodies. + var path = "/test_suite_db/_design/test/_view/no_reduce"; + var xhr = CouchDB.request("POST", path, {body: "[]"}); + T(xhr.status == 400); + result = JSON.parse(xhr.responseText); + T(result.error == "bad_request"); + T(result.reason == "Body must be a JSON object"); + var data = "{\"keys\": 1}"; + xhr = CouchDB.request("POST", path, {body:data}); + T(xhr.status == 400); + result = JSON.parse(xhr.responseText); + T(result.error == "bad_request"); + T(result.reason == "`keys` member must be a array."); }; Modified: couchdb/branches/0.9.x/src/couchdb/couch_httpd_db.erl URL: http://svn.apache.org/viewvc/couchdb/branches/0.9.x/src/couchdb/couch_httpd_db.erl?rev=766374&r1=766373&r2=766374&view=diff
svn commit: r766373 - in /couchdb/trunk: share/www/script/test/basics.js share/www/script/test/view_errors.js src/couchdb/couch_httpd_db.erl src/couchdb/couch_httpd_view.erl
Author: davisp Date: Sat Apr 18 18:34:31 2009 New Revision: 766373 URL: http://svn.apache.org/viewvc?rev=766373&view=rev Log: Resolves COUCHDB-306 - Wacky error responses to malformed documents Mostly adds improvements to the parsing of Json bodies for _bulk_docs and multi-get queries. Includes tests in basics.js and view_errors.js. Modified: couchdb/trunk/share/www/script/test/basics.js couchdb/trunk/share/www/script/test/view_errors.js couchdb/trunk/src/couchdb/couch_httpd_db.erl couchdb/trunk/src/couchdb/couch_httpd_view.erl Modified: couchdb/trunk/share/www/script/test/basics.js URL: http://svn.apache.org/viewvc/couchdb/trunk/share/www/script/test/basics.js?rev=766373&r1=766372&r2=766373&view=diff == --- couchdb/trunk/share/www/script/test/basics.js (original) +++ couchdb/trunk/share/www/script/test/basics.js Sat Apr 18 18:34:31 2009 @@ -168,4 +168,32 @@ // deleting a non-existent doc should be 404 xhr = CouchDB.request("DELETE", "/test_suite_db/doc-does-not-exist"); T(xhr.status == 404); + +// Check some common error responses. +// PUT body not an object +xhr = CouchDB.request("PUT", "/test_suite_db/bar", {body: "[]"}); +T(xhr.status == 400); +result = JSON.parse(xhr.responseText); +T(result.error == "bad_request"); +T(result.reason == "Document must be a JSON object"); + +// Body of a _bulk_docs is not an object +xhr = CouchDB.request("POST", "/test_suite_db/_bulk_docs", {body: "[]"}); +T(xhr.status == 400); +result = JSON.parse(xhr.responseText); +T(result.error == "bad_request"); +T(result.reason == "Body must be a JSON object"); + +// Body of an _all_docs multi-get is not a {"key": [...]} structure. +xhr = CouchDB.request("POST", "/test_suite_db/_all_docs", {body: "[]"}); +T(xhr.status == 400); +result = JSON.parse(xhr.responseText); +T(result.error == "bad_request"); +T(result.reason == "Body must be a JSON object"); +var data = "{\"keys\": 1}"; +xhr = CouchDB.request("POST", "/test_suite_db/_all_docs", {body:data}); +T(xhr.status == 400); +result = JSON.parse(xhr.responseText); +T(result.error == "bad_request"); +T(result.reason == "`keys` member must be a array."); }; Modified: couchdb/trunk/share/www/script/test/view_errors.js URL: http://svn.apache.org/viewvc/couchdb/trunk/share/www/script/test/view_errors.js?rev=766373&r1=766372&r2=766373&view=diff == --- couchdb/trunk/share/www/script/test/view_errors.js (original) +++ couchdb/trunk/share/www/script/test/view_errors.js Sat Apr 18 18:34:31 2009 @@ -94,4 +94,18 @@ } catch(e) { T(e.error == "query_parse_error"); } + + // Check error responses for invalid multi-get bodies. + var path = "/test_suite_db/_design/test/_view/no_reduce"; + var xhr = CouchDB.request("POST", path, {body: "[]"}); + T(xhr.status == 400); + result = JSON.parse(xhr.responseText); + T(result.error == "bad_request"); + T(result.reason == "Body must be a JSON object"); + var data = "{\"keys\": 1}"; + xhr = CouchDB.request("POST", path, {body:data}); + T(xhr.status == 400); + result = JSON.parse(xhr.responseText); + T(result.error == "bad_request"); + T(result.reason == "`keys` member must be a array."); }; Modified: couchdb/trunk/src/couchdb/couch_httpd_db.erl URL: http://svn.apache.org/viewvc/couchdb/trunk/src/couchdb/couch_httpd_db.erl?rev=766373&r1=766372&r2=766373&view=diff == --- couchdb/trunk/src/couchdb/couch_httpd_db.erl (original) +++ couchdb/trunk/src/couchdb/couch_httpd_db.erl Sat Apr 18 18:34:31 2009 @@ -126,7 +126,13 @@ db_req(#httpd{method='POST',path_parts=[_,<<"_bulk_docs">>]}=Req, Db) -> couch_stats_collector:increment({httpd, bulk_requests}), -{JsonProps} = couch_httpd:json_body(Req), +JsonProps = +case couch_httpd:json_body(Req) of +{Fields} -> +Fields; +_ -> +throw({bad_request, "Body must be a JSON object"}) +end, DocsArray = proplists:get_value(<<"docs">>, JsonProps), case couch_httpd:header_value(Req, "X-Couch-Full-Commit", "false") of "true" -> @@ -220,9 +226,20 @@ all_docs_view(Req, Db, nil); db_req(#httpd{method='POST',path_parts=[_,<<"_all_docs">>]}=Req, Db) -> -{Props} = couch_httpd:json_body(Req), -Keys = proplists:get_value(<<"keys">>, Props, nil), -all_docs_view(Req, Db, Keys); +case couch_httpd:json_body(Req) of +{Fields} -> +case proplists:get_value(<<"keys">>, Fields, nil) of +nil -> +?LOG_DEBUG("POST to _all_docs with no keys member.", []), +all_docs_view(Req, Db, nil); +Keys when is_list(Keys) -> +all_docs_view(Req, Db, Keys); +_ -> +throw({bad_request, "`keys` member must be a ar
svn commit: r766359 - in /couchdb/branches/0.9.x: ./ etc/default/couchdb src/couchdb/couch_httpd_misc_handlers.erl
Author: davisp Date: Sat Apr 18 17:17:29 2009 New Revision: 766359 URL: http://svn.apache.org/viewvc?rev=766359&view=rev Log: Merged 766358 from trunk. Modified: couchdb/branches/0.9.x/ (props changed) couchdb/branches/0.9.x/etc/default/couchdb (props changed) couchdb/branches/0.9.x/src/couchdb/couch_httpd_misc_handlers.erl Propchange: couchdb/branches/0.9.x/ -- --- svn:mergeinfo (original) +++ svn:mergeinfo Sat Apr 18 17:17:29 2009 @@ -1,3 +1,3 @@ /couchdb/branches/design_resources:751716-751803 /couchdb/branches/form:729440-730015 -/couchdb/trunk:758717,760442,760503,760532,760535,760537-760539,761343,761347-761348,761352-761353,761355,762016,765420,766347,766353 +/couchdb/trunk:758717,760442,760503,760532,760535,760537-760539,761343,761347-761348,761352-761353,761355,762016,765420,766347,766353,766358 Propchange: couchdb/branches/0.9.x/etc/default/couchdb -- --- svn:mergeinfo (original) +++ svn:mergeinfo Sat Apr 18 17:17:29 2009 @@ -1,4 +1,4 @@ /couchdb/branches/design_resources/etc/default/couchdb:751716-751803 /couchdb/branches/form/etc/default/couchdb:729440-730015 -/couchdb/trunk/etc/default/couchdb:758717,760442,760503,760532,760535,760537-760539,761343,761347-761348,761352-761353,761355,762016,765420,766347,766353 +/couchdb/trunk/etc/default/couchdb:758717,760442,760503,760532,760535,760537-760539,761343,761347-761348,761352-761353,761355,762016,765420,766347,766353,766358 /incubator/couchdb/trunk/etc/default/couchdb:642419-694440 Modified: couchdb/branches/0.9.x/src/couchdb/couch_httpd_misc_handlers.erl URL: http://svn.apache.org/viewvc/couchdb/branches/0.9.x/src/couchdb/couch_httpd_misc_handlers.erl?rev=766359&r1=766358&r2=766359&view=diff == --- couchdb/branches/0.9.x/src/couchdb/couch_httpd_misc_handlers.erl (original) +++ couchdb/branches/0.9.x/src/couchdb/couch_httpd_misc_handlers.erl Sat Apr 18 17:17:29 2009 @@ -50,7 +50,8 @@ couch_httpd:serve_file(Req, RelativePath, DocumentRoot); {_ActionKey, "", _RelativePath} -> % GET /_utils -couch_httpd:send_redirect(Req, "/_utils/") +RedirectPath = couch_httpd:path(Req) ++ "/", +couch_httpd:send_redirect(Req, RedirectPath) end; handle_utils_dir_req(Req, _) -> send_method_not_allowed(Req, "GET,HEAD").
svn commit: r766358 - /couchdb/trunk/src/couchdb/couch_httpd_misc_handlers.erl
Author: davisp Date: Sat Apr 18 17:12:38 2009 New Revision: 766358 URL: http://svn.apache.org/viewvc?rev=766358&view=rev Log: Fixes COUCHDB-310 Change the hardcoded "/_utils/" redirect to append a '/' to the current path. Modified: couchdb/trunk/src/couchdb/couch_httpd_misc_handlers.erl Modified: couchdb/trunk/src/couchdb/couch_httpd_misc_handlers.erl URL: http://svn.apache.org/viewvc/couchdb/trunk/src/couchdb/couch_httpd_misc_handlers.erl?rev=766358&r1=766357&r2=766358&view=diff == --- couchdb/trunk/src/couchdb/couch_httpd_misc_handlers.erl (original) +++ couchdb/trunk/src/couchdb/couch_httpd_misc_handlers.erl Sat Apr 18 17:12:38 2009 @@ -50,7 +50,8 @@ couch_httpd:serve_file(Req, RelativePath, DocumentRoot); {_ActionKey, "", _RelativePath} -> % GET /_utils -couch_httpd:send_redirect(Req, "/_utils/") +RedirectPath = couch_httpd:path(Req) ++ "/", +couch_httpd:send_redirect(Req, RedirectPath) end; handle_utils_dir_req(Req, _) -> send_method_not_allowed(Req, "GET,HEAD").
svn commit: r766354 - in /couchdb/branches/0.9.x: ./ THANKS etc/default/couchdb src/couchdb/couch_external_manager.erl
Author: davisp Date: Sat Apr 18 16:36:59 2009 New Revision: 766354 URL: http://svn.apache.org/viewvc?rev=766354&view=rev Log: Merged 766353 from trunk. Modified: couchdb/branches/0.9.x/ (props changed) couchdb/branches/0.9.x/THANKS couchdb/branches/0.9.x/etc/default/couchdb (props changed) couchdb/branches/0.9.x/src/couchdb/couch_external_manager.erl Propchange: couchdb/branches/0.9.x/ -- --- svn:mergeinfo (original) +++ svn:mergeinfo Sat Apr 18 16:36:59 2009 @@ -1,3 +1,3 @@ /couchdb/branches/design_resources:751716-751803 /couchdb/branches/form:729440-730015 -/couchdb/trunk:758717,760442,760503,760532,760535,760537-760539,761343,761347-761348,761352-761353,761355,762016,765420,766347 +/couchdb/trunk:758717,760442,760503,760532,760535,760537-760539,761343,761347-761348,761352-761353,761355,762016,765420,766347,766353 Modified: couchdb/branches/0.9.x/THANKS URL: http://svn.apache.org/viewvc/couchdb/branches/0.9.x/THANKS?rev=766354&r1=766353&r2=766354&view=diff == --- couchdb/branches/0.9.x/THANKS (original) +++ couchdb/branches/0.9.x/THANKS Sat Apr 18 16:36:59 2009 @@ -25,5 +25,6 @@ * Eric Casteleijn * Maarten Thibaut * Florian Ebeling + * Volker Mische For a list of authors see the `AUTHORS` file. Propchange: couchdb/branches/0.9.x/etc/default/couchdb -- --- svn:mergeinfo (original) +++ svn:mergeinfo Sat Apr 18 16:36:59 2009 @@ -1,4 +1,4 @@ /couchdb/branches/design_resources/etc/default/couchdb:751716-751803 /couchdb/branches/form/etc/default/couchdb:729440-730015 -/couchdb/trunk/etc/default/couchdb:758717,760442,760503,760532,760535,760537-760539,761343,761347-761348,761352-761353,761355,762016,765420,766347 +/couchdb/trunk/etc/default/couchdb:758717,760442,760503,760532,760535,760537-760539,761343,761347-761348,761352-761353,761355,762016,765420,766347,766353 /incubator/couchdb/trunk/etc/default/couchdb:642419-694440 Modified: couchdb/branches/0.9.x/src/couchdb/couch_external_manager.erl URL: http://svn.apache.org/viewvc/couchdb/branches/0.9.x/src/couchdb/couch_external_manager.erl?rev=766354&r1=766353&r2=766354&view=diff == --- couchdb/branches/0.9.x/src/couchdb/couch_external_manager.erl (original) +++ couchdb/branches/0.9.x/src/couchdb/couch_external_manager.erl Sat Apr 18 16:36:59 2009 @@ -53,9 +53,9 @@ [] -> case couch_config:get("external", UrlName, nil) of nil -> -Mesg = lists:flatten( +Msg = lists:flatten( io_lib:format("No server configured for ~p.", [UrlName])), -{reply, {error, {unknown_external_server, Mesg}}, Handlers}; +{reply, {error, {unknown_external_server, ?l2b(Msg)}}, Handlers}; Command -> {ok, NewPid} = couch_external_server:start_link(UrlName, Command), true = ets:insert(Handlers, {UrlName, NewPid}),
svn commit: r766353 - in /couchdb/trunk: THANKS src/couchdb/couch_external_manager.erl
Author: davisp Date: Sat Apr 18 16:34:33 2009 New Revision: 766353 URL: http://svn.apache.org/viewvc?rev=766353&view=rev Log: Fixes COUCHDB-311 Returns an _external error as a binary. Modified: couchdb/trunk/THANKS couchdb/trunk/src/couchdb/couch_external_manager.erl Modified: couchdb/trunk/THANKS URL: http://svn.apache.org/viewvc/couchdb/trunk/THANKS?rev=766353&r1=766352&r2=766353&view=diff == --- couchdb/trunk/THANKS (original) +++ couchdb/trunk/THANKS Sat Apr 18 16:34:33 2009 @@ -25,5 +25,6 @@ * Eric Casteleijn * Maarten Thibaut * Florian Ebeling + * Volker Mische For a list of authors see the `AUTHORS` file. Modified: couchdb/trunk/src/couchdb/couch_external_manager.erl URL: http://svn.apache.org/viewvc/couchdb/trunk/src/couchdb/couch_external_manager.erl?rev=766353&r1=766352&r2=766353&view=diff == --- couchdb/trunk/src/couchdb/couch_external_manager.erl (original) +++ couchdb/trunk/src/couchdb/couch_external_manager.erl Sat Apr 18 16:34:33 2009 @@ -53,9 +53,9 @@ [] -> case couch_config:get("external", UrlName, nil) of nil -> -Mesg = lists:flatten( +Msg = lists:flatten( io_lib:format("No server configured for ~p.", [UrlName])), -{reply, {error, {unknown_external_server, Mesg}}, Handlers}; +{reply, {error, {unknown_external_server, ?l2b(Msg)}}, Handlers}; Command -> {ok, NewPid} = couch_external_server:start_link(UrlName, Command), true = ets:insert(Handlers, {UrlName, NewPid}),
svn commit: r766348 - in /couchdb/branches/0.9.x: ./ etc/default/couchdb share/www/script/test/view_errors.js src/couchdb/couch_db.hrl src/couchdb/couch_httpd_view.erl
Author: davisp Date: Sat Apr 18 16:22:55 2009 New Revision: 766348 URL: http://svn.apache.org/viewvc?rev=766348&view=rev Log: Merged 766347 from trunk. Modified: couchdb/branches/0.9.x/ (props changed) couchdb/branches/0.9.x/etc/default/couchdb (props changed) couchdb/branches/0.9.x/share/www/script/test/view_errors.js couchdb/branches/0.9.x/src/couchdb/couch_db.hrl couchdb/branches/0.9.x/src/couchdb/couch_httpd_view.erl Propchange: couchdb/branches/0.9.x/ -- --- svn:mergeinfo (original) +++ svn:mergeinfo Sat Apr 18 16:22:55 2009 @@ -1,3 +1,3 @@ /couchdb/branches/design_resources:751716-751803 /couchdb/branches/form:729440-730015 -/couchdb/trunk:758717,760442,760503,760532,760535,760537-760539,761343,761347-761348,761352-761353,761355,762016,765420 +/couchdb/trunk:758717,760442,760503,760532,760535,760537-760539,761343,761347-761348,761352-761353,761355,762016,765420,766347 Propchange: couchdb/branches/0.9.x/etc/default/couchdb -- --- svn:mergeinfo (original) +++ svn:mergeinfo Sat Apr 18 16:22:55 2009 @@ -1,4 +1,4 @@ /couchdb/branches/design_resources/etc/default/couchdb:751716-751803 /couchdb/branches/form/etc/default/couchdb:729440-730015 -/couchdb/trunk/etc/default/couchdb:758717,760442,760503,760532,760535,760537-760539,761343,761347-761348,761352-761353,761355,762016,765420 +/couchdb/trunk/etc/default/couchdb:758717,760442,760503,760532,760535,760537-760539,761343,761347-761348,761352-761353,761355,762016,765420,766347 /incubator/couchdb/trunk/etc/default/couchdb:642419-694440 Modified: couchdb/branches/0.9.x/share/www/script/test/view_errors.js URL: http://svn.apache.org/viewvc/couchdb/branches/0.9.x/share/www/script/test/view_errors.js?rev=766348&r1=766347&r2=766348&view=diff == --- couchdb/branches/0.9.x/share/www/script/test/view_errors.js (original) +++ couchdb/branches/0.9.x/share/www/script/test/view_errors.js Sat Apr 18 16:22:55 2009 @@ -81,6 +81,14 @@ } try { +db.view("test/no_reduce", {reduce: true}); +T(0 == 1); + } catch(e) { +T(db.last_req.status == 400); +T(e.error == "query_parse_error"); + } + + try { db.view("test/with_reduce", {group: true, reduce: false}); T(0 == 1); } catch(e) { Modified: couchdb/branches/0.9.x/src/couchdb/couch_db.hrl URL: http://svn.apache.org/viewvc/couchdb/branches/0.9.x/src/couchdb/couch_db.hrl?rev=766348&r1=766347&r2=766348&view=diff == --- couchdb/branches/0.9.x/src/couchdb/couch_db.hrl (original) +++ couchdb/branches/0.9.x/src/couchdb/couch_db.hrl Sat Apr 18 16:22:55 2009 @@ -155,6 +155,7 @@ skip = 0, group_level = 0, reduce = true, +req_reduce = false, inclusive_end=true, % aka a closed-interval include_docs = false }). Modified: couchdb/branches/0.9.x/src/couchdb/couch_httpd_view.erl URL: http://svn.apache.org/viewvc/couchdb/branches/0.9.x/src/couchdb/couch_httpd_view.erl?rev=766348&r1=766347&r2=766348&view=diff == --- couchdb/branches/0.9.x/src/couchdb/couch_httpd_view.erl (original) +++ couchdb/branches/0.9.x/src/couchdb/couch_httpd_view.erl Sat Apr 18 16:22:55 2009 @@ -363,9 +363,15 @@ {"inclusive_end", "false"} -> Args#view_query_args{inclusive_end=false}; {"reduce", "true"} -> -Args#view_query_args{reduce=true}; +Args#view_query_args{ +reduce=true, +req_reduce=true +}; {"reduce", "false"} -> -Args#view_query_args{reduce=false}; +Args#view_query_args{ +reduce=false, +req_reduce=true +}; {"include_docs", Value} -> case Value of "true" -> @@ -400,7 +406,18 @@ ok end; _ -> -ok +case QueryArgs#view_query_args.req_reduce of +true -> +case QueryArgs#view_query_args.reduce of +true -> +ErrMsg = <<"Bad URL parameter: reduce=true">>, +throw({query_parse_error, ErrMsg}); +_ -> +ok +end; +_ -> +ok +end end, case Keys of nil ->
svn commit: r766347 - in /couchdb/trunk: share/www/script/test/view_errors.js src/couchdb/couch_db.hrl src/couchdb/couch_httpd_view.erl
Author: davisp Date: Sat Apr 18 16:16:26 2009 New Revision: 766347 URL: http://svn.apache.org/viewvc?rev=766347&view=rev Log: Fixes COUCHDB-322 Specifying reduce=true now returns a 400 error when the view has no reduce function. Modified: couchdb/trunk/share/www/script/test/view_errors.js couchdb/trunk/src/couchdb/couch_db.hrl couchdb/trunk/src/couchdb/couch_httpd_view.erl Modified: couchdb/trunk/share/www/script/test/view_errors.js URL: http://svn.apache.org/viewvc/couchdb/trunk/share/www/script/test/view_errors.js?rev=766347&r1=766346&r2=766347&view=diff == --- couchdb/trunk/share/www/script/test/view_errors.js (original) +++ couchdb/trunk/share/www/script/test/view_errors.js Sat Apr 18 16:16:26 2009 @@ -81,6 +81,14 @@ } try { +db.view("test/no_reduce", {reduce: true}); +T(0 == 1); + } catch(e) { +T(db.last_req.status == 400); +T(e.error == "query_parse_error"); + } + + try { db.view("test/with_reduce", {group: true, reduce: false}); T(0 == 1); } catch(e) { Modified: couchdb/trunk/src/couchdb/couch_db.hrl URL: http://svn.apache.org/viewvc/couchdb/trunk/src/couchdb/couch_db.hrl?rev=766347&r1=766346&r2=766347&view=diff == --- couchdb/trunk/src/couchdb/couch_db.hrl (original) +++ couchdb/trunk/src/couchdb/couch_db.hrl Sat Apr 18 16:16:26 2009 @@ -155,6 +155,7 @@ skip = 0, group_level = 0, reduce = true, +req_reduce = false, inclusive_end=true, % aka a closed-interval include_docs = false }). Modified: couchdb/trunk/src/couchdb/couch_httpd_view.erl URL: http://svn.apache.org/viewvc/couchdb/trunk/src/couchdb/couch_httpd_view.erl?rev=766347&r1=766346&r2=766347&view=diff == --- couchdb/trunk/src/couchdb/couch_httpd_view.erl (original) +++ couchdb/trunk/src/couchdb/couch_httpd_view.erl Sat Apr 18 16:16:26 2009 @@ -364,9 +364,15 @@ {"inclusive_end", "false"} -> Args#view_query_args{inclusive_end=false}; {"reduce", "true"} -> -Args#view_query_args{reduce=true}; +Args#view_query_args{ +reduce=true, +req_reduce=true +}; {"reduce", "false"} -> -Args#view_query_args{reduce=false}; +Args#view_query_args{ +reduce=false, +req_reduce=true +}; {"include_docs", Value} -> case Value of "true" -> @@ -401,7 +407,18 @@ ok end; _ -> -ok +case QueryArgs#view_query_args.req_reduce of +true -> +case QueryArgs#view_query_args.reduce of +true -> +ErrMsg = <<"Bad URL parameter: reduce=true">>, +throw({query_parse_error, ErrMsg}); +_ -> +ok +end; +_ -> +ok +end end, case Keys of nil ->
svn commit: r766340 - in /couchdb/trunk: CHANGES NEWS
Author: nslater Date: Sat Apr 18 15:28:49 2009 New Revision: 766340 URL: http://svn.apache.org/viewvc?rev=766340&view=rev Log: updated for recent changes Modified: couchdb/trunk/CHANGES couchdb/trunk/NEWS Modified: couchdb/trunk/CHANGES URL: http://svn.apache.org/viewvc/couchdb/trunk/CHANGES?rev=766340&r1=766339&r2=766340&view=diff == --- couchdb/trunk/CHANGES (original) +++ couchdb/trunk/CHANGES Sat Apr 18 15:28:49 2009 @@ -6,6 +6,12 @@ This version has not been released yet. +Build and System Integration: + + * Updated ownership and permission advice in `README` for better security. + * The SysV/BSD daemon script now creates the PID directory on each invokation + because PREFIX/var/run might be a temporary filesystem. + Version 0.9.0 - @@ -127,7 +133,7 @@ * The `couchdb` script no longer uses `awk` for configuration checks as this was causing portability problems. - * Updated `sudo` example in the `README` to use the `-i` option, this fixes + * Updated `sudo` example in `README` to use the `-i` option, this fixes problems when invoking from a directory the `couchdb` user cannot access. Futon Utility Client: Modified: couchdb/trunk/NEWS URL: http://svn.apache.org/viewvc/couchdb/trunk/NEWS?rev=766340&r1=766339&r2=766340&view=diff == --- couchdb/trunk/NEWS (original) +++ couchdb/trunk/NEWS Sat Apr 18 15:28:49 2009 @@ -12,6 +12,8 @@ This version has not been released yet. + * Miscellaneous improvements to build, system integration, and portability. + Version 0.9.0 -
svn commit: r766338 - in /couchdb/trunk: README etc/Makefile.am etc/init/couchdb.tpl.in var/Makefile.am
Author: nslater Date: Sat Apr 18 15:20:00 2009 New Revision: 766338 URL: http://svn.apache.org/viewvc?rev=766338&view=rev Log: create /var/run/couchdb during init script Modified: couchdb/trunk/README couchdb/trunk/etc/Makefile.am couchdb/trunk/etc/init/couchdb.tpl.in couchdb/trunk/var/Makefile.am Modified: couchdb/trunk/README URL: http://svn.apache.org/viewvc/couchdb/trunk/README?rev=766338&r1=766337&r2=766338&view=diff == --- couchdb/trunk/README (original) +++ couchdb/trunk/README Sat Apr 18 15:20:00 2009 @@ -150,14 +150,12 @@ chown -R couchdb:couchdb /usr/local/etc/couchdb chown -R couchdb:couchdb /usr/local/var/lib/couchdb chown -R couchdb:couchdb /usr/local/var/log/couchdb -chown -R couchdb:couchdb /usr/local/var/run/couchdb Change the permission of the Apache CouchDB directories by running: chmod -R 0770 /usr/local/etc/couchdb chmod -R 0770 /usr/local/var/lib/couchdb chmod -R 0770 /usr/local/var/log/couchdb -chmod -R 0770 /usr/local/var/run/couchdb Running Manually Modified: couchdb/trunk/etc/Makefile.am URL: http://svn.apache.org/viewvc/couchdb/trunk/etc/Makefile.am?rev=766338&r1=766337&r2=766338&view=diff == --- couchdb/trunk/etc/Makefile.am (original) +++ couchdb/trunk/etc/Makefile.am Sat Apr 18 15:20:00 2009 @@ -44,6 +44,7 @@ -e "s|%bindir%|$(bindir)|" \ -e "s|%sysconfdir%|$(sysconfdir)|" \ -e "s|%localerlangbindir%|$(localerlangbindir)|" \ + -e "s|%localstaterundir%|$(localstaterundir)|" \ -e "s|%couchdb_command_name%|$(couchdb_command_name)|" \ < $< > $@ Modified: couchdb/trunk/etc/init/couchdb.tpl.in URL: http://svn.apache.org/viewvc/couchdb/trunk/etc/init/couchdb.tpl.in?rev=766338&r1=766337&r2=766338&view=diff == --- couchdb/trunk/etc/init/couchdb.tpl.in (original) +++ couchdb/trunk/etc/init/couchdb.tpl.in Sat Apr 18 15:20:00 2009 @@ -30,6 +30,7 @@ SCRIPT_NAME=`basename $0` COUCHDB=%bindir%/%couchdb_command_name% CONFIGURATION_FILE=%sysconfdir%/default/couchdb +RUN_DIR=%localstaterundir% LSB_LIBRARY=/lib/lsb/init-functions if test ! -x $COUCHDB; then @@ -75,7 +76,9 @@ if test -n "$COUCHDB_OPTIONS"; then command="$command $COUCHDB_OPTIONS" fi +mkdir -p "$RUN_DIR" if test -n "$COUCHDB_USER"; then +chown $COUCHDB_USER "$RUN_DIR" if su $COUCHDB_USER -c "$command" > /dev/null; then return $SCRIPT_OK else Modified: couchdb/trunk/var/Makefile.am URL: http://svn.apache.org/viewvc/couchdb/trunk/var/Makefile.am?rev=766338&r1=766337&r2=766338&view=diff == --- couchdb/trunk/var/Makefile.am (original) +++ couchdb/trunk/var/Makefile.am Sat Apr 18 15:20:00 2009 @@ -14,10 +14,8 @@ if test ! "$(mkdir_p)" = ""; then \ $(mkdir_p) "$(DESTDIR)$(localstatelibdir)"; \ $(mkdir_p) "$(DESTDIR)$(localstatelogdir)"; \ - $(mkdir_p) "$(DESTDIR)$(localstaterundir)"; \ else \ echo "WARNING: You may have to create these directories by hand."; \ mkdir -p "$(DESTDIR)$(localstatelibdir)"; \ mkdir -p "$(DESTDIR)$(localstatelogdir)"; \ - mkdir -p "$(DESTDIR)$(localstaterundir)"; \ fi