Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ctpv: config:1:2 cannot handle character: #101

Open
sbzi1020 opened this issue Jul 7, 2024 · 5 comments
Open

ctpv: config:1:2 cannot handle character: #101

sbzi1020 opened this issue Jul 7, 2024 · 5 comments

Comments

@sbzi1020
Copy link

sbzi1020 commented Jul 7, 2024

I'm trying cptv on Fedora Linux Asahi Remix 40 aarch64 on the Apple MacBook Air (13-inch, M2, 2022), linux kernel version is Linux 6.9.6-400.asahi.fc40.aarch64+16k.

Here is the installation process:

#
# Install dependencies for `libmagic` and `libcrypto`
#
sudo dnf install file-libs file-devel openssl-devel

cd ~/temp
git clone --depth=1 [email protected]:NikitaIvanovV/ctpv.git
cd ctpv
make
sudo make install

Compile and install without error:

I  fion | /home/fion/temp/ctpv   make

cc -o src/config.o src/config.c -c -O2 -MMD -Wall -Wextra -Wno-unused-parameter
make -C embed
make[1]: Entering directory '/home/fion/temp/ctpv/embed'
cc     embed.c   -o embed
make[1]: Leaving directory '/home/fion/temp/ctpv/embed'
embed/embed -p prev_scr_ sh/prev/any.sh sh/prev/atool.sh sh/prev/audio.sh sh/prev/bat.sh sh/prev/cat.sh sh/prev/colordiff.sh sh/prev/delta.sh sh/prev/diff_so_fancy.sh sh/prev/elinks.sh sh/prev/font.sh sh/prev/glow.sh sh/prev/gpg.sh sh/prev/highlight.sh sh/prev/image.sh sh/prev/jq.sh sh/prev/libreoffice.sh sh/prev/ls.sh sh/prev/lynx.sh sh/prev/mdcat.sh sh/prev/pdf.sh sh/prev/source_highlight.sh sh/prev/svg.sh sh/prev/symlink.sh sh/prev/torrent.sh sh/prev/video.sh sh/prev/w3m.sh > gen/previews.h
embed/embed help.txt > gen/help.h
cc -o src/ctpv.o src/ctpv.c -c -O2 -MMD -Wall -Wextra -Wno-unused-parameter
src/ctpv.c: In function ‘md5_string’:
src/ctpv.c:175:5: warning: ‘MD5’ is deprecated: Since OpenSSL 3.0 [-Wdeprecated-declarations]
  175 |     MD5((const unsigned char *)s, strlen(s), out);
      |     ^~~
