{"action":"opened","number":76,"pull_request":{"url":"https://api.github.com/repos/TACC/Lmod/pulls/76","id":46065341,"html_url":"https://github.com/TACC/Lmod/pull/76","diff_url":"https://github.com/TACC/Lmod/pull/76.diff","patch_url":"https://github.com/TACC/Lmod/pull/76.patch","issue_url":"https://api.github.com/repos/TACC/Lmod/issues/76","number":76,"state":"open","locked":false,"title":"Also escape $ in shell variables","user":{"login":"opoplawski","id":814662,"avatar_url":"https://avatars.githubusercontent.com/u/814662?v=3","gravatar_id":"","url":"https://api.github.com/users/opoplawski","html_url":"https://github.com/opoplawski","followers_url":"https://api.github.com/users/opoplawski/followers","following_url":"https://api.github.com/users/opoplawski/following{/other_user}","gists_url":"https://api.github.com/users/opoplawski/gists{/gist_id}","starred_url":"https://api.github.com/users/opoplawski/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/opoplawski/subscriptions","organizations_url":"https://api.github.com/users/opoplawski/orgs","repos_url":"https://api.github.com/users/opoplawski/repos","events_url":"https://api.github.com/users/opoplawski/events{/privacy}","received_events_url":"https://api.github.com/users/opoplawski/received_events","type":"User","site_admin":false},"body":"I've been playing around with trying to manipulate a user's prompt when loading a modulefile. However, we have a tricky prompt that uses the __git_ps1 function to show the git branch in the prompt:\r\n~~~~~\r\nexport PS1='[\\u@\\h \\W$(__git_ps1 \" (%s)\")]\\$ '\r\n~~~~~\r\nIf we do a pushenv('PS1',..) in a modulefile, on unload we get:\r\n~~~~~\r\nbash: command substitution: line -48: syntax error near unexpected token `('\r\nbash: command substitution: line -48: `__git_ps1 \\\" (%s)\\\")]\\\\$ \"'\r\n~~~~~\r\naccording to set -x, lmod is emitting:\r\n~~~~~\r\n'PS1=\"[\\\\u@\\\\h' '\\\\W$(__git_ps1' '\\\"' '(%s)\\\")]\\\\$' '\";' export 'PS1;'\r\n~~~~~\r\nwhich just doesn't work. module --debug shows:\r\n~~~~~\r\npushenv(PS1, (conda/prompt)nil){\r\nMasterControl:popenv(\"PS1\", \"(conda/prompt)nil\"){\r\nstackName: __LMOD_STACK_PS1 pop()\r\nVar:prt((1) Var:pop()){\r\nname: \"__LMOD_STACK_PS1\"\r\nimin: \"1\"\r\nimax: \"2\"\r\nvalue: \"KGNvbmRhL3Byb21wdCluaWw=:W1x1QFxoIFxXJChfX2dpdF9wczEgIiAoJXMpIildXCQg\"\r\n\"KGNvbmRhL3Byb21wdCluaWw=\": {1, 0}\r\n\"W1x1QFxoIFxXJChfX2dpdF9wczEgIiAoJXMpIildXCQg\": {2, 0}\r\n\r\n} Var:prt\r\nv: 1, imin: 1, min2: inf\r\nv: 2, imin: 1, min2: inf\r\nimin: 1, min2: 2\r\nVar:prt((2) Var:pop()){\r\nname: \"__LMOD_STACK_PS1\"\r\nimin: \"2\"\r\nimax: \"2\"\r\nvalue: \"KGNvbmRhL3Byb21wdCluaWw=:W1x1QFxoIFxXJChfX2dpdF9wczEgIiAoJXMpIildXCQg\"\r\n\"W1x1QFxoIFxXJChfX2dpdF9wczEgIiAoJXMpIildXCQg\": {2, 0}\r\n\r\n} Var:prt\r\nv: [\\u@\\h \\W$(__git_ps1 \" (%s)\")]\\$\r\n} MasterControl:popenv\r\n\r\nBaseShell:expand(tbl){\r\n...\r\nPS1=\"[\\\\u@\\\\h \\\\W$(__git_ps1 \\\" (%s)\\\")]\\\\$ \";\r\n~~~~~\r\nThis is with Lmod 6.0.10.\r\n\r\nLooks like it is using the lua %q format option to format the string, but this isn't working in this case.\r\n\r\nLooks like %q is not escaping $ which needs to be done. This works:\r\n~~~~~\r\nPS1=\"[\\\\u@\\\\h \\\\W\\$(__git_ps1 \\\" (%s)\\\")]\\\\\\$ \";\r\n~~~~~\r\nSo this PR adds that quoting.  This also allows setenv('VAR','a$b') to work.\r\n","created_at":"2015-09-25T22:36:40Z","updated_at":"2015-09-25T22:36:40Z","closed_at":null,"merged_at":null,"merge_commit_sha":null,"assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/TACC/Lmod/pulls/76/commits","review_comments_url":"https://api.github.com/repos/TACC/Lmod/pulls/76/comments","review_comment_url":"https://api.github.com/repos/TACC/Lmod/pulls/comments{/number}","comments_url":"https://api.github.com/repos/TACC/Lmod/issues/76/comments","statuses_url":"https://api.github.com/repos/TACC/Lmod/statuses/aaa5444f053443ca0e1dba3595cf19e177db8a7f","head":{"label":"opoplawski:quote","ref":"quote","sha":"aaa5444f053443ca0e1dba3595cf19e177db8a7f","user":{"login":"opoplawski","id":814662,"avatar_url":"https://avatars.githubusercontent.com/u/814662?v=3","gravatar_id":"","url":"https://api.github.com/users/opoplawski","html_url":"https://github.com/opoplawski","followers_url":"https://api.github.com/users/opoplawski/followers","following_url":"https://api.github.com/users/opoplawski/following{/other_user}","gists_url":"https://api.github.com/users/opoplawski/gists{/gist_id}","starred_url":"https://api.github.com/users/opoplawski/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/opoplawski/subscriptions","organizations_url":"https://api.github.com/users/opoplawski/orgs","repos_url":"https://api.github.com/users/opoplawski/repos","events_url":"https://api.github.com/users/opoplawski/events{/privacy}","received_events_url":"https://api.github.com/users/opoplawski/received_events","type":"User","site_admin":false},"repo":{"id":38832806,"name":"Lmod","full_name":"opoplawski/Lmod","owner":{"login":"opoplawski","id":814662,"avatar_url":"https://avatars.githubusercontent.com/u/814662?v=3","gravatar_id":"","url":"https://api.github.com/users/opoplawski","html_url":"https://github.com/opoplawski","followers_url":"https://api.github.com/users/opoplawski/followers","following_url":"https://api.github.com/users/opoplawski/following{/other_user}","gists_url":"https://api.github.com/users/opoplawski/gists{/gist_id}","starred_url":"https://api.github.com/users/opoplawski/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/opoplawski/subscriptions","organizations_url":"https://api.github.com/users/opoplawski/orgs","repos_url":"https://api.github.com/users/opoplawski/repos","events_url":"https://api.github.com/users/opoplawski/events{/privacy}","received_events_url":"https://api.github.com/users/opoplawski/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/opoplawski/Lmod","description":"Lmod: An Environment Module System based on Lua, Reads TCL Modules, Supports a Software Hierarchy","fork":true,"url":"https://api.github.com/repos/opoplawski/Lmod","forks_url":"https://api.github.com/repos/opoplawski/Lmod/forks","keys_url":"https://api.github.com/repos/opoplawski/Lmod/keys{/key_id}","collaborators_url":"https://api.github.com/repos/opoplawski/Lmod/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/opoplawski/Lmod/teams","hooks_url":"https://api.github.com/repos/opoplawski/Lmod/hooks","issue_events_url":"https://api.github.com/repos/opoplawski/Lmod/issues/events{/number}","events_url":"https://api.github.com/repos/opoplawski/Lmod/events","assignees_url":"https://api.github.com/repos/opoplawski/Lmod/assignees{/user}","branches_url":"https://api.github.com/repos/opoplawski/Lmod/branches{/branch}","tags_url":"https://api.github.com/repos/opoplawski/Lmod/tags","blobs_url":"https://api.github.com/repos/opoplawski/Lmod/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/opoplawski/Lmod/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/opoplawski/Lmod/git/refs{/sha}","trees_url":"https://api.github.com/repos/opoplawski/Lmod/git/trees{/sha}","statuses_url":"https://api.github.com/repos/opoplawski/Lmod/statuses/{sha}","languages_url":"https://api.github.com/repos/opoplawski/Lmod/languages","stargazers_url":"https://api.github.com/repos/opoplawski/Lmod/stargazers","contributors_url":"https://api.github.com/repos/opoplawski/Lmod/contributors","subscribers_url":"https://api.github.com/repos/opoplawski/Lmod/subscribers","subscription_url":"https://api.github.com/repos/opoplawski/Lmod/subscription","commits_url":"https://api.github.com/repos/opoplawski/Lmod/commits{/sha}","git_commits_url":"https://api.github.com/repos/opoplawski/Lmod/git/commits{/sha}","comments_url":"https://api.github.com/repos/opoplawski/Lmod/comments{/number}","issue_comment_url":"https://api.github.com/repos/opoplawski/Lmod/issues/comments{/number}","contents_url":"https://api.github.com/repos/opoplawski/Lmod/contents/{+path}","compare_url":"https://api.github.com/repos/opoplawski/Lmod/compare/{base}...{head}","merges_url":"https://api.github.com/repos/opoplawski/Lmod/merges","archive_url":"https://api.github.com/repos/opoplawski/Lmod/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/opoplawski/Lmod/downloads","issues_url":"https://api.github.com/repos/opoplawski/Lmod/issues{/number}","pulls_url":"https://api.github.com/repos/opoplawski/Lmod/pulls{/number}","milestones_url":"https://api.github.com/repos/opoplawski/Lmod/milestones{/number}","notifications_url":"https://api.github.com/repos/opoplawski/Lmod/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/opoplawski/Lmod/labels{/name}","releases_url":"https://api.github.com/repos/opoplawski/Lmod/releases{/id}","created_at":"2015-07-09T16:41:11Z","updated_at":"2015-07-09T16:41:14Z","pushed_at":"2015-09-25T22:33:41Z","git_url":"git://github.com/opoplawski/Lmod.git","ssh_url":"git@github.com:opoplawski/Lmod.git","clone_url":"https://github.com/opoplawski/Lmod.git","svn_url":"https://github.com/opoplawski/Lmod","homepage":"www.tacc.utexas.edu/tacc-projects/lmod","size":15692,"stargazers_count":0,"watchers_count":0,"language":"Lua","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"TACC:master","ref":"master","sha":"c39c09fdc505e842f20f1c7a6180cffcb54a6637","user":{"login":"TACC","id":840408,"avatar_url":"https://avatars.githubusercontent.com/u/840408?v=3","gravatar_id":"","url":"https://api.github.com/users/TACC","html_url":"https://github.com/TACC","followers_url":"https://api.github.com/users/TACC/followers","following_url":"https://api.github.com/users/TACC/following{/other_user}","gists_url":"https://api.github.com/users/TACC/gists{/gist_id}","starred_url":"https://api.github.com/users/TACC/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/TACC/subscriptions","organizations_url":"https://api.github.com/users/TACC/orgs","repos_url":"https://api.github.com/users/TACC/repos","events_url":"https://api.github.com/users/TACC/events{/privacy}","received_events_url":"https://api.github.com/users/TACC/received_events","type":"Organization","site_admin":false},"repo":{"id":9381512,"name":"Lmod","full_name":"TACC/Lmod","owner":{"login":"TACC","id":840408,"avatar_url":"https://avatars.githubusercontent.com/u/840408?v=3","gravatar_id":"","url":"https://api.github.com/users/TACC","html_url":"https://github.com/TACC","followers_url":"https://api.github.com/users/TACC/followers","following_url":"https://api.github.com/users/TACC/following{/other_user}","gists_url":"https://api.github.com/users/TACC/gists{/gist_id}","starred_url":"https://api.github.com/users/TACC/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/TACC/subscriptions","organizations_url":"https://api.github.com/users/TACC/orgs","repos_url":"https://api.github.com/users/TACC/repos","events_url":"https://api.github.com/users/TACC/events{/privacy}","received_events_url":"https://api.github.com/users/TACC/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/TACC/Lmod","description":"Lmod: An Environment Module System based on Lua, Reads TCL Modules, Supports a Software Hierarchy","fork":false,"url":"https://api.github.com/repos/TACC/Lmod","forks_url":"https://api.github.com/repos/TACC/Lmod/forks","keys_url":"https://api.github.com/repos/TACC/Lmod/keys{/key_id}","collaborators_url":"https://api.github.com/repos/TACC/Lmod/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/TACC/Lmod/teams","hooks_url":"https://api.github.com/repos/TACC/Lmod/hooks","issue_events_url":"https://api.github.com/repos/TACC/Lmod/issues/events{/number}","events_url":"https://api.github.com/repos/TACC/Lmod/events","assignees_url":"https://api.github.com/repos/TACC/Lmod/assignees{/user}","branches_url":"https://api.github.com/repos/TACC/Lmod/branches{/branch}","tags_url":"https://api.github.com/repos/TACC/Lmod/tags","blobs_url":"https://api.github.com/repos/TACC/Lmod/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/TACC/Lmod/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/TACC/Lmod/git/refs{/sha}","trees_url":"https://api.github.com/repos/TACC/Lmod/git/trees{/sha}","statuses_url":"https://api.github.com/repos/TACC/Lmod/statuses/{sha}","languages_url":"https://api.github.com/repos/TACC/Lmod/languages","stargazers_url":"https://api.github.com/repos/TACC/Lmod/stargazers","contributors_url":"https://api.github.com/repos/TACC/Lmod/contributors","subscribers_url":"https://api.github.com/repos/TACC/Lmod/subscribers","subscription_url":"https://api.github.com/repos/TACC/Lmod/subscription","commits_url":"https://api.github.com/repos/TACC/Lmod/commits{/sha}","git_commits_url":"https://api.github.com/repos/TACC/Lmod/git/commits{/sha}","comments_url":"https://api.github.com/repos/TACC/Lmod/comments{/number}","issue_comment_url":"https://api.github.com/repos/TACC/Lmod/issues/comments{/number}","contents_url":"https://api.github.com/repos/TACC/Lmod/contents/{+path}","compare_url":"https://api.github.com/repos/TACC/Lmod/compare/{base}...{head}","merges_url":"https://api.github.com/repos/TACC/Lmod/merges","archive_url":"https://api.github.com/repos/TACC/Lmod/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/TACC/Lmod/downloads","issues_url":"https://api.github.com/repos/TACC/Lmod/issues{/number}","pulls_url":"https://api.github.com/repos/TACC/Lmod/pulls{/number}","milestones_url":"https://api.github.com/repos/TACC/Lmod/milestones{/number}","notifications_url":"https://api.github.com/repos/TACC/Lmod/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/TACC/Lmod/labels{/name}","releases_url":"https://api.github.com/repos/TACC/Lmod/releases{/id}","created_at":"2013-04-11T22:17:13Z","updated_at":"2015-09-05T10:51:04Z","pushed_at":"2015-09-07T22:28:05Z","git_url":"git://github.com/TACC/Lmod.git","ssh_url":"git@github.com:TACC/Lmod.git","clone_url":"https://github.com/TACC/Lmod.git","svn_url":"https://github.com/TACC/Lmod","homepage":"www.tacc.utexas.edu/tacc-projects/lmod","size":28603,"stargazers_count":61,"watchers_count":61,"language":"Lua","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":19,"mirror_url":null,"open_issues_count":12,"forks":19,"open_issues":12,"watchers":61,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/TACC/Lmod/pulls/76"},"html":{"href":"https://github.com/TACC/Lmod/pull/76"},"issue":{"href":"https://api.github.com/repos/TACC/Lmod/issues/76"},"comments":{"href":"https://api.github.com/repos/TACC/Lmod/issues/76/comments"},"review_comments":{"href":"https://api.github.com/repos/TACC/Lmod/pulls/76/comments"},"review_comment":{"href":"https://api.github.com/repos/TACC/Lmod/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/TACC/Lmod/pulls/76/commits"},"statuses":{"href":"https://api.github.com/repos/TACC/Lmod/statuses/aaa5444f053443ca0e1dba3595cf19e177db8a7f"}},"merged":false,"mergeable":null,"mergeable_state":"unknown","merged_by":null,"comments":0,"review_comments":0,"commits":1,"additions":13,"deletions":3,"changed_files":4}}