eth-p / bat-extras

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

`./build.sh --install --prefix=~/.local` fails #43

Open galou opened 3 years ago

galou commented 3 years ago

./build.sh --install --prefix=~/.local fails with the error

tee: '~/.local/bin/bat-modules': No such file or directory

Copying manually bin/bat-modules to ~/.local/bin does not help.

Commit 0d9468e1cfb263026812decf5371750340e557d5.

eth-p commented 3 years ago

Thanks for reporting this! I just added a fix in eb69d61ff848b22d63ddc6e81c357af5f95aabb5. Please let me know if it works for you.

galou commented 3 years ago

Thanks for the quick fix! ./build.sh now reports that it works (some test fail though) but nothing is to be found in ~/.local/bin. eb69d61 looks to be about missing bin directory but the bin directory exists and existed.

eth-p commented 3 years ago

Hmm... That's weird. I'm not entirely sure what's going on, then. What OS are you using?

The failing tests are also slightly concerning. I have the CI check that they pass when I commit to the master branch, so something is not right there.

faisal-shah commented 3 years ago

I'm getting test failures on my system.

$ uname -a
Linux Shah-OptiPlex-3020 5.4.0-70-generic #78-Ubuntu SMP Fri Mar 19 13:29:52 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux

$ bash --version
GNU bash, version 5.0.17(1)-release (x86_64-pc-linux-gnu)

$ ./build.sh --install --prefix=~/.local
Installing to ~/.local.
Preparing scripts...
Building manuals...
          batdiff.1
          batgrep.1
          batman.1
          batpipe.1
          batwatch.1
          prettybat.1

Building scripts...
    [1/7] /home/user/bat-extras/src/batdiff.sh
          Reading...
          Preprocessing...
          Minifying [skipped]
          Compressing [skipped]
          Building...
          Installing...
    [2/7] /home/user/bat-extras/src/batgrep.sh
          Reading...
          Preprocessing...
          Minifying [skipped]
          Compressing [skipped]
          Building...
          Installing...
    [3/7] /home/user/bat-extras/src/batman.sh
          Reading...
          Preprocessing...
          Minifying [skipped]
          Compressing [skipped]
          Building...
          Installing...
    [4/7] /home/user/bat-extras/src/bat-modules.sh
          Reading...
          Preprocessing...
          Minifying [skipped]
          Compressing [skipped]
          Building...
          Installing...
    [5/7] /home/user/bat-extras/src/batpipe.sh
          Reading...
          Preprocessing...
          Minifying [skipped]
          Compressing [skipped]
          Building...
          Installing...
    [6/7] /home/user/bat-extras/src/batwatch.sh
          Reading...
          Preprocessing...
          Minifying [skipped]
          Compressing [skipped]
          Building...
          Installing...
    [7/7] /home/user/bat-extras/src/prettybat.sh
          Reading...
          Preprocessing...
          Minifying [skipped]
          Compressing [skipped]
          Building...
          Installing...

