thg serve doesn't work if disk path has spaces

Issue #2082 resolved
Benoit Nadeau
created an issue

The "Web Server" command doesn't work with subrepos if the disk path contains spaces.

Here's a small test case. On Mac OS X, but of course the same bug happened from my Windows machine:

$ mkdir "Some Dir" $ cd "Some Dir" $ pwd /Users/benad/Documents/junk/thg_test/Some Dir $ hg init . $ hg init a $ hg init b $ cat > .hgsub a = a b = b $ hg add .hgsub $ hg ci -m "Adding hgsub" $ thg serve

At this point, clicking "Start doesn't work and you see this in the logs: % hg serve --port 8000 --debug --web-conf /var/folders/7r/wdrj1z_48xlglt006s7d5g300000gq/T/thg.CRwtHs/webconf_ZmSdMu [command returned code 255 Tue Aug 14 13:17:17 2012]

$ cat /var/folders/7r/wdrj1z_48xlglt006s7d5g300000gq/T/thg.CRwtHs/webconf_ZmSdMu [paths] Some Dir = /Users/benad/Documents/junk/thg_test/Some Dir Some Dir/a = /Users/benad/Documents/junk/thg_test/Some Dir/a Some Dir/b = /Users/benad/Documents/junk/thg_test/Some Dir/b

Running the command on the console shows the traceback clearly.

Comments (11)

  1. Benoit Nadeau reporter

    I'm on tip of the default branch (48ce38b4cb4f). Also can reproduce on Windows 2.4.2 release. Paste the following in a BASH script and run it:

    mkdir "Some Dir"
    cd "Some Dir"
    hg init .
    hg init a
    hg init b
    echo "a = a" > .hgsub
    echo "b = b" >> .hgsub
    hg add .hgsub
    hg ci -m "Adding hgsub"
    thg serve
  2. Benoit Nadeau reporter

    The errors show up in the logging tab. The server takes a few seconds to stop on its own with the error code. Note that using quotes around the keys in the config file fixes the issue. My guess is that Hg serve doesn't support keys with spaces.

  3. Yuya Nishihara

    Key? I think quoting values should fix the problem. hgwebdir_mod reads path entry as a list of comma/space separated.

    "command returned code 255" is a side effect of this problem, which won't happen if zeroconf is disabled.

  4. Yuya Nishihara

    serve: minimal support for paths containing space or comma (fixes #2082)

    Since hg 8cbb59124e67, each entry of paths is parsed as a list.

    Because we don't have ui.configlist()-compatible function, ServeDialog and WebconfForm cannot parse value as a list. So for now, it only quotes paths in multi-repository (i.e. --web-conf) mode.


  5. Log in to comment