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

Issue with Absolute Path for Layout File in Termux #258

Open
Manamama opened this issue Jun 1, 2024 · 0 comments
Open

Issue with Absolute Path for Layout File in Termux #258

Manamama opened this issue Jun 1, 2024 · 0 comments

Comments

@Manamama
Copy link

Manamama commented Jun 1, 2024

I’ve encountered an issue with gotop when running it in Termux on Android. When I specify the absolute path for the layout file using the -l option, gotop is unable to find the file. However, when I run gotop from the directory where the layout file is located, it works as expected.

Here are the steps to reproduce the issue:

  1. Install gotop using the command go install github.com/xxxserxxx/gotop/v4/cmd/gotop@latest.
  2. Create a layout file at /data/data/com.termux/files/home/.config/gotop__manual_config.txt.
  3. Run gotop with the -l option and the absolute path to the layout file: ./gotop -l /data/data/com.termux/files/home/.config/gotop__manual_config.txt.

Expected Result: gotop runs with the specified layout.

Actual Result: gotop is unable to find the layout file and logs the following error: failed to find layout file /data/data/com.termux/files/home/.config/gotop__manual_config.txt: /data/data/com.termux/files/home/go/bin.

Without my hack below:

~/go/bin $ cat  /data/data/com.termux/files/home/.cache/gotop/errors.log
11:04:49 remote.go:74: Remote: no remote URL provided; disabling extension
19| failed to find layout file /data/data/com.termux/files/home/.config/gotop__manual_config.txt: /data/data/com.termux/files/home/go/bin
~/go/bin $ 

Additional Information:

OS: Android, Linux localhost 4.14.186+ #1 SMP PREEMPT Thu Mar 17 16:28:22 CST 2022 aarch64
gotop version: gotop 0.0.0 (Hadean)
~/go/bin $ go version
go version go1.22.3 android/arm64
~/go/bin $ 

It also works identically with default (apt) gotop:

~/go/bin $ which gotop
/data/data/com.termux/files/usr/bin/gotop
~/go/bin $ /data/data/com.termux/files/usr/bin/gotop --version
gotop v4.2.0 (20230812T062727)
~/go/bin $ 

This issue seems to be related to how gotop is handling file paths (maybe due to go language itself? via the path package? me no programmer ...), neither the absolute nor relative paths work. A workaround is to change the directory to the location of the layout file before running gotop, but this is not an ideal solution.

My hack for now:
alias gotop='(orig_dir=$(pwd) && cd /data/data/com.termux/files/home/.config && sudo /data/data/com.termux/files/usr/bin/gotop --no-statusbar -l gotop__manual_config.txt && cd $orig_dir)'

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

1 participant