Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sudo su <user> to a user with pwsh as their default shell leads to an exception around PSReadLineHistoryFile #3692

Open
3 tasks done
stoic-tcramer opened this issue May 18, 2023 · 0 comments
Labels
Area-Stability Label for tracking stability Issues Issue-Bug It either shouldn't be doing this or needs an investigation. issue-mutex The mutex creation issue on macOS

Comments

@stoic-tcramer
Copy link

Prerequisites

  • Write a descriptive title.
  • Make sure you are able to repro it on the latest released version
  • Search the existing issues, especially the pinned issues.

Exception report

Oops, something went wrong.
Please report this bug with ALL the details below, including both the 'Environment' and 'Exception' sections.
Please report on GitHub: https://github.com/PowerShell/PSReadLine/issues/new?template=Bug_Report.yaml
Thank you!

### Environment
PSReadLine: 2.2.6
PowerShell: 7.3.4
OS: Linux 5.15.0-1019-azure #24~20.04.1-Ubuntu SMP Tue Aug 23 15:52:52 UTC 2022
BufferWidth: 299
BufferHeight: 68

Last 0 Keys:



### Exception

System.IO.IOException: The system cannot open the device or file specified. : 'PSReadLineHistoryFile_3434894495'
   at System.Threading.Mutex.CreateMutexCore(Boolean initiallyOwned, String name, Boolean& createdNew)
   at Microsoft.PowerShell.PSConsoleReadLine.DelayedOneTimeInitialize()
   at Microsoft.PowerShell.PSConsoleReadLine.Initialize(Runspace runspace, EngineIntrinsics engineIntrinsics)
   at Microsoft.PowerShell.PSConsoleReadLine.ReadLine(Runspace runspace, EngineIntrinsics engineIntrinsics, CancellationToken cancellationToken, Nullable`1 lastRunStatus)

Screenshot

PS /p4/tcramer/root> whoami
tcramer
PS /p4/tcramer/root> sudo su user2
PowerShell 7.3.4
PS /p4/user2/root>
Oops, something went wrong.

Environment data

PS Version: 7.3.4
PS HostName: ConsoleHost
PSReadLine Version: 2.2.6
PSReadLine EditMode: Emacs
OS: Linux bf-p4scratch 5.15.0-1019-azure #24~20.04.1-Ubuntu SMP Tue Aug 23 15:52:52 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux
BufferWidth: 299
BufferHeight: 68

Steps to reproduce

Install Powershell on Ubuntu
Set a user's shell to pwsh (in the above it's set to /snap/powershell/current/opt/powershell/pwsh)
sudo su from another user with sudo access

Expected behavior

A powershell prompt running under the provided to the sudo su command with no exceptions

Actual behavior

The above exception is thrown

@ghost ghost added the Needs-Triage 🔍 It's a new issue that core contributor team needs to triage. label May 18, 2023
@StevenBucher98 StevenBucher98 added Area-Stability Label for tracking stability Issues Issue-Bug It either shouldn't be doing this or needs an investigation. labels May 22, 2023
@StevenBucher98 StevenBucher98 added issue-mutex The mutex creation issue on macOS and removed Needs-Triage 🔍 It's a new issue that core contributor team needs to triage. labels Aug 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-Stability Label for tracking stability Issues Issue-Bug It either shouldn't be doing this or needs an investigation. issue-mutex The mutex creation issue on macOS
Projects
None yet
Development

No branches or pull requests

2 participants