Couchdb: windows fails to run if installed to a path with spaces in it

Created on 14 Nov 2017  路  7Comments  路  Source: apache/couchdb

If CouchDB is installed to a path with spaces, and on a windows system that doesn't have the 8.3 NTFS filename mapping registry flag set (possibly the default now on newer windows releases than what I have available), then the following pretty stack trace comes up whenever couchjs is summoned:

{{badmatch, {error, {enoent, [{erlang,open_port, [{spawn, "c:/Program Files (x86)/Apache Software Foundation/CouchDB/lib/couch-1.7.1/priv/couchspawnkillable ./couchjs.exe ../share/couchdb/server/main.js"}, [stream,{line,4096},binary,exit_status,hide]], []}, {couch_os_process,init,1, [{file, "c:/cygwin/relax/apache-couchdb-1.7.1/src/couchdb/couch_os_process.erl"}, {line,148}]}, {gen_server,init_it,6,[{file,"gen_server.erl"},{line,306}]}, {proc_lib,init_p_do_apply,3, [{file,"proc_lib.erl"},{line,237}]}]}}}, [{couch_query_servers,new_process,3, [{file, "c:/cygwin/relax/apache-couchdb-1.7.1/src/couchdb/couch_query_servers.erl"}, {line,477}]}, {couch_query_servers,lang_proc,3, [{file, "c:/cygwin/relax/apache-couchdb-1.7.1/src/couchdb/couch_query_servers.erl"}, {line,462}]}, {couch_query_servers,handle_call,3, [{file, "c:/cygwin/relax/apache-couchdb-1.7.1/src/couchdb/couch_query_servers.erl"}, {line,334}]}, {gen_server,try_handle_call,4,[{file,"gen_server.erl"},{line,607}]}, {gen_server,handle_msg,5,[{file,"gen_server.erl"},{line,639}]}, {proc_lib,init_p_do_apply,3,[{file,"proc_lib.erl"},{line,237}]}]}

This is because we use an absolute path to couchspawnkillable.exe in 2 places:

start_port(Command, EnvPairs) ->
    PrivDir = couch_util:priv_dir(),
    Spawnkiller = filename:join(PrivDir, "couchspawnkillable"),

There are a few solutions to this; but the simplest one is to change https://github.com/apache/couchdb/blob/1.7.x/src/couchdb/couch_util.erl#L60 to use os:type/0 and return a regex munged relative path instead. Given that this code branch will only be used on Windows, nobody is taking a performance hit that they didn't already sign up to ;-).

Another alternative is to deny our OTP-ness and move couchspawnkillable.exe during https://github.com/apache/couchdb/blob/1.7.x/src/couchdb/priv/Makefile.am#L136-L137 into ./bin/ as we already do with couchjs.exe, and then invoke couchspawnkillable.exe without any path at all.

I'm cool with either, if somebody feels like picking one option, I'll implement it.

Most helpful comment

One workaround is to install CouchDB 1.7.1 to a path without spaces, such as C:\CouchDB.

All 7 comments

I am facing this problem on Windows with CouchDB 1.7.1 installer.

Another solution is proposed here: https://issues.apache.org/jira/browse/COUCHDB-2768

Anyone available to review https://github.com/apache/couchdb/pull/997?
It's a pretty critical bug as it makes CouchDB 1.7.1 unusable on Windows.

(ping @dch, @willholley, @janl)

One workaround is to install CouchDB 1.7.1 to a path without spaces, such as C:\CouchDB.

@jerem we will fix this in the next release, but I'm not sure whether we really want to do a 1.7.2 just for this. I'll ask the other devs about whether I just patch the windows binary release for this issue, let's continue the discussion on your greatly appreciated PR 馃憦 馃殌

The last comment (Nov 20, 2017) says "we will fix this in the next release" but I see the issue is now closed. Was there a decision made after that last comment to not fix this? As far as I can tell this is still and issue as of the 2.2 release.

@judsonp44 Dave closed the issue because 1.x installers are no longer supported.

2.x has a fix for running the couchjs interpreter in a directory with spaces, but there are other issues that still cause issues on Windows when installing CouchDB to a path with spaces.

Given how constrained we are on supporting the Windows version, we don't have any plans to retrofit support throughout CouchDB for paths with spaces this at this time, which is why this issue remains closed.

There is a very clear warning in the installer that you would have had to have clicked past to install CouchDB into the wrong path.... ;)

Was this page helpful?
0 / 5 - 0 ratings

Related issues

col-panic picture col-panic  路  5Comments

ghost picture ghost  路  5Comments

klaemo picture klaemo  路  3Comments

wohali picture wohali  路  3Comments

denyeart picture denyeart  路  3Comments