Skip to content
Snippets Groups Projects
  • kiilerix's avatar
    cc021114
    hg-ssh: use shlex for shell-like parsing of SSH_ORIGINAL_COMMAND · cc021114
    kiilerix authored
    The Mercurial ssh protocol is defined as if it was ssh-ing to a shell account on
    an ordinary ssh server, and where hg was available in $PATH and it executed
    the command "hg -R REPOPATH serve --stdio".
    
    The Mercurial ssh client can in most cases just pass REPOPATH to the shell, but
    if it contains unsafe characters the client will have to quote it so the shell
    will pass the right -R value to hg. Correct quoting of repopaths was introduced
    in d8fa35c28335 and tweaked in 86fc364ca5f8.
    
    hg-ssh doesn't create the command via a shell and used a simple parser instead.
    It worked fine for simple paths without any quoting, but if any kind of quoting
    was used it failed to parse the command like the shell would do it.
    
    This makes hg-ssh behave more like a normal shell with hg in the path would do.
    cc021114
    History
    hg-ssh: use shlex for shell-like parsing of SSH_ORIGINAL_COMMAND
    kiilerix authored
    The Mercurial ssh protocol is defined as if it was ssh-ing to a shell account on
    an ordinary ssh server, and where hg was available in $PATH and it executed
    the command "hg -R REPOPATH serve --stdio".
    
    The Mercurial ssh client can in most cases just pass REPOPATH to the shell, but
    if it contains unsafe characters the client will have to quote it so the shell
    will pass the right -R value to hg. Correct quoting of repopaths was introduced
    in d8fa35c28335 and tweaked in 86fc364ca5f8.
    
    hg-ssh doesn't create the command via a shell and used a simple parser instead.
    It worked fine for simple paths without any quoting, but if any kind of quoting
    was used it failed to parse the command like the shell would do it.
    
    This makes hg-ssh behave more like a normal shell with hg in the path would do.