{"action":"created","issue":{"url":"https://api.github.com/repos/rebar/rebar3/issues/652","labels_url":"https://api.github.com/repos/rebar/rebar3/issues/652/labels{/name}","comments_url":"https://api.github.com/repos/rebar/rebar3/issues/652/comments","events_url":"https://api.github.com/repos/rebar/rebar3/issues/652/events","html_url":"https://github.com/rebar/rebar3/pull/652","id":97327280,"number":652,"title":"escape & in paths","user":{"login":"tsloughter","id":36227,"avatar_url":"https://avatars.githubusercontent.com/u/36227?v=3","gravatar_id":"","url":"https://api.github.com/users/tsloughter","html_url":"https://github.com/tsloughter","followers_url":"https://api.github.com/users/tsloughter/followers","following_url":"https://api.github.com/users/tsloughter/following{/other_user}","gists_url":"https://api.github.com/users/tsloughter/gists{/gist_id}","starred_url":"https://api.github.com/users/tsloughter/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tsloughter/subscriptions","organizations_url":"https://api.github.com/users/tsloughter/orgs","repos_url":"https://api.github.com/users/tsloughter/repos","events_url":"https://api.github.com/users/tsloughter/events{/privacy}","received_events_url":"https://api.github.com/users/tsloughter/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":4,"created_at":"2015-07-26T15:25:03Z","updated_at":"2015-07-27T23:13:08Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/rebar/rebar3/pulls/652","html_url":"https://github.com/rebar/rebar3/pull/652","diff_url":"https://github.com/rebar/rebar3/pull/652.diff","patch_url":"https://github.com/rebar/rebar3/pull/652.patch"},"body":""},"comment":{"url":"https://api.github.com/repos/rebar/rebar3/issues/comments/125375968","html_url":"https://github.com/rebar/rebar3/pull/652#issuecomment-125375968","issue_url":"https://api.github.com/repos/rebar/rebar3/issues/652","id":125375968,"user":{"login":"ABooker-cray","id":12973035,"avatar_url":"https://avatars.githubusercontent.com/u/12973035?v=3","gravatar_id":"","url":"https://api.github.com/users/ABooker-cray","html_url":"https://github.com/ABooker-cray","followers_url":"https://api.github.com/users/ABooker-cray/followers","following_url":"https://api.github.com/users/ABooker-cray/following{/other_user}","gists_url":"https://api.github.com/users/ABooker-cray/gists{/gist_id}","starred_url":"https://api.github.com/users/ABooker-cray/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ABooker-cray/subscriptions","organizations_url":"https://api.github.com/users/ABooker-cray/orgs","repos_url":"https://api.github.com/users/ABooker-cray/repos","events_url":"https://api.github.com/users/ABooker-cray/events{/privacy}","received_events_url":"https://api.github.com/users/ABooker-cray/received_events","type":"User","site_admin":false},"created_at":"2015-07-27T23:13:08Z","updated_at":"2015-07-27T23:13:08Z","body":"I'm a github newb and I couldn't find a tsloughter:escape_and branch in my clone of rebar3, even after update.  But patching by hand wasn't exactly difficult. :)\r\n\r\nThe change in escape chars is good.  The other two seem suspect to me; in the shell command line enclosing the word in double quotes will prevent special interpretation of &, so no backslash escaping is needed. And when I try running I get:\r\n$ rebar3 compile\r\n===> Verifying dependencies...\r\n===> sh(cp -R /home/tb/git/E\\&OTP/eotp/apps/tcp_interface/ebin/.gitignore /home/tb/git/E\\&OTP/eotp/apps/tcp_interface/ebin/tcp_interface.app \"/home/tb/git/E\\&OTP/eotp/_build/default/lib/tcp_interface/ebin\")\r\nfailed with return code 1 and the following output:\r\ncp: target ‘/home/tb/git/E\\\\&OTP/eotp/_build/default/lib/tcp_interface/ebin’ is not a directory\r\n\r\nThe naked source lists have a proper escape of the & in the path but now the escape_double_quotes/1 call gets a bad result because it results in /path/to/\\&/file which is wrong. I think in this routine we're just trying to spot characters that will either cause a substition, or interfere with the double quotes we intend to add to the string passed in. & doesn't cause a substition.  In escape_chars/1 we want to alter the processing of specific characters, in which context & is bad since it marks the end of a shell token.  I suspect that ';' should be added there too, since it can also cause havoc, but I'm not currently affected and don't know enough about how rebar3 uses the routine. :)\r\n\r\nIMHO only the escape_chars/1 change is good.\r\n\r\nOh and I went and tested my ';' theory:\r\ntb@park:~$ mkdir ';echo BYEBYE'\r\ntb@park:~$ cd ';echo BYEBYE'\r\ntb@park:~/;echo BYEBYE$ rebar3 new app testy\r\n===> Writing testy/src/testy_app.erl\r\n===> Writing testy/src/testy_sup.erl\r\n===> Writing testy/src/testy.app.src\r\n===> Writing testy/rebar.config\r\n===> Writing testy/.gitignore\r\n===> Writing testy/LICENSE\r\n===> Writing testy/README.md\r\ntb@park:~/;echo BYEBYE$ cd testy\r\ntb@park:~/;echo BYEBYE/testy$ ls\r\nLICENSE  README.md  rebar.config  src\r\ntb@park:~/;echo BYEBYE/testy$ rebar3 clean\r\n===> Cleaning out testy...\r\n<<<<<<<<<This hangs\r\n^C\r\ntb@park:~/;echo BYEBYE/testy$ ls -la\r\ntotal 0\r\ntb@park:~/;echo BYEBYE/testy$ cd ..\r\ncd: error retrieving current directory: getcwd: cannot access parent directories: No such file or directory\r\ntb@park:~/;echo BYEBYE/testy/..$ cd ../..\r\ntb@park:/home$ ls -d *echo*\r\nls: cannot access *echo*: No such file or directory\r\n\r\nThis was an expensive test. :("}}