{"thread":{"id":"61441","subject":"$PWD expanding to incorrect value Podman run command","startedAt":"2024-05-09T14:06:29Z","lastAt":"2024-05-09T21:32:42Z","messageCount":2,"participants":["dev@dev.maltese.cc","brian m. carlson"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"494346","messageId":"21209940.11022921.1715263583414@email.ionos.com","threadId":"61441","inReplyTo":null,"subject":"$PWD expanding to incorrect value Podman run command","fromName":"","fromEmail":"dev@dev.maltese.cc","sentAt":"2024-05-09T14:06:23Z","receivedAt":"2024-05-09T14:06:29Z","isPatch":false,"sender":{"key":"dev@dev.maltese.cc","avatar":null},"body":"Thank you for filling out a Git bug report!\nPlease answer the following questions to help us understand your issue.\n\nWhat did you do before the bug happened? (Steps to reproduce your issue)\nInstalled podman and executed: \"$ podman run -p 8081:80 -v $PWD:/usr/share/nginx/html nginx\"\n\nWhat did you expect to happen? (Expected behavior)\nExpected the nginx image to run and map the current directory to the '/usr/share/nginx/html' directory.\n\nWhat happened instead? (Actual behavior)\nReceived the error \"Error: invalid container path \"\\\\Program Files\\\\Git\\\\usr\\\\share\\\\nginx\\\\html\", must be an absolute path\".\n\nWhat's different between what you expected and what actually happened?\nI expected the docker $PWD (or ${PWD} or $(pwd) or $HOME) to expand to the actual working directory, but it seems to expand to the directory of the gitbash executable.\n\nAnything else you want to add:\n\nPlease review the rest of the bug report below.\nYou can delete any lines you don't wish to share.\n\n\n[System Info]\ngit version:\ngit version 2.41.0.windows.1\ncpu: x86_64\nbuilt from commit: ff94e79c4724635915dbb3d4ba38f6bb91528260\nsizeof-long: 4\nsizeof-size_t: 8\nshell-path: /bin/sh\nfeature: fsmonitor--daemon\nuname: Windows 10.0 19045 \ncompiler info: gnuc: 13.1\nlibc info: no libc information available\n$SHELL (typically, interactive shell): C:\\Program Files\\Git\\usr\\bin\\bash.exe\n\n\n[Enabled Hooks]\nnot run from a git repository - no hooks to show\n"},{"id":"494382","messageId":"Zj1A8MsBRejNm_IF@tapette.crustytoothpaste.net","threadId":"61441","inReplyTo":"21209940.11022921.1715263583414@email.ionos.com","subject":"Re: $PWD expanding to incorrect value Podman run command","fromName":"brian m. carlson","fromEmail":"sandals@crustytoothpaste.net","sentAt":"2024-05-09T21:32:32Z","receivedAt":"2024-05-09T21:32:42Z","isPatch":false,"sender":{"key":"sandals@crustytoothpaste.net","avatar":"https://avatars.githubusercontent.com/u/497054?v=4"},"body":"On 2024-05-09 at 14:06:23, dev@dev.maltese.cc wrote:\n>    Thank you for filling out a Git bug report!\n>    Please answer the following questions to help us understand your issue.\n>     \n>    What did you do before the bug happened? (Steps to reproduce your issue)\n>    Installed podman and executed: \"$ podman run -p 8081:80 -v\n>    $PWD:/usr/share/nginx/html nginx\"\n>     \n>    What did you expect to happen? (Expected behavior)\n>    Expected the nginx image to run and map the current directory to the\n>    '/usr/share/nginx/html' directory.\n>     \n>    What happened instead? (Actual behavior)\n>    Received the error \"Error: invalid container path \"\\\\Program\n>    Files\\\\Git\\\\usr\\\\share\\\\nginx\\\\html\", must be an absolute path\".\n>     \n>    What's different between what you expected and what actually happened?\n>    I expected the docker $PWD (or ${PWD} or $(pwd) or $HOME) to expand to the\n>    actual working directory, but it seems to expand to the directory of the\n>    gitbash executable.\n\nThis isn't really a Git bug; it's more of a difference with how the\nMSYS2 runtime shipped with Git for Windows works.  Note that the Git\nproject doesn't ship binaries or any software other than Git itself; Git\nfor Windows is the distributor of that and can be reached at\nhttps://github.com/git-for-windows/git.\n\nHowever, the reason you're seeing this is because most programs on\nWindows don't accept the Unix-style paths that MSYS2 and Git Bash\nprovide, so to placate them, Git Bash converts paths that start with a\nslash into Windows-style paths.  The root directory for Git Bash is the\nGit installation directory, so when you write `/usr/share/nginx/html`,\nGit Bash turns that into `C:\\Program Files\\Git\\usr\\share\\nginx\\html`.\nThe `$PWD` is not necessarily related here, although it may undergo the\nsame expansion.\n\nIf you don't want that behaviour, then you can use a double slash (e.g.,\n`//usr/share/nginx/html`), or you can set `MSYS_NO_PATHCONV=1`, like so:\n\n  MSYS_NO_PATHCONV=1podman run -p 8081:80 -v $PWD:/usr/share/nginx/html nginx\n\nNote that you probably _do_ want `$PWD` to undergo expansion with MSYS,\nthough, so you may want to do this instead (untested):\n\n  MSYS_NO_PATHCONV=1podman run -p 8081:80 -v \"$(cygpath -w \"$PWD\"):/usr/share/nginx/html\" nginx\n\nIf you have more questions about this, I'd reach out to the Git for\nWindows folks.\n-- \nbrian m. carlson (they/them or he/him)\nToronto, Ontario, CA\n"}]}