bat-extras icon indicating copy to clipboard operation
bat-extras copied to clipboard

awk errors when running `build.sh`

Open pepoluan opened this issue 4 years ago • 3 comments

So I downloaded bat-extras by cloning into my home directory. Afterwards, I ran ./build.sh without any options (and not having shfmt)

I got the following error messages:

Verifying scripts...
Submodule 'best' (https://github.com/eth-p/best.git) registered for path '.test-framework'
Cloning into '/home/pepoluan/Downloads/bat-extras/.test-framework'...
awk: line 12: regular expression compile failed (missing operand)
^(    |\t)()(description|snapshot).*
awk: line 12: regular expression compile failed (missing operand)
^(    |\t)()(description|snapshot).*
awk: line 12: regular expression compile failed (missing operand)
^(    |\t)()(description|snapshot).*
awk: line 12: regular expression compile failed (missing operand)
^(    |\t)()(description|snapshot).*
awk: line 12: regular expression compile failed (missing operand)
^(    |\t)()(description|snapshot).*
awk: line 12: regular expression compile failed (missing operand)
^(    |\t)()(description|snapshot).*
awk: line 12: regular expression compile failed (missing operand)
^(    |\t)()(description|snapshot).*
awk: line 12: regular expression compile failed (missing operand)
^(    |\t)()(description|snapshot).*
awk: line 12: regular expression compile failed (missing operand)
^(    |\t)()(description|snapshot).*
awk: line 12: regular expression compile failed (missing operand)
^(    |\t)()(description|snapshot).*
Verified successfully.

The 'built' files do appear in the bin/ directory, and a quick test of them seems to indicate they all working as expected.

Is this normal?

pepoluan avatar May 18 '20 13:05 pepoluan

That shouldn't be happening, and it looks like it's a bug with the test framework. What platform are you on, and what does awk --version show?

eth-p avatar May 18 '20 13:05 eth-p

I think I know what's the problem.

I did awk --version and it did not return anything. That surprised me, so I did man awk and found out that my Ubuntu 18.04 installation on WSL1 is using mawk instead of gawk.

So I did sudo apt install gawk, verify that gawk is now acting as awk, and the ./build.sh script now runs without error.

tl;dr: Ensure that one is running gawk for awk, not mawk.

pepoluan avatar May 19 '20 03:05 pepoluan

It should also work with BSD awk, but it's good to know about the mawk incompatibility. I'll have to update the test framework to see if it's possible to fix, or otherwise add a warning.

eth-p avatar May 19 '20 04:05 eth-p