After upgrade to 1.12.3472.0 startingDirectory with forward slashes does not work for WSL any more #16203

Closed
opened 2026-01-31 05:00:37 +00:00 by claunia · 9 comments
Owner

Originally created by @vbrozik on GitHub (Dec 19, 2021).

Windows Terminal version

1.12.3472.0

Windows build number

10.0.19043.0

Other Software

I have both WSL2 and WSL1 with Ubuntu 20.04 images. For both of them after Windows Terminal upgraded form 1.11 preview to 1.12 preview my session starts in the Ubuntu's root directory instead of the directory set in the Terminal's profile:

            {
                "guid": "{2c4de342-38b7-51cf-b940-2309a097f518}",
                "hidden": false,
                "name": "Ubuntu",
                "source": "Windows.Terminal.Wsl",
                "startingDirectory": "//wsl$/Ubuntu/home/vbrozik/"
            },
            {
                "guid": "{07b52e3e-de2c-5db4-bd2d-ba144ed6c273}",
                "hidden": false,
                "name": "Ubuntu-20.04",
                "source": "Windows.Terminal.Wsl",
                "startingDirectory": "//wsl$/Ubuntu-20.04/home/vbrozik/"
            },

The directories exist:

PS C:\Users\vaclav.brozik> cd //wsl$/Ubuntu/home/vbrozik/
PS Microsoft.PowerShell.Core\FileSystem::\\wsl$\Ubuntu\home\vbrozik> cd //wsl$/Ubuntu-20.04/home/vbrozik/
PS Microsoft.PowerShell.Core\FileSystem::\\wsl$\Ubuntu-20.04\home\vbrozik>

The same bug is in the wsl utility itself as I noticed that the --cd switch fails to process the path with forward slashes while backslashes work fine:

PS C:\Users\vaclav.brozik> wsl --cd //wsl$/Ubuntu/home/vbrozik/
vbrozik@EUCZPC6DRGJM2:/$ pwd
/
vbrozik@EUCZPC6DRGJM2:/$ logout
PS C:\Users\vaclav.brozik> wsl --cd \\wsl$\Ubuntu\home\vbrozik\
vbrozik@EUCZPC6DRGJM2:~$ pwd
/home/vbrozik

So if Windows Terminal uses this buggy functionality of the wsl tool the bug propagates to Windows Terminal.

Workaround

After I replaced the slashes with backslashes everything works as expected:

            {
                "guid": "{2c4de342-38b7-51cf-b940-2309a097f518}",
                "hidden": false,
                "name": "Ubuntu",
                "source": "Windows.Terminal.Wsl",
                "startingDirectory": "\\\\wsl$\\Ubuntu\\home\\vbrozik\\"
            },
            {
                "guid": "{07b52e3e-de2c-5db4-bd2d-ba144ed6c273}",
                "hidden": false,
                "name": "Ubuntu-20.04",
                "source": "Windows.Terminal.Wsl",
                "startingDirectory": "\\\\wsl$\\Ubuntu-20.04\\home\\vbrozik\\"
            },

Steps to reproduce

Use forward slashes in the startingDirectory property of a WSL profile in Windows Terminal - for example //wsl$/Ubuntu/home/username/.

Expected Behavior

The interactive shell running in WSL should have the working directory as configured in the startingDirectory property.

Actual Behavior

The interactive shell running in WSL has the root directory as the working directory.

Originally created by @vbrozik on GitHub (Dec 19, 2021). ### Windows Terminal version 1.12.3472.0 ### Windows build number 10.0.19043.0 ### Other Software I have both WSL2 and WSL1 with Ubuntu 20.04 images. For both of them after Windows Terminal upgraded form 1.11 preview to 1.12 preview my session starts in the Ubuntu's root directory instead of the directory set in the Terminal's profile: ``` JSON { "guid": "{2c4de342-38b7-51cf-b940-2309a097f518}", "hidden": false, "name": "Ubuntu", "source": "Windows.Terminal.Wsl", "startingDirectory": "//wsl$/Ubuntu/home/vbrozik/" }, { "guid": "{07b52e3e-de2c-5db4-bd2d-ba144ed6c273}", "hidden": false, "name": "Ubuntu-20.04", "source": "Windows.Terminal.Wsl", "startingDirectory": "//wsl$/Ubuntu-20.04/home/vbrozik/" }, ``` The directories exist: ``` terminal PS C:\Users\vaclav.brozik> cd //wsl$/Ubuntu/home/vbrozik/ PS Microsoft.PowerShell.Core\FileSystem::\\wsl$\Ubuntu\home\vbrozik> cd //wsl$/Ubuntu-20.04/home/vbrozik/ PS Microsoft.PowerShell.Core\FileSystem::\\wsl$\Ubuntu-20.04\home\vbrozik> ``` The same bug is in the `wsl` utility itself as I noticed that the `--cd` switch fails to process the path with forward slashes while backslashes work fine: ``` PS C:\Users\vaclav.brozik> wsl --cd //wsl$/Ubuntu/home/vbrozik/ vbrozik@EUCZPC6DRGJM2:/$ pwd / vbrozik@EUCZPC6DRGJM2:/$ logout PS C:\Users\vaclav.brozik> wsl --cd \\wsl$\Ubuntu\home\vbrozik\ vbrozik@EUCZPC6DRGJM2:~$ pwd /home/vbrozik ``` So if Windows Terminal uses this buggy functionality of the `wsl` tool the bug propagates to Windows Terminal. ### Workaround After I replaced the slashes with backslashes everything works as expected: ``` JSON { "guid": "{2c4de342-38b7-51cf-b940-2309a097f518}", "hidden": false, "name": "Ubuntu", "source": "Windows.Terminal.Wsl", "startingDirectory": "\\\\wsl$\\Ubuntu\\home\\vbrozik\\" }, { "guid": "{07b52e3e-de2c-5db4-bd2d-ba144ed6c273}", "hidden": false, "name": "Ubuntu-20.04", "source": "Windows.Terminal.Wsl", "startingDirectory": "\\\\wsl$\\Ubuntu-20.04\\home\\vbrozik\\" }, ``` ### Steps to reproduce Use forward slashes in the `startingDirectory` property of a WSL profile in Windows Terminal - for example `//wsl$/Ubuntu/home/username/`. ### Expected Behavior The interactive shell running in WSL should have the working directory as configured in the `startingDirectory` property. ### Actual Behavior The interactive shell running in WSL has the root directory as the working directory.
Author
Owner

@jarcane commented on GitHub (Dec 20, 2021):

I'm having this same issue, and attempting the workaround with backslashes doesn't work for me either, I just get an error:

The system cannot find the path specified.

[process exited with code 4294967295]

I've tried a number of different permutations and regardless, I still just get it defaulting to root / instead of ~.

@jarcane commented on GitHub (Dec 20, 2021): I'm having this same issue, and attempting the workaround with backslashes doesn't work for me either, I just get an error: ``` The system cannot find the path specified. [process exited with code 4294967295] ``` I've tried a number of different permutations and regardless, I still just get it defaulting to root `/` instead of `~`.
Author
Owner

@floh96 commented on GitHub (Dec 20, 2021):

solution in https://github.com/microsoft/terminal/issues/11812#issuecomment-977198964

@floh96 commented on GitHub (Dec 20, 2021): solution in https://github.com/microsoft/terminal/issues/11812#issuecomment-977198964
Author
Owner

@vbrozik commented on GitHub (Dec 20, 2021):

Thank you for the link. I was unable to find the ticket before opening this one (probably I searched only for opened cases...)

Anyway I do not think that removing support of forward slashes in the path is a good decision. Windows normally support forward slashes in the path. Why Windows Terminal should support only the (weird - as I see it) file path with backslashes?

I did not notice this breaking change in the release notes but it is there (v1.11.2421.0):

  • Terminal will now try to launch WSL by moving the startingDirectory to the command line (#9223)
    • If you are on a newer version of Windows, you will be able to set the starting directory to ~ or any Linux path!

It should have been mentioned that the change breaks things.

I think that a proper implementation should clearly differentiate the path specification for Windows and for the target system. It should not be mixed in the same property.

@vbrozik commented on GitHub (Dec 20, 2021): Thank you for the link. I was unable to find the ticket before opening this one (probably I searched only for opened cases...) Anyway I do not think that removing support of forward slashes in the path is a good decision. Windows normally support forward slashes in the path. Why Windows Terminal should support only the (weird - as I see it) file path with backslashes? I did not notice this breaking change in the release notes but it is there ([v1.11.2421.0](https://github.com/microsoft/terminal/releases/tag/v1.11.2421.0)): * Terminal will now try to launch WSL by moving the `startingDirectory` to the command line (#9223) * If you are on a newer version of Windows, you will be able to set the starting directory to `~` or any Linux path! It should have been mentioned that the change breaks things. I think that a proper implementation should clearly differentiate the path specification for Windows and for the target system. It should not be mixed in the same property.
Author
Owner

@vbrozik commented on GitHub (Dec 20, 2021):

BTW

Putting ~ into startingDirectory fails:

The system cannot find the file specified.

[process exited with code 4294967295 (0xffffffff)]

While wsl.exe accepts it:

PS C:\Users\vaclav.brozik> wsl --cd ~
vbrozik@EUCZPC6DRGJM2:~$

This should be a separate bug-issue for Windows Terminal.

@vbrozik commented on GitHub (Dec 20, 2021): BTW Putting `~` into `startingDirectory` fails: ``` The system cannot find the file specified. [process exited with code 4294967295 (0xffffffff)] ``` While `wsl.exe` accepts it: ``` PS C:\Users\vaclav.brozik> wsl --cd ~ vbrozik@EUCZPC6DRGJM2:~$ ``` This should be a separate bug-issue for Windows Terminal.
Author
Owner

@zadjii-msft commented on GitHub (Dec 20, 2021):

idea: we add //wsl$ to the heuristic - if we see that, clearly, the user wanted a windows-style path.

The ~ thing is tracked elsewhere on the repo already

@zadjii-msft commented on GitHub (Dec 20, 2021): idea: we add `//wsl$` to the heuristic - if we see that, clearly, the user wanted a windows-style path. The `~` thing is tracked elsewhere on the repo already
Author
Owner

@timotius02 commented on GitHub (Dec 24, 2021):

Is there anyone working on this? Just ran into these issues after following the instructions here: https://docs.microsoft.com/en-us/windows/terminal/troubleshooting.
Also wanted to know going forward if the recommended method of setting startingDirectory is via unix style paths or windows style especially since windows style paths is broken right now.

I wanted to just set startingDirectory to '~' but it seems like from #11432 it will take a while for that capability to land.

@timotius02 commented on GitHub (Dec 24, 2021): Is there anyone working on this? Just ran into these issues after following the instructions here: https://docs.microsoft.com/en-us/windows/terminal/troubleshooting. Also wanted to know going forward if the recommended method of setting startingDirectory is via unix style paths or windows style especially since windows style paths is broken right now. I wanted to just set startingDirectory to '~' but it seems like from #11432 it will take a while for that capability to land.
Author
Owner

@zadjii-msft commented on GitHub (Dec 24, 2021):

Is there anyone working on this?

not currently, we're all out for the holidays. This (and #11432) are both things we should resolve before shipping 1.13 (or moving this feature to stable)

@zadjii-msft commented on GitHub (Dec 24, 2021): > Is there anyone working on this? not currently, we're all out for the holidays. This (and #11432) are both things we should resolve before shipping 1.13 (or moving this feature to stable)
Author
Owner

@timotius02 commented on GitHub (Dec 25, 2021):

Oh of course, I didn't expect anyone to be working during the holidays. I just wanted to know if someone was already working on a fix or was already assigned to work on this.

Was just looking for a good project during the break and thought this might be a good way to get my feet wet with contributing to this project.

@timotius02 commented on GitHub (Dec 25, 2021): Oh of course, I didn't expect anyone to be working during the holidays. I just wanted to know if someone was already working on a fix or was already assigned to work on this. Was just looking for a good project during the break and thought this might be a good way to get my feet wet with contributing to this project.
Author
Owner

@ghost commented on GitHub (Feb 3, 2022):

:tada:This issue was addressed in #12102, which has now been successfully released as Windows Terminal Preview v1.13.10336.0.🎉

Handy links:

@ghost commented on GitHub (Feb 3, 2022): :tada:This issue was addressed in #12102, which has now been successfully released as `Windows Terminal Preview v1.13.10336.0`.:tada: Handy links: * [Release Notes](https://github.com/microsoft/terminal/releases/tag/v1.13.10336.0) * [Store Download](https://www.microsoft.com/store/apps/9n8g5rfz9xk3?cid=storebadge&ocid=badge)
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#16203