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

Permanent error on a weird environment #4378

Closed
3 tasks done
NoNameWasDefined opened this issue Jan 23, 2025 · 6 comments
Closed
3 tasks done

Permanent error on a weird environment #4378

NoNameWasDefined opened this issue Jan 23, 2025 · 6 comments
Labels
Resolution-Answered Question is answered

Comments

@NoNameWasDefined
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

eecechechoecho echo techo teecho tesecho test
test
PS /datardatarcom. termux/files/home/powershe11s
oops, something went wrong,
Please report this bug with ALL the details below, incle
ding both the Environment' and 'Exception' sections,
Please report on GitHub: https://github.com/PowerShe11 P
SReadLine/issues/new?template=Bug_Report.yaml
Thank you!


e# Environment
PSReadLine: 2-3.5+2cc85806c561a9395751a96a818e8ff1592d19
f7
PowerShell: 7.4.6
05: Linux 4.9.118-g6a9461f9460c #1 SMP PREEMPT Fri Dec 2
7 00:53:22 WIC 2024
BufferWidth: 56
BufferHeight: 28


Last 0 Keys:


### Exception


System.I0.IOException: The system cannot open the device
or file specified, : 'PSReadLineHistoryFile_644434342"
at System, Threading,Mutex,CreateMutexCore(Boolean ini
tiallyOwned, String_name, Boolean& createdNew)
at System,Threading,Mutex,,ctor(Boolean initiallyowne
String name)
at Microsoft.PowerShell.PSConsoleReadLine.DelayedOneT
ImeInitialize(
at Microsoft. PowerShell, PSConsoleReadLine.Initialize(
Runspace runspace, EngineIntrinsics engineIntrinsics)
at Microsoft. PowerShell. PSConsoleReadLine.ReadLine(Ru
nspace runspace, EngineIntrinsics engineIntrinsics, Canc
ellationToken cancellationToken, Nullable`1 lastRunStatu
$)

Screenshot

N/A

Environment data

Cannot get any output from any command.
I think that PSReadLine cannot get the values

Steps to reproduce

I'm trying to build PowerShell on an unsupported environment so first I tried to patch the current version of PowerShell to "work". I'm using Termux (an Android terminal emulator) with GlibC shell (glibc-runner, an implementation of GLIBC in Termux) and patched ELF files with patchelf. glibc libs path: /data/data/com.termux/files/usr/glibc/lib/ ; native (Android Bionic libc) libs path : /data/data/com.termux/files/usr/lib/

Expected behavior

Just a "working" shell.

Actual behavior

Each character input makes all the command appended to the end like for Write-Host "Test": WWrWriWritWriteWrite-Write-H....
Impossible to leave the shell using ^D or ^C.
I get the error at each line input (pressing the Return key)

@microsoft-github-policy-service microsoft-github-policy-service bot added the Needs-Triage 🔍 It's a new issue that core contributor team needs to triage. label Jan 23, 2025
@daxian-dbw
Copy link
Member

There is nothing we can do for unsupported terminals. As for the history file issue shown in the exception message, it could be caused by:

  1. Your disk storage is full
  2. The file system is readonly
  3. Change the permission on /private/tmp, see Cannot start powershell because of missing file on mac #3768 (comment) for details.

@daxian-dbw daxian-dbw added Resolution-Answered Question is answered and removed Needs-Triage 🔍 It's a new issue that core contributor team needs to triage. labels Jan 23, 2025
@NoNameWasDefined
Copy link
Author

/private/tmp doesn't exist and / is readonly.

@daxian-dbw
Copy link
Member

Unfortunately, PSReadLine always try creating a mutex for history file on startup and thus doesn't work on a read-only filesystem.

@NoNameWasDefined
Copy link
Author

Android is very restrictive, it would work if it tried to write the history somewhere in $PREFIX (/data/data/com.termux/files/usr/)

@daxian-dbw
Copy link
Member

IIRC, PowerShell itself will create some caching files when starting up or when doing some common operation (like module analysis will be triggered by a command discovery and tries to write to a cache file), how did you work around all that?

@NoNameWasDefined
Copy link
Author

I don't know. It's just a supposition.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Resolution-Answered Question is answered
Projects
None yet
Development

No branches or pull requests

2 participants