Verifying scripts...
Submodule 'best' (https://github.com/eth-p/best.git) registered for path '.test-framework'
Cloning into '/home/user/bat-extras/.test-framework'...
batgrep:option_context failed.
batgrep:output_with_color failed.
batgrep:output_without_color failed.
batgrep:regular_file failed.
batgrep:search_fixed failed.
batgrep:search_from_stdin failed.
batgrep:search_regex failed.
batgrep:symlink_file failed.
batpipe:detected_fish_shell failed.
One or more tests failed.
Run './test.sh --failed' for more detailed information.
$ ./test.sh --failed
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
| Test Suite: batgrep                                                                                                                                                                                                                       |
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
[FAIL] option_context       :: Exited with code 2.
[FAIL] output_with_color    :: Exited with code 2.
[FAIL] output_without_color :: Exited with code 2.
[FAIL] regular_file         :: Exited with code 2.
[FAIL] search_fixed         :: Exited with code 2.
[FAIL] search_from_stdin    :: Exited with code 2.
[FAIL] search_regex         :: Exited with code 2.
[FAIL] symlink_file         :: Exited with code 2.

Totals:
    PASS: 1 / 9
    FAIL: 8 / 9
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
| Test Suite: batpipe                                                                                                                                                                                                                       |
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
[FAIL] detected_fish_shell  :: fish was not found on $PATH

Totals:
    PASS: 2 / 3
    FAIL: 1 / 3
eth-p commented 3 years ago

Thanks for bringing this to my attention!

[FAIL] detected_fish_shell  :: fish was not found on $PATH

The above FAIL should now be properly considered SKIP as of eee3156e8a48bdfc7d4c81d802764bb458779fdc.

[FAIL] option_context       :: Exited with code 2.
[FAIL] output_with_color    :: Exited with code 2.
[FAIL] output_without_color :: Exited with code 2.
[FAIL] regular_file         :: Exited with code 2.
[FAIL] search_fixed         :: Exited with code 2.
[FAIL] search_from_stdin    :: Exited with code 2.
[FAIL] search_regex         :: Exited with code 2.
[FAIL] symlink_file         :: Exited with code 2.

That's odd... batgrep only exits with code 2 when it can't find any matches. Can you send me the output of the following, please?

./test.sh --suite=batgrep --repl
eval setup
test test:regular_file
eval pwd
eval ls -la
eval rg --version

That will help me understand the environment it's testing batgrep in, which should help me figure out why it can't seem to find any matches.

faisal-shah commented 3 years ago

$ ./test.sh --suite=batgrep --repl Warning: Snapshot testing is disabled in the REPL. [0]> eval setup [1]> test test:regular_file Finished with FAIL and exit code 2 in 48 ms. Exited with code 2.

STDERR: ─────┬─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────── 1 │ error: Found argument '--no-context-separator' which wasn't expected, or isn't valid in this context 2 │ Did you mean --context-separator? 3 │ 4 │ USAGE: 5 │
6 │ rg [OPTIONS] PATTERN [PATH ...] 7 │ rg [OPTIONS] [-e PATTERN ...] [-f PATTERNFILE ...] [PATH ...] 8 │ rg [OPTIONS] --files [PATH ...] 9 │ rg [OPTIONS] --type-list 10 │ command | rg [OPTIONS] PATTERN 11 │ 12 │ For more information try --help 13 │ ─────┴───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────

[2]> eval pwd /home/user/bat-extras/test/data [3]> eval ls -a . .. .cache batman.1 compressed.txt.gz file.sh file.txt link.txt [4]> eval rg --version ripgrep 11.0.2 -SIMD -AVX (compiled) +SIMD +AVX (runtime) [5]> exit

Thanks for bringing this to my attention!

[FAIL] detected_fish_shell  :: fish was not found on $PATH

The above FAIL should now be properly considered SKIP as of eee3156.

[FAIL] option_context       :: Exited with code 2.
[FAIL] output_with_color    :: Exited with code 2.
[FAIL] output_without_color :: Exited with code 2.
[FAIL] regular_file         :: Exited with code 2.
[FAIL] search_fixed         :: Exited with code 2.
[FAIL] search_from_stdin    :: Exited with code 2.
[FAIL] search_regex         :: Exited with code 2.
[FAIL] symlink_file         :: Exited with code 2.

That's odd... batgrep only exits with code 2 when it can't find any matches. Can you send me the output of the following, please?

./test.sh --suite=batgrep --repl
eval setup
test test:regular_file
eval pwd
eval ls -la
eval rg --version

That will help me understand the environment it's testing batgrep in, which should help me figure out why it can't seem to find any matches.

faisal-shah commented 3 years ago

I think this is the problem: https://github.com/BurntSushi/ripgrep/pull/1390. --no-context-separator was added in ripgrep 12.0.0. I'm on 11.0.2 .

Ubuntu focal only has 11.0.2 in its repos ... Groovy (20.10) and beyond have ripgrep 12+ I believe.

$ lsb_release -a No LSB modules are available. Distributor ID: Ubuntu Description: Ubuntu 20.04.2 LTS Release: 20.04 Codename: focal

eth-p commented 3 years ago

I think this is the problem: https://github.com/BurntSushi/ripgrep/pull/1390. --no-context-separator was added in ripgrep 12.0.0. I'm on 11.0.2 .

That would probably do it, unfortunately.

I guess I'll need to find a way to work around that, or at the very least add an error message about it.

Ubuntu focal only has 11.0.2 in its repos ... Groovy (20.10) and beyond have ripgrep 12+ I believe.

Good to know, thanks! Depending on the outcome of that workaround idea, I'll make a note about that on the docs for batgrep.

eth-p commented 3 years ago

@faisal-shah As of a526c7927be4cbe0da566fa331163c6b64b15ba5, everything should now work correctly.

faisal-shah commented 3 years ago

Thanks!