Opening a pwsh session on Linux can fail while using su
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 3/5
- Tiempo estimado
- 1-2 días
- Aptitud para principiantes
- 45/100
Línea de trabajo
The exception is raised from Mutex creation inside PSConsoleReadLine.DelayedOneTimeInitialize(), which names the mutex after the history file. Start there and check how the history path is derived from the environment, including XDG_RUNTIME_DIR. To reproduce, set XDG_RUNTIME_DIR to a directory the current user cannot read and start pwsh. Done when startup no longer throws in that case and the fallback behaviour is covered by a test.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
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.4.5
PowerShell: 7.6.9
OS: AlmaLinux 9.8 (Olive Jaguar)
BufferWidth: 235
BufferHeight: 71
Last 0 Keys:
### Exception
System.IO.IOException: The system cannot open the device or file specified. : 'PSReadLineHistoryFile_3685172568'. One or more system calls failed: lstat("/run/user/1001/.dotnet", ...) == -1; errno == EACCES;
at System.Threading.Mutex.CreateMutexCore(Boolean initiallyOwned, String name, NamedWaitHandleOptionsInternal options, Boolean& createdNew)
at System.Threading.Mutex..ctor(Boolean initiallyOwned, String name)
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
[imagine a command line with pwsh as the only input]
Environment data
PS Version: 7.6.9
PS HostName: ConsoleHost
PSReadLine Version: 2.4.5
PSReadLine EditMode: Emacs
OS: Linux redacted 5.14.0-687.61.1.el9_8.x86_64 #1 SMP PREEMPT_DYNAMIC Mon Oct 26 20:10:21 EDT 2026 x86_64 x86_64 x86_64 GNU/Linux
BufferWidth: 235
BufferHeight: 71
Steps to reproduce
- login as any user (uid 1001 in this case)
- su to another user (uid 1004 in this case)
-> watch the error
Expected behavior
pwsh launches as expected
Actual behavior
XDG_RUNTIME_DIR=/run/user/1001 is still set, so the call goes out to stat a directory we don't have access to. This should be handled gracefully and not surface the exception
If you use "su - ", dropping the environment vars, everything works as expected
- Lenguaje dominante
- C#
- Estrellas
- 4.4k
- Forks
- 346
- Métricas de merge de PR
- Sin PR fusionados en 30 d
Preparar el entorno
- Sin Dockerfile ni archivo de Docker Compose
- Tiene una plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de PowerShell/PSReadLine
-
Get-PSReadLineOption emits the ListView window-size warning, so prompt modules trigger it on every shell startPosiblemente ocupada @thc1006 la tomó hace 77 días. AbiertoNeeds-Triage :mag:
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
PowerShell/PSReadLine#5205 ·
-
Needs-Triage :mag:
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
PowerShell/PSReadLine#5195 ·
-
Needs-Triage :mag:
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
PowerShell/PSReadLine#5121 ·
-
Needs-Triage :mag:
Dificultad 2/5 1-3 horas Aptitud para principiantes 64/100
PowerShell/PSReadLine#5045 ·
-
Area-CommandHelp Issue-Enhancement
Dificultad 1/5 Menos de una hora Aptitud para principiantes 68/100
PowerShell/PSReadLine#3470 · 3 reacciones ·
Todos los issues de PowerShell/PSReadLine
Issues similares
-
area-templates triage:bot-seen triage:needs-human
Dificultad 2/5 1-3 horas Aptitud para principiantes 75/100
microsoft/aspire#22356 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
Needs-Triage
Dificultad 2/5 1-3 horas Aptitud para principiantes 84/100
PowerShell/PowerShell#28432 · 1 comentario · 1 reacción ·
Los mantenedores suelen responder en 1 día
-
documentation
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
microsoft/aspire.dev#2184 ·
Los mantenedores suelen responder en 2 días
-
area-controls-refreshview platform/ios s/triaged
Dificultad 2/5 1-3 horas Aptitud para principiantes 74/100
dotnet/maui#40314 · 1 reacción ·
Los mantenedores suelen responder en 1 día
-
Needs: Triage (Functions) v5 v5-preview5
Dificultad 2/5 1-3 horas Aptitud para principiantes 70/100
Azure/azure-functions-core-tools#5918 ·
Los mantenedores suelen responder en 1 día