Skip to content

STDIN is always corrupted in com.termux.nix/files/home/.nix-profile/bin/pwsh, and solely when Start-Transcript is active, in org.kde.konsole.flatpakref. #16746

Open

Description

Prerequisites

Steps to reproduce

  1. #!/usr/bin/env sh
    sudo dnf --verbose --debugsolver install powershell-preview
  2. #!/usr/bin/env pwsh
    sudo dnf --verbose --debugsolver install flatpak
    flatpak -vv --ostree-verbose remote-add --installation=default --if-not-exists 'flathub' --from 'https://flathub.org/repo/flathub.flatpakrepo'
    flatpak -vv --ostree-verbose install    --installation=default --or-update     'flathub' 'runtime/org.kde.Sdk//5.15-21.08'
    flatpak -vv --ostree-verbose remote-add --installation=default --if-not-exists 'kdeapps' --from 'https://distribute.kde.org/kdeapps.flatpakrepo'
    flatpak -vv --ostree-verbose install    --installation=default --or-update     'kdeapps' 'app/org.kde.konsole//master'`
    flatpak -vv --ostree-verbose run        --installation=default --log-system-bus --log-session-bus --runtime='org.kde.Sdk' 'app/org.kde.konsole//master'

Expected behavior

[📦 org.kde.konsole /]$ /usr/bin/env /usr/bin/flatpak-spawn --host /usr/bin/env /usr/bin/pwsh -NoExit -Command 'Start-Transcript -Append -NoClobber -IncludeInvocationHeader'
Transcript started, output file is /home/BEEDELLROKEJULIANLOCKHART/PowerShell_transcript.fedora.8w0eKJsQ.20220113224917.txt
PS /> sudo dnf check-update
Failed to set locale, defaulting to C.UTF-8
Last metadata expiration check: 0:43:20 ago on Thu Jan 13 22:06:07 2022.
PS />

Actual behavior

STDIN is corrupted:

[📦 org.kde.konsole /]$ /usr/bin/env /usr/bin/flatpak-spawn --host /usr/bin/env /usr/bin/pwsh -NoExit -Command 'Start-Transcript -Append -NoClobber -IncludeInvocationHeader'
Transcript started, output file is /home/BEEDELLROKEJULIANLOCKHART/PowerShell_transcript.fedora.8w0eKJsQ.20220113224917.txt
PS /> ssusudsudosudo sudo dsudo dnsudo dnfsudo dnf sudo dnf csudo dnf chsudo dnf chesudo dnf checsudo dnf checksudo dnf check-sudo dnf check-usudo dnf check-upsudo dnf check-updsudo dnf check-updasudo dnf check-updatsudo dnf check-update
Failed to set locale, defaulting to C.UTF-8
Last metadata expiration check: 0:43:20 ago on Thu Jan 13 22:06:07 2022.
PS />

Error details

PS /> GGeGetGet-Get-EGet-ErGet-ErrGet-ErroGet-Error

It returns $Null.

Environment data

PS /> $$PSVe$PSVer$PSVers$PSVersi$PSVersio$PSVersion$PSVersionT$PSVersionTa$PSVersionTab$PSVersionTabl$PSVersionTable

Name                           Value
----                           -----
PSVersion                      7.2.1
PSEdition                      Core
GitCommitId                    7.2.1
OS                             Linux 5.15.13-200.fc35.x86_64 #1 SMP Wed Jan 5 16:39:13 UTC 2022
Platform                       Unix
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
WSManStackVersion              3.0

Visuals

No response

Activity

  1. changed the title [-]Corruption of textual presentation during utilisation of '/usr/bin/env /usr/bin/flatpak-spawn --host /usr/bin/env /usr/bin/pwsh -NOEXIT -COMMAND 'START-TRANSCRIPT -APPEND -NOCLOBBER -INCLUDEINVOCATIONHEADER'' after invocation by '/usr/bin/flatpak'.[/-] [+]Corruption of textual presentation during utilisation of '/usr/bin/env /usr/bin/flatpak-spawn --host /usr/bin/env /usr/bin/pwsh'' after invocation by '/usr/bin/flatpak'.[/+] on Jan 13, 2022
  2. beedell-roke commented on Jan 13, 2022

    @beedell-roke
    Author
  3. rkeithhill commented on Jan 20, 2022

    @rkeithhill
    Collaborator

    @BEEDELLROKEJULIANLOCKHART What is your $env:TERM set to?

  4. added
    Waiting on AuthorThe PR was reviewed and requires changes or comments from the author before being accept
    on Jan 21, 2022
  5. ghost closed this as completedon Jan 28, 2022
  6. beedell-roke commented on Jan 29, 2022

    @beedell-roke
    Author

    #issuecomment-1017956625

    Keith Hill (@rkeithhill), it's xterm-256color. Apologies for the wait.

  7. ghost removed
    Waiting on AuthorThe PR was reviewed and requires changes or comments from the author before being accept
    on Jan 29, 2022
  8. rkeithhill commented on Feb 4, 2022

    @rkeithhill
    Collaborator

    Thanks. Just wanted to make sure it wasn't set to an unexpected value which has caused issues with echoing.

  9. changed the title [-]Corruption of textual presentation during utilisation of '/usr/bin/env /usr/bin/flatpak-spawn --host /usr/bin/env /usr/bin/pwsh'' after invocation by '/usr/bin/flatpak'.[/-] [+]Corruption of textual presentation during utilisation the consequence of invocation of ''/usr/bin/env' '/usr/bin/flatpak-spawn' --host '/usr/bin/env' '/usr/bin/pwsh' -noexit -command 'start-transcript -append -noclobber -includeinvocationheader'' after invocation by the consequence of compilation of 'http://src.fedoraproject.org/rpms/flatpak'.[/+] on Mar 4, 2022
  10. beedell-roke commented on Mar 24, 2022

    @beedell-roke
    Author

    #16746 (comment)

    Keith Hill (@rkeithhill), this problem is probably caused by PowerShell, because using file://localhost/data/data/com.termux.nix/files/home/.nix-profile/bin/pwsh 1 via f-droid.org/repo/com.termux_118.apk 2 causes the same problem.

    Footnotes

    1. search.nixos.org/packages?channel=21.11&show=powershell&from=0&size=50&sort=relevance&type=packages&query=powershell ↩

    2. f-droid.org/packages/com.termux ↩

  11. changed the title [-]Corruption of textual presentation during utilisation the consequence of invocation of ''/usr/bin/env' '/usr/bin/flatpak-spawn' --host '/usr/bin/env' '/usr/bin/pwsh' -noexit -command 'start-transcript -append -noclobber -includeinvocationheader'' after invocation by the consequence of compilation of 'http://src.fedoraproject.org/rpms/flatpak'.[/-] [+]Corruption of textual presentation during utilisation of the consequence of compilation of "http://github.com/powershell/powershell".[/+] on Mar 24, 2022
  12. 4 remaining items

  13. beedell-roke commented on Feb 4, 2025

    @beedell-roke
    Author
  14. changed the title [-]Corruption of text display in terminal after invoking `Start-Transcript`.[/-] [+]`STDIN` is corrupted when `Start-Transcript` is active.[/+] on Feb 4, 2025
  15. changed the title [-]`STDIN` is corrupted when `Start-Transcript` is active.[/-] [+]`STDIN` is corrupted when `Start-Transcript` is active, in `org.kde.konsole.flatpakref` and `com.termux.nix/files/home/.nix-profile/bin/pwsh`.[/+] on Feb 15, 2026
  16. changed the title [-]`STDIN` is corrupted when `Start-Transcript` is active, in `org.kde.konsole.flatpakref` and `com.termux.nix/files/home/.nix-profile/bin/pwsh`.[/-] [+]`STDIN` is always corrupted in `com.termux.nix/files/home/.nix-profile/bin/pwsh`, and solely when `Start-Transcript` is active, in `org.kde.konsole.flatpakref`.[/+] on Feb 17, 2026
  17. beedell-roke commented on Feb 17, 2026

    @beedell-roke
    Author

    #event-22838744547

    As nix-community/nix-on-droid/issues/500#issuecomment-3911169455 confirms, this always reproduces with /data/data/com.termux.nix/files/home/.nix-profile/bin/pwsh:

    @.Date.20260217T003729+0000.Type.Video.Origin.Waydroid.webm
  18. iSazonov commented on Feb 17, 2026

    @iSazonov
    Collaborator

    You could disable echo with stty -echo (before or/and inside flatpak).
    Also you could remove RSReadline for test.

  19. beedell-roke commented on Feb 18, 2026

    @beedell-roke
    Author

    Ilya (@iSazonov), although Remove-Module PSReadLine (undesirably) removes text colouration, it, like stty -echo, does remediate this, inside /data/data/com.termux.nix/files/usr/nix/store/nx317a2z1yhp7a9vs337jfnbnniphcbj-powershell-7.4.2/share/powershell/pwsh, inside ../../../gfzfsn0pwbzgj188n21d5r04z80hbswc-bash-interactive-5.2p32/bin/bash: 1

    Image

    …nor flatpak-spawn:

    Image Image

    My apologies if I've not executed those commands correctly.

    Footnotes

    1. nix-community/nix-on-droid/discussions/501#discussioncomment-15833299 ↩

  20. iSazonov commented on Feb 18, 2026

    @iSazonov
    Collaborator

    I guess flatpak hides real terminal and C# application thinks it work with file/stream. You could try flatpak-spawn --host script -q /dev/null -c "pwsh" where script creates real PTY for application.

  21. beedell-roke commented on Feb 18, 2026

    @beedell-roke
    Author

    Ilya (@iSazonov), no luck there, either:

    RokeJulianLockhart@Beedell:~$ flatpak-spawn --host script -q /dev/null -c "pwsh"
    Portal call failed: Failed to start command: Failed to execute child process “script” (No such file or directory)
    RokeJulianLockhart@Beedell:~$ script
    bash: script: command not found...
    Install package 'util-linux-script' to provide command 'script'? [N/y] y
    
    
     * Waiting in queue... 
     * Loading list of packages.... 
    The following packages have to be installed:
     util-linux-script-2.41.3-7.fc43.x86_64 Utilities for creating and replaying typescripts of terminal session
    Proceed with changes? [N/y] y
    
    
     * Waiting in queue... 
     * Waiting for authentication... 
     * Waiting in queue... 
     * Downloading packages... 
     * Requesting data... 
     * Testing changes... 
     * Installing packages... 
    Script started, output log file is 'typescript'.
    RokeJulianLockhart@Beedell:~$ exit
    exit
    Script done.
    
    RokeJulianLockhart@Beedell:~$ flatpak-spawn --host script -q /dev/null -c "pwsh"
    PowerShell 7.5.4
    PS /home/RokeJulianLockhart> exitexitexitexit
  22. beedell-roke commented on Aug 17, 2026

    @beedell-roke
    Author
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    WG-Enginecore PowerShell engine, interpreter, and runtime

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions