Skip to content

Conversation

@akinomyoga
Copy link
Contributor

This fixes #4570. See the commit message for details.

@akinomyoga
Copy link
Contributor Author

@LangLangBart @LimingFang Could you check the behavior of this patch?

@LimingFang
Copy link

It seems there's still sth wrong🤔
image

@LangLangBart
Copy link
Contributor

@LangLangBart @LimingFang Could you check the behavior of this patch?

tested with debian 10, the error no longer shows up.

It seems there's still sth wrong🤔

can u share the output from typeset -f __fzf_exec_awk

I believe you need to either compile the fzf binary or source the patched file

@LimingFang
Copy link

Output of typeset -f __fzf_exec_awk is:

__fzf_exec_awk () {
	if [[ -z ${__fzf_awk-} ]]
	then
		__fzf_awk=awk
		if [[ $OSTYPE == solaris* && -x /usr/xpg4/bin/awk ]]
		then
			__fzf_awk=/usr/xpg4/bin/awk
		elif command -v mawk > /dev/null 2>&1
		then
			local n x y z d
			IFS=' .' read -r n x y z d <<< $(command mawk -W version 2> /dev/null)
			[[ $n == mawk ]] && ((d >= 20230302 && (x * 1000 + y) * 1000 + z >= 1003004)) && __fzf_awk=mawk
		fi
	fi
	LC_ALL=C exec "$__fzf_awk" "$@"
}

I just remove my fzf repo and use branch in @akinomyoga 's repo and ./install.
Debian10 too

@akinomyoga
Copy link
Contributor Author

I just remove my fzf repo and use branch in @akinomyoga 's repo and ./install.

Unfortunately, ./install just downloads the latest pre-built binary from the GitHub Release page, so it just installs 0.66.1 regardless of the current working tree of the repository.

@LimingFang
Copy link

LimingFang commented Oct 29, 2025

I just remove my fzf repo and use branch in @akinomyoga 's repo and ./install.

Unfortunately, ./install just downloads the latest pre-built binary from the GitHub Release page, so it just installs 0.66.1 regardless of the current working tree of the repository.

My bad, everything works fine now. cc @LangLangBart

We have been checking the mawk version by extracting <x>, <y>, <z>,
and <d> part from "mawk <x>.<y>.<z> <d>" in the output of the "mawk -W
version" and testing <x>, <y>, <z>, and <d> using an arithmetic
evalaution.  However, <d> is ensured to be an integer only in "x.y.z
>= 1.3.4".  Otherwise, it may cause a syntax error in the arithmetic
evaluation.  The mawk started to include the date as an integer in the
<d> position only from mawk-1.3.3-20090721.  We should first check
that "x.y.z >= 1.3.4" and then check the value of "d".  In case, "mawk
-W version" produces a completely different text, we should also
redirect stderr of the arithmetic commands to /dev/null.
@akinomyoga
Copy link
Contributor Author

Thanks!

@junegunn junegunn merged commit 5cb6957 into junegunn:master Oct 31, 2025
5 checks passed
@junegunn
Copy link
Owner

Thanks!

@akinomyoga akinomyoga deleted the fix-mawk-ver-check branch October 31, 2025 12:16
@akinomyoga
Copy link
Contributor Author

Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

awk's 'bad math expression' error when hitting control-r for reviewing cmd history

4 participants