eth-p / bat-extras

Bash scripts that integrate bat with various command line tools.
MIT License
1.22k stars 82 forks source link

awk errors when running `build.sh` #33

Open pepoluan opened 4 years ago

pepoluan commented 4 years ago

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?

eth-p commented 4 years ago

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?

pepoluan commented 4 years ago

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.

eth-p commented 4 years ago

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.