In file included from src/ctpv.c:9:
/usr/include/openssl/md5.h:52:38: note: declared here
   52 | OSSL_DEPRECATEDIN_3_0 unsigned char *MD5(const unsigned char *d, size_t n,
      |                                      ^~~
cc -o src/error.o src/error.c -c -O2 -MMD -Wall -Wextra -Wno-unused-parameter
cc -o src/lexer.o src/lexer.c -c -O2 -MMD -Wall -Wextra -Wno-unused-parameter
src/lexer.c: In function ‘read_while’:
src/lexer.c:208:33: warning: comparison is always true due to limited range of data type [-Wtype-limits]
  208 |     while ((c = peek_char(ctx)) >= 0 && p(c)) {
      |                                 ^~
src/lexer.c: In function ‘read_punct’:
src/lexer.c:323:24: warning: comparison is always false due to limited range of data type [-Wtype-limits]
  323 |     if (peek_char(ctx) == EOF_CHAR)
      |                        ^~
src/lexer.c: In function ‘lexer_get_token’:
src/lexer.c:393:15: warning: comparison is always false due to limited range of data type [-Wtype-limits]
  393 |         if (c == (ch)) {                       \
      |               ^~
src/lexer.c:413:5: note: in expansion of macro ‘ATTEMPT_READ_CHAR’
  413 |     ATTEMPT_READ_CHAR(ctx, tok, EOF_CHAR, TOK_EOF);
      |     ^~~~~~~~~~~~~~~~~
cc -o src/preview.o src/preview.c -c -O2 -MMD -Wall -Wextra -Wno-unused-parameter
embed/embed -p scr_ sh/clear.sh sh/end.sh > gen/server.h
cc -o src/server.o src/server.c -c -O2 -MMD -Wall -Wextra -Wno-unused-parameter
embed/embed -p scr_ sh/helpers.sh > gen/helpers.h
cc -o src/shell.o src/shell.c -c -O2 -MMD -Wall -Wextra -Wno-unused-parameter
cc -o src/ulist.o src/ulist.c -c -O2 -MMD -Wall -Wextra -Wno-unused-parameter
cc -o src/utils.o src/utils.c -c -O2 -MMD -Wall -Wextra -Wno-unused-parameter
cc -o src/vector.o src/vector.c -c -O2 -MMD -Wall -Wextra -Wno-unused-parameter
cc -o ctpv src/config.o src/ctpv.o src/error.o src/lexer.o src/preview.o src/server.o src/shell.o src/ulist.o src/utils.o src/vector.o -lmagic -lcrypto



 I  fion | /home/fion/temp/ctpv   sudo make install
[sudo] password for fion:
make -C embed
make[1]: Entering directory '/home/fion/temp/ctpv/embed'
make[1]: 'embed' is up to date.
make[1]: Leaving directory '/home/fion/temp/ctpv/embed'
make -C quit
make[1]: Entering directory '/home/fion/temp/ctpv/quit'
cc     ctpvquit.c   -o ctpvquit
make[1]: Leaving directory '/home/fion/temp/ctpv/quit'
mkdir -p /usr/local/bin
install ctpv quit/ctpvquit ctpvclear /usr/local/bin
mkdir -p /usr/local/share/man/man1
install -m 0644 doc/ctpv.1 /usr/local/share/man/man1

But it can't preview any text file with this error: ctpv: config:1:2 cannot handle character: ?

bat works fine.

screenshot:

20240707_12h26m47s_grim

@Joyje
Copy link

Joyje commented Nov 16, 2024

We can't really help unless you post the content of your config file. Also, do you get any errors when running ctpv -l?

@sophimoo
Copy link

I get the same issue on a nix vm on a apple M2

my config is as following, cut from a nix module I wrote for it:

        commands = {
          dragon-out = ''%${pkgs.xdragon}/bin/xdragon -a -x "$fx"'';
          editor-open = ''$$EDITOR $f'';
          mkdir = ''
          ''${{
            printf "Directory Name: "
            read DIR
            mkdir $DIR
          }}
          '';
        };

        settings = {
          drawbox = true;
          hidden = true;
          preview = true;
          icons = true;
          mouse = true;
        };

        extraConfig = ''
          set previewer ctpv
          set cleaner ctpvclear
          &ctpv -s $id
          &ctpvquit $id
        '';

      };

Running the command you suggested yields the following:

sophie@nixArmVM ~> ctpv
/etc/profiles/per-user/sophie/bin/ctpv: config:1:2: cannot handle character: �
sophie@nixArmVM ~ [1]> ctpv -l
/etc/profiles/per-user/sophie/bin/ctpv: config:1:2: cannot handle character: �
sophie@nixArmVM ~ [1]> 

image

based on that the only other user having this issue has the same device as me I assume its aarch64 related or smth.

@Joyje
Copy link

Joyje commented Nov 21, 2024

You seem to have posted part of your lfrc rather than your ctpv config. Those settings you are showing are settings for lf, not for ctpv.

You can usually find your config in ~/.config/ctpv/config

@sophimoo
Copy link

I never configured ctpv, it's config is empty

@khalid151
Copy link

I encountered the same issue on my android phone (on termux), but the warning I got is slightly different than yours.
char is unsigned by default on ARM. Try adding -fsigned-char to your compiler flags and see if you still get warnings.

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

No branches or pull requests

4 participants