Opened 13 days ago

Closed 12 days ago

#19195 closed bug (fixed)

hrev58270 broke my bash prompt

Reported by: bipolar Owned by: korli
Priority: blocker Milestone: R1/beta6
Component: System/Kernel Version: R1/beta5
Keywords: Cc:
Blocked By: Blocking:
Platform: All

Description

For the last couple of years I have been using the following prompt on my bash profile:

function _git_prompt {
	local __prev_rc_and_loc='\[`if [ $? = 0 ]; then echo "\e[32m"; else echo "\e[31m"; fi`\]\w\[\e[0m\]'
	local __git_branch_color="\[\033[31m\]"
	local __git_branch='`git branch 2> /dev/null | grep -e ^*| sed -E s/^\\\\\*\ \(.+\)$/\(\\\\\1\)\/`'
	local __last_color="\[\033[00m\]"
	export PS1="[$__prev_rc_and_loc $__git_branch_color$__git_branch$__last_color]\n> "
}

_git_prompt

Till hrev58228 in 64 bits (and till hrev58265 on 32 bits), it worked just fine.

But after updating to hrev58270, everytime I open a new Terminal (and after each command issued, of course) now I get:

sed: read error on stdin: Operation would block
grep: (standard input): Operation would block
grep: (standard input): Operation would block

Change History (10)

comment:1 by bipolar, 13 days ago

Mistyped the hrev number on the title/summary. Maintainers, please edit to 58270. Thanks.

comment:2 by humdinger, 13 days ago

Summary: hrev57270 broke my bash prompthrev58270 broke my bash prompt

comment:3 by bipolar, 13 days ago

Seems it also broke my inrecipe() bash function:

function inrecipe {
	find "$HP_REPO_LOCATION" -maxdepth 3 \
		-type d \(-path "$HP_REPO_LOCATION"/repository -o \
			-path "$HP_REPO_LOCATION"/packages \) \
			-prune -o \
		-name "*-*.recipe" -print | xargs grep -ni --col "$1";
	return 0
}

As it now gives:

xargs: errno-buffer safe_read failed in xargs_do_exec (this is probably a bug, please report it): Operation would block
xargs: error closing file

Before showing the same sed/grep error due to the broken prompt.

comment:4 by jmairboeck, 13 days ago

I also wanted to report this, but you were faster than me ;)

There are more symptoms though:

The standard Haiku prompt (coloring based on exit status) is also broken, it is just black. Navigating through the history with arrow keys sometimes deletes part of the prompt.

$(getarch) expands to an empty string (noticed when I wanted to bisect this problem via https://www.haiku-os.org/guides/daily-tasks/updating-system)

and worst of all (for me): haikuporter is broken. It just prints:

'finddir B_USER_CONFIG_DIRECTORY' failed.
Error: Can't evaluate config file: /boot/home/config/settings/haikuports.conf
cut: -: Operation would block

(the third line not always and sometimes after the prompt returned). directly calling finddir works though.

hrev58265 still works. The others in between aren't available as updates.

in reply to:  4 comment:5 by jmairboeck, 13 days ago

Replying to jmairboeck:

The standard Haiku prompt (coloring based on exit status) is also broken, it is just black. Navigating through the history with arrow keys sometimes deletes part of the prompt.

Note that this isn't a Terminal problem, it also doesn't work in Konsole (KF6 version). I tried that too.

comment:6 by waddlesplash, 13 days ago

Component: - GeneralSystem/Kernel
Milestone: UnscheduledR1/beta6
Owner: changed from nobody to korli
Priority: normalblocker
Status: newassigned

comment:7 by korli, 13 days ago

Seems we don't reset O_NONBLOCK correctly.

Using an unused bit in https://review.haiku-os.org/c/haiku/+/8497

I don't have a better idea ATM.

comment:8 by waddlesplash, 13 days ago

Should be fixed in hrev58271, please retest.

comment:9 by bipolar, 12 days ago

Updated to hrev58272 on 64 bits, bug seems indeed to be fixed. Thanks.

comment:10 by korli, 12 days ago

Resolution: fixed
Status: assignedclosed

Thanks for the feedback!

Note: See TracTickets for help on using tickets.