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

pipes broken with coreutils xontrib #2

Open
aspieln3r opened this issue Sep 12, 2021 · 12 comments
Open

pipes broken with coreutils xontrib #2

aspieln3r opened this issue Sep 12, 2021 · 12 comments
Labels
bug Something isn't working

Comments

@aspieln3r
Copy link

aspieln3r commented Sep 12, 2021

xonfig

# XONSH WEBCONFIG START
$XONSH_COLOR_STYLE = 'monokai'
$PROMPT = '{env_name}{BOLD_#6df797}{user}@{hostname}{CYAN} {cwd}{branch_color}{curr_branch: {}}{RESET} {BOLD_#7d8dff}{prompt_end}{RESET} '
xontrib load abbrevs argcomplete bashisms coreutils kitty pipeliner z
# XONSH WEBCONFIG END

$LS_COLORS='rs=0:di=01;36:ln=01;36:mh=00:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=40;31;01:su=37;41:sg=30;43:ca=30;41:tw=30;42:ow=34;42:st=37;44:ex=01;32:'

# Coloured man page support
# using 'less' env vars (format is '\E[<brightness>;<colour>m')
$LESS_TERMCAP_mb = "\033[01;31m"     # begin blinking
$LESS_TERMCAP_md = "\033[01;31m"     # begin bold
$LESS_TERMCAP_me = "\033[0m"         # end mode
$LESS_TERMCAP_so = "\033[01;44;36m"  # begin standout-mode (bottom of screen)
$LESS_TERMCAP_se = "\033[0m"         # end standout-mode
$LESS_TERMCAP_us = "\033[00;36m"     # begin underline
$LESS_TERMCAP_ue = "\033[0m"         # end underline

# custom colors
from xonsh.tools import register_custom_style
mystyle = {
    "Token.PTK.AutoSuggestion" : "#c2961f",
}
register_custom_style("mystyle", mystyle, base="monokai")
$XONSH_COLOR_STYLE="mystyle"

# aliases
aliases['la']='ls -al'
aliases['ra']='ranger'
aliases["mimeset"]="mimetype -d"
aliases["rscp"]="rsync -ah --info=progress2"
aliases["update"]="sudo pacman -Syu"
aliases["remove"]="sudo pacman -Rns"
aliases["pin"]="sudo pacman -S"
aliases["cdh"]="cd ~/Home"
aliases["vim"]="nvim"
aliases["pamcan"]="pacman"
aliases["nord"]="nordvpn"
aliases["vimdiff"]="nvim -d"
aliases["iconf"]="nvim ~/.config/i3/config"
aliases["zconf"]="nvim ~/.zshrc"
aliases["ip"]="ip -c"
aliases["la"]="ls -alh"
aliases["ll"]="ls -lh"
aliases["rconf"]="vim ~/.config/ranger/rc.conf"
aliases["copy"]="rsync -ah --info=progress2 "
aliases["ra"]="ranger"
#aliases["grep"]="grep --color"
aliases["du"]="du -h"
aliases["df"]="df -h"
aliases["pgrep"]="pgrep -a"
aliases["pkgsort"]="expac --timefmt='%Y-%m-%d %T' '%l\t%n'|sort -n"
aliases["pinfo"]="yay -Si"
aliases["psize"]="expac  -sH M '%-30n %m' | sort -rhk 2 | head -30"
aliases["clear2"]="sudo paccache -rk 2"
aliases["pkglist"]="pacman -Qq | fzf --preview 'pacman -Qil {}' --layout=reverse --bind 'enter:execute(pacman -Qil {} | less)'"
aliases["restart-plasma"]="plasmashell --replace > /dev/null 2>&1 & disown"
aliases["restart-kwin"]="DISPLAY=:0 kwin_x11 --replace > /dev/null 2>&1 & disown"
aliases["lln"]="ls -lhtr "
aliases["llan"]="ls -alhtr"

Expected Behavior

piping just works like in other shells

Current Behavior

pipes work for some commands but hangs shell for others. ctrl z makes the job background and returns to zonsh.
jobs return:
[1]+ running: echo hai | grep hai (149404)
fg doesnt do anything if grep but opens an empty window if it was a command piped to less and pressing q quits like in normal less window

Traceback (if applicable)

no traceback as shell hangs

Steps to Reproduce

following commands doesnt work
cat /etc/resolv.conf | less
echo hai | grep hai

following works
ls | grep filename
more textfile | grep string
I'm using arch linux

> xonsh -V
xonsh/0.10.0

For community

⬇️ Please click the 👍 reaction instead of leaving a +1 or 👍 comment

@aspieln3r
Copy link
Author

cat /etc/resolv.conf | more freezes shell completely. ctrl +z or c doesnt work

@gforsyth
Copy link

Hey @aspieln3r -- thanks for reporting! Can you try upgrading to 0.10.1?
I'm also on arch and can't reproduce these hangs

@aspieln3r
Copy link
Author

I'm already using latest on community. Will update once 0.10.1 hits repo

@anki-code
Copy link
Member

hi @aspieln3r! I also can't reproduce this.
Could you please run bash then run xonsh --no-rc and test the command.
If it works test your RC-file line by line to catch the error.

@anki-code anki-code reopened this Sep 16, 2021
@aspieln3r
Copy link
Author

aspieln3r commented Sep 16, 2021

@anki-code I tried it and everything works well if I disable xontrib load coreutils. That also explains why I got issue with only cat and echo. Issue is present in 0.10.1 too

@aspieln3r aspieln3r changed the title pipes broken pipes broken with coreutils xontrib Sep 16, 2021
@anki-code
Copy link
Member

anki-code commented Sep 16, 2021

@aspieln3r why you need coreutils xontrib on Arch? This xontrib mostly for Windows users.

@aspieln3r
Copy link
Author

From https://xon.sh/xontribs.html#coreutils

In many cases, these may have a lower performance overhead than the posix command line utility with the same name. This is because these tools avoid the need for a full subprocess call. Additionally, these tools are cross-platform.

So I thought it wouldn't hurt using that.

@anki-code anki-code added the bug Something isn't working label Sep 16, 2021
@Mic92
Copy link

Mic92 commented May 29, 2022

I think this affects all aliases for this matter.

which ls | grep ls

also hangs.

@Mic92
Copy link

Mic92 commented May 29, 2022

❯ xonsh --no-rc

                                                               Welcome to the xonsh shell 0.12.4

                                                             ~ Tab completion in Alderaan places ~

# ...

joerg@turingmachine ~ master $ def command(args, stdin, stdout):
..............................     print("foo", file=stdout)
..............................
joerg@turingmachine ~ master $ aliases["command"] = command
joerg@turingmachine ~master $ del command
joerg@turingmachine ~master $ command | grep foo # this will hang until one presses `ctrl-c`

@Mic92
Copy link

Mic92 commented May 29, 2022

It seems that even pipeliner hangs for me:

turingmachine in dotfiles on  master via 🐍 v3.9.12 via ❄️  impure (nix-shell)
❯ xontrib load pipeliner

turingmachine in dotfiles on  master via 🐍 v3.9.12 via ❄️  impure (nix-shell)
❯ ls -1 / | pl "line + ' is here'" | head -n 3

@yaxollum
Copy link
Member

@Mic92 Could you please try setting $THREAD_SUBPROCS=True and then running those commands?

@anki-code anki-code transferred this issue from xonsh/xonsh Feb 14, 2023
@Mic92
Copy link

Mic92 commented Jun 15, 2023

Sorry. Stopped using xonsh.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

5 participants