[PR #12437] [MERGED] Don't ever allow ~ as a startingDirectory #29032

Open
opened 2026-01-31 09:32:22 +00:00 by claunia · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/microsoft/terminal/pull/12437
Author: @zadjii-msft
Created: 2/8/2022
Status: Merged
Merged: 2/9/2022
Merged by: @undefined

Base: mainHead: dev/migrie/b/12353-manglemanglemangle


📝 Commits (3)

  • 015084f Don't ever allow ~ as a startingDirectory
  • cb8b22a tis was unused
  • baedfe7 Update src/types/utils.cpp

📊 Changes

2 files changed (+32 additions, -1 deletions)

View changed files

📝 src/types/ut_types/UtilsTests.cpp (+24 -0)
📝 src/types/utils.cpp (+8 -1)

📄 Description

Basically, some WSL distros ship fragments that replace the commandline with the executable for their distro (ubuntu.exe, etc.). We didn't expect that when we changed the startingDirectory for them all to ~.

Unfortunately, ~ is really never a valid path for a process on windows, so those distros would now fail with

[error 2147942667 (0x8007010b) when launching `ubuntu1804.exe']
Could not access starting directory "~"

If we find that we were unable to mangle ~ into the user's WSL commandline, then we will re-evaluate that startingDirectory as %USERPROFILE%, which is at least something sensible, if albeit not what they wanted.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/microsoft/terminal/pull/12437 **Author:** [@zadjii-msft](https://github.com/zadjii-msft) **Created:** 2/8/2022 **Status:** ✅ Merged **Merged:** 2/9/2022 **Merged by:** [@undefined](undefined) **Base:** `main` ← **Head:** `dev/migrie/b/12353-manglemanglemangle` --- ### 📝 Commits (3) - [`015084f`](https://github.com/microsoft/terminal/commit/015084f5051b4e2ecc349aa3ad5cf162d9cb669f) Don't ever allow `~` as a startingDirectory - [`cb8b22a`](https://github.com/microsoft/terminal/commit/cb8b22a82f8fc6f7af96bedc5ff90bcf1e72895a) tis was unused - [`baedfe7`](https://github.com/microsoft/terminal/commit/baedfe70812dc8ccf18f381fc238733376068249) Update src/types/utils.cpp ### 📊 Changes **2 files changed** (+32 additions, -1 deletions) <details> <summary>View changed files</summary> 📝 `src/types/ut_types/UtilsTests.cpp` (+24 -0) 📝 `src/types/utils.cpp` (+8 -1) </details> ### 📄 Description Basically, some WSL distros ship fragments that replace the `commandline` with the executable for their distro (`ubuntu.exe`, etc.). We didn't expect that when we changed the `startingDirectory` for them all to `~`. Unfortunately, `~` is really never a valid path for a process on windows, so those distros would now fail with ``` [error 2147942667 (0x8007010b) when launching `ubuntu1804.exe'] Could not access starting directory "~" ``` If we find that we were unable to mangle `~` into the user's WSL `commandline`, then we will re-evaluate that `startingDirectory` as `%USERPROFILE%`, which is at least something sensible, if albeit not what they wanted. * regressed in #12315 * [x] Closes #12353 * [x] Tested with a (`ubuntu1804.exe`, `~`) profile - launched successfully, where 1.13 in market fails. * [x] added tests --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
claunia added the pull-request label 2026-01-31 09:32:22 +00:00
Sign in to join this conversation.
No Label pull-request
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#29032