Cannot parse less version on OpenBSD
huhndev opened this issue · comments
Moin!
I can't run circumflex
on OpenBSD because the parsing of the less
version fails.
x270$ go run main.go
panic: strconv.ParseFloat: parsing "(OpenBSD)": invalid syntax
goroutine 1 [running]:
clx/cli.VerifyLessVersion(0x279)
/home/jhuhn/work/misc/circumflex/cli/cli.go:60 +0x7d
clx/cmd.verifyLess(0x3f?)
/home/jhuhn/work/misc/circumflex/cmd/root.go:124 +0x32
clx/cmd.Root.func1(0xc0001d6d00?, {0x31e8a5?, 0x7?, 0x3105ae?})
/home/jhuhn/work/misc/circumflex/cmd/root.go:45 +0xe7
github.com/spf13/cobra.(*Command).execute(0xc000004c00, {0xc0000240b0, 0x0, 0x0})
/home/jhuhn/go/pkg/mod/github.com/spf13/cobra@v1.7.0/command.go:944 +0x863
github.com/spf13/cobra.(*Command).ExecuteC(0xc000004c00)
/home/jhuhn/go/pkg/mod/github.com/spf13/cobra@v1.7.0/command.go:1068 +0x3a5
github.com/spf13/cobra.(*Command).Execute(0x150e978?)
/home/jhuhn/go/pkg/mod/github.com/spf13/cobra@v1.7.0/command.go:992 +0x13
main.main()
/home/jhuhn/work/misc/circumflex/main.go:7 +0x18
exit status 2
x270$ less --version
less (OpenBSD) (POSIX regular expressions)
Copyright (C) 1984-2012 Mark Nudelman
Modified for use with illumos by Garrett D'Amore.
Copyright 2014 Garrett D'Amore
less comes with NO WARRANTY, to the extent permitted by law.
For information about the terms of redistribution,
see the file named README in the less distribution.
Homepage: https://www.greenwoodsoftware.com/less
Responsible is this line in cli/cli.go
: https://github.com/bensadeh/circumflex/blob/5c9f5776b5c0b92bd42dee35d399e74124e65d23/cli/cli.go#L58C2-L58C2
Hi there!
Thanks for opening this issue with the output from clx
and less --version
. Although the program shouldn't crash, from the output of less --version
, it looks like you are using an old version of less
.
circumflex
depends on the the latest version of less
, which at the time of writing is 643
. Let me know if updating to the latest version fixes the issue.
As for the panic, we should definitely handle the output of less --version
better for OpenBSD. 😅
I don't know if I get something wrong, but you try to parse (OpenBSD)
as a Float what produces a non empty err
variable that is catched and produces a panic.
less(1) is shipped in the OpenBSD base and can't be updated manually.
If circumflex
requires GNU less
than I don't think it will work on OpenBSD at all. At the very least, the parsing would have to be changed.
If I adjust the code and skip the version parsing, then I see the tui but get the following error:
Error while unmarshalling sanitized response: invalid character '<' looking for beginning of value
There is no lesskey-src=/tmp/lesskey1587339264 option ("less --help" for help)
There is no use-color option ("less --help" for help)
There is no -D option ("less --help" for help)
There is no -D option ("less --help" for help)
There is no lesskey-src=/tmp/lesskey1587339264 option ("less --help" for help)
There is no use-color option ("less --help" for help)
There is no -D option ("less --help" for help)
There is no -D option ("less --help" for help)
There is no lesskey-src=/tmp/lesskey1587339264 option ("less --help" for help)
There is no use-color option ("less --help" for help)
There is no -D option ("less --help" for help)
There is no -D option ("less --help" for help)
There are two issues here:
- Bug in parsing of
less --version
. (The parsing shouldn't crash, but checking theless
version to begin with is essential because circumflex depends on features only found in the latest versions ofless
.) - You do not have the latest version of
less
which circumflex depends on.
The first is trivial and can also be avoided with the --no-less-verify
flag, however you still need the latest version of less
.
You do not need to modify the less which was shipped with your system. You can install the latest version of less
using your favorite package manager or you can build the latest of version of less
from source.
You only need to make sure that your PATH
environment variable picks up the newest version of less
before the one that came with your system.
I've added a fix to the parsing in 3.4
. Let me know if you are still having issues after using the latest version of less
.
I can confirm that now the parsing works on OpenBSD.
Could not verify version of less
Required: 633
Current: ?
Re-run clx with the --no-less-verify flag to disable this check
exit status 1
But because OpenBSD's less
is based on a fork of v458 there is no possibility to get clx
to work. I can view the headlines of Hacker News, but if I press enter
nothing happens and after exiting clx
I can see the following:
There is no lesskey-src=/tmp/lesskey2191589355 option ("less --help" for help)
There is no use-color option ("less --help" for help)
There is no -D option ("less --help" for help)
There is no -D option ("less --help" for help)
Either clx
will support the version of less
offered by OpenBSD in the future or clx
will not be usable on OpenBSD. As you already said the most recent version of less
is mandatory, I assume the latter.
Are you able to install the latest version of less
from source?
Closing due to inactivity.