tldr-c-client icon indicating copy to clipboard operation
tldr-c-client copied to clipboard

Slow tldr -u (tldr --update)

Open osalbahr opened this issue 2 years ago • 20 comments
trafficstars

Expected behavior

tldr -u (tldr --update) should be quick if the local database is up to date.

Actual behavior

tldr takes ~4s and sometimes more. I am not sure if it takes more with an empty local database, couldn't figure out how to wipe it.

Log, debug output

$ time tldr -u
Successfully updated local database

real	0m4.761s
user	0m0.292s
sys	0m1.941s
$ time tldr -u
Successfully updated local database

real	0m4.146s
user	0m0.279s
sys	0m1.942s
$ time tldr -u
Successfully updated local database

real	0m3.851s
user	0m0.275s
sys	0m1.798s

Environment

  • Operating system - macOS/Linux/Windows (add version if needed) macOS
  • tldr version (tldr --version)
$ tldr --version
tldr v1.5.0 (v1.5.0)
Copyright (C) 2016 Arvid Gerstmann
Source available at https://github.com/tldr-pages/tldr-c-client
  • Installation
$ brew install tldr
Warning: tldr 1.5.0 is already installed and up-to-date.
To reinstall 1.5.0, run:
  brew reinstall tldr

(Template adapted from https://github.com/tldr-pages/tldr-node-client/issues)

osalbahr avatar Dec 22 '22 10:12 osalbahr

Hi, Thanks for the report. The client you are using with version 1.5.0 is packaged from our C client. So I will raise this issue over there and also in our chatroom.

kbdharun avatar Dec 22 '22 10:12 kbdharun

Yeah, right now the update process is very "dumb" where it doesn't do any sort of check to see if the remote archive has been changed at all since the previous update, and so it always just downloads the entire zip (~5MB) and then unpacks it.

I've made https://github.com/tldr-pages/tldr/pull/9669 which would present a bit easier method for checking if a new zip is available without having to download the entire zip first, but failing that, we could always fallback to recording the latest commit at https://github.com/tldr-pages/tldr-pages.github.io, though that may have some false positives where the zip archive output is somewhat stable, and a given commit might have been from a documentation or tooling change, and not an actual pages change.

MasterOdin avatar Dec 25 '22 16:12 MasterOdin

I am new to tldr. I was following steps in man tldr: git clone [email protected]:tldr-pages/tldr.git ~/.tldr tldr init Input the tldr repo path(absolute path): /home//.tldr Input your platform(linux, osx or sunos): linux tldr reindex tldr update then I get: Check for updates... fatal: ambiguous argument 'master': unknown revision or path not in the working tree. Use '--' to separate paths from revisions, like this: 'git [...] -- [...]' Traceback (most recent call last): File "/usr/bin/tldr", line 33, in sys.exit(load_entry_point('tldr.py==0.7.0', 'console_scripts', 'tldr')()) File "/usr/lib/python3/dist-packages/click/core.py", line 1128, in call return self.main(*args, **kwargs) File "/usr/lib/python3/dist-packages/click/core.py", line 1053, in main rv = self.invoke(ctx) File "/usr/lib/python3/dist-packages/click/core.py", line 1659, in invoke return _process_result(sub_ctx.command.invoke(sub_ctx)) File "/usr/lib/python3/dist-packages/click/core.py", line 1395, in invoke return ctx.invoke(self.callback, **ctx.params) File "/usr/lib/python3/dist-packages/click/core.py", line 754, in invoke return __callback(*args, **kwargs) File "/usr/lib/python3/dist-packages/tldr/cli.py", line 114, in update local = subprocess.check_output('git rev-parse master'.split()).strip() File "/usr/lib/python3.10/subprocess.py", line 420, in check_output return run(*popenargs, stdout=PIPE, timeout=timeout, check=True, File "/usr/lib/python3.10/subprocess.py", line 524, in run raise CalledProcessError(retcode, process.args, subprocess.CalledProcessError: Command '['git', 'rev-parse', 'master']' returned non-zero exit status 128.

What is wrong? I installed tldr-py, version 0.7.0 I am using Canonical Linux on a Dell XPS 13 Plus (as shipped by Dell).

FreeBSD-fan avatar Jun 05 '23 20:06 FreeBSD-fan

What installation instructions are you following? Could you send a url, screenshot, or copy-paste the instructions?

And I recommend running neofetch to double check which distro you’re on.

If you are on Ubuntu, try running tldr in the terminal and run one of the apt commands you get. It should let you directly use tldr commands rather than cloning and running from source. If you don’t get any suggested commands, try sudo apt install tldr.

See https://github.com/tldr-pages/tldr#how-do-i-use-it for the suggested installation methods.

FYI: This GitHub repo is about the c client, not the Python client

osalbahr avatar Jun 05 '23 20:06 osalbahr

Try running

git --version

$ git --version git version 2.34.1

FreeBSD-fan avatar Jun 05 '23 20:06 FreeBSD-fan

Can you point me to a page for tldr-py?

FreeBSD-fan avatar Jun 05 '23 20:06 FreeBSD-fan

Can you point me to a page for tldr-py?

https://github.com/tldr-pages/tldr-python-client

osalbahr avatar Jun 05 '23 20:06 osalbahr

On 6/5/23 4:35 PM, Osama Albahrani wrote:

Can you point me to a page for tldr-py?

https://github.com/tldr-pages/tldr-python-client

— Reply to this email directly, view it on GitHub https://github.com/tldr-pages/tldr-c-client/issues/94#issuecomment-1577438594, or unsubscribe https://github.com/notifications/unsubscribe-auth/ASYRGH6ANAH67AFNEJNKAUTXJY7INANCNFSM6AAAAAATGSEZQA. You are receiving this because you commented.Message ID: @.***>

Thanks, I had found that page but I can't post a message.  I don't understand github at all.

-- FreeBSD freebsd.friedrich.org 13.2-RELEASE FreeBSD 13.2-RELEASE releng/13.2-n254617-525ecfdad597 GENERIC amd64

FreeBSD-fan avatar Jun 05 '23 20:06 FreeBSD-fan

On 6/5/23 4:04 PM, Osama Albahrani wrote:

Try running

|git --version |

— Reply to this email directly, view it on GitHub https://github.com/tldr-pages/tldr-c-client/issues/94#issuecomment-1577401342, or unsubscribe https://github.com/notifications/unsubscribe-auth/ASYRGHZAYDNA5LM7CECRIQLXJY3V5ANCNFSM6AAAAAATGSEZQA. You are receiving this because you commented.Message ID: @.***>

git --version git version 2.34.1 @.***:~$ tldr --version 0.7.0

-- FreeBSD freebsd.friedrich.org 13.2-RELEASE FreeBSD 13.2-RELEASE releng/13.2-n254617-525ecfdad597 GENERIC amd64

FreeBSD-fan avatar Jun 05 '23 20:06 FreeBSD-fan

On 6/5/23 4:10 PM, Osama Albahrani wrote:

Also, what installation instructions are you following?

And I recommend running |neofetch| to double check which distro you’re on.

If you are on Ubuntu, try running |tldr| in the terminal and run one of the |apt| commands you get. It should let you directly use “tldr” commands rather than cloning and running from source. If you don’t get any suggested commands, try |sudo apt install tldr|.

FYI: This GitHub repo is about the c client, not the Python client

— Reply to this email directly, view it on GitHub https://github.com/tldr-pages/tldr-c-client/issues/94#issuecomment-1577408686, or unsubscribe https://github.com/notifications/unsubscribe-auth/ASYRGHY2G37N6BTNGSVPIALXJY4JRANCNFSM6AAAAAATGSEZQA. You are receiving this because you commented.Message ID: @.***>

            .-/+oossssoo+/-.               @.***         :+ssssssssssssssssss+:           ---------------       -+ssssssssssssssssssyyssss+-         OS: Ubuntu 22.04.2 LTS x86_64     .ossssssssssssssssssdMMMNysssso.       Host: XPS 9320    /ssssssssssshdmmNNmmyNMMMMhssssss/      Kernel: 5.19.0-43-generic   +ssssssssshmydMMMMMMMNddddyssssssss+     Uptime: 1 hour, 10 mins  /sssssssshNMMMyhhyyyyhmNMMMNhssssssss/    Packages: 1759 (dpkg), 20 (snap) .ssssssssdMMMNhsssssssssshNMMMdssssssss.   Shell: bash 5.1.16 +sssshhhyNMMNyssssssssssssyNMMMysssssss+   Resolution: 3840x2400 ossyNMMMNyMMhsssssssssssssshmmmhssssssso   DE: GNOME 42.5 ossyNMMMNyMMhsssssssssssssshmmmhssssssso   WM: Mutter +sssshhhyNMMNyssssssssssssyNMMMysssssss+   WM Theme: Adwaita .ssssssssdMMMNhsssssssssshNMMMdssssssss.   Theme: Yaru [GTK2/3]  /sssssssshNMMMyhhyyyyhdNMMMNhssssssss/    Icons: Yaru [GTK2/3]   +sssssssssdmydMMMMMMMMddddyssssssss+     Terminal: gnome-terminal    /ssssssssssshdmNNNNmyNMMMMhssssss/      CPU: 12th Gen Intel i7-1260P (16) @ 4.700GHz     .ossssssssssssssssssdMMMNysssso.       GPU: Intel Alder Lake-P       -+sssssssssssssssssyyyssss+-         Memory: 2355MiB / 15606MiB         :+ssssssssssssssssss+:             .-/+oossssoo+/-.

I can run tldr commands directly, but when I try to run tldr update, I get errors.  I was following the commands on the tldr man page.

-- FreeBSD freebsd.friedrich.org 13.2-RELEASE FreeBSD 13.2-RELEASE releng/13.2-n254617-525ecfdad597 GENERIC amd64

FreeBSD-fan avatar Jun 05 '23 21:06 FreeBSD-fan

Do you get the same error if you install and use tldr with apt?

osalbahr avatar Jun 05 '23 21:06 osalbahr

Thanks, I had found that page but I can't post a message. I don't understand github at all.

I'd be happy to help if you send a screenshot. I'm able to create an issue at https://github.com/tldr-pages/tldr-python-client/issues.

If you don't particularly need the Python client, I recommend running sudo apt remove tldr, then sudo apt search tldr and select another client.

osalbahr avatar Jun 05 '23 21:06 osalbahr

On 6/5/23 5:32 PM, Osama Albahrani wrote:

|sudo apt search tldr|

sudo apt search tldr Sorting... Done Full Text Search... Done libghc-tldr-dev/jammy 0.6.4-1build6.3 amd64   Haskell tldr client

libghc-tldr-doc/jammy,jammy 0.6.4-1build6.3 all   Haskell tldr client; documentation

libghc-tldr-prof/jammy 0.6.4-1build6.3 amd64   Haskell tldr client; profiling libraries

tldr/jammy 0.6.4-1build6.3 amd64   Haskell tldr client

tldr-py/jammy,jammy 0.7.0-4 all   Python client for tldr: simplified and community-driven man pages

Looks like Haskell client is my only other option.

-- FreeBSD freebsd.friedrich.org 13.2-RELEASE FreeBSD 13.2-RELEASE releng/13.2-n254617-525ecfdad597 GENERIC amd64

FreeBSD-fan avatar Jun 05 '23 23:06 FreeBSD-fan

What happens if you remove the one you currently have, and then just run “tldr”? Ubuntu should give it options, iirc

osalbahr avatar Jun 05 '23 23:06 osalbahr

On 6/5/23 5:32 PM, Osama Albahrani wrote:

|sudo apt search tldr|

Yes, the Haskell client works correctly.  Thank you, friend.

-- FreeBSD freebsd.friedrich.org 13.2-RELEASE FreeBSD 13.2-RELEASE releng/13.2-n254617-525ecfdad597 GENERIC amd64

FreeBSD-fan avatar Jun 05 '23 23:06 FreeBSD-fan

You're welcome, I'm glad you got it figured out. Just FYI, I just started a new Ubuntu VM and got the same options as you. I had no idea the main implementation was written in Haskell until now. I personally use apt install tldr and get the default, or brew install tldr on macOS which gets me the c client. You can use Homebrew on Linux, but for most purposes apt is enough

Screen Shot 2023-06-05 at 9 11 42 PM
osalbahr@vclvm177-191:~$ tldr
Command 'tldr' not found, but can be installed with:
apt install tldr     # version 0.6.4-1build6.3, or
apt install tldr-py  # version 0.7.0-4
Ask your administrator to install one of them.
osalbahr@vclvm177-191:~$ apt search tldr
Sorting... Done
Full Text Search... Done
libghc-tldr-dev/jammy 0.6.4-1build6.3 amd64
  Haskell tldr client

libghc-tldr-doc/jammy,jammy 0.6.4-1build6.3 all
  Haskell tldr client; documentation

libghc-tldr-prof/jammy 0.6.4-1build6.3 amd64
  Haskell tldr client; profiling libraries

tldr/jammy 0.6.4-1build6.3 amd64
  Haskell tldr client

tldr-py/jammy,jammy 0.7.0-4 all
  Python client for tldr: simplified and community-driven man pages

osalbahr@vclvm177-191:~$ uname -a
Linux vclvm177-191.vcl.ncsu.edu 5.15.0-73-generic #80-Ubuntu SMP Mon May 15 15:18:26 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux
osalbahr@vclvm177-191:~$ neofetch
            .-/+oossssoo+/-.               [email protected] 
        `:+ssssssssssssssssss+:`           ---------------------------------- 
      -+ssssssssssssssssssyyssss+-         OS: Ubuntu 22.04.2 LTS x86_64 
    .ossssssssssssssssssdMMMNysssso.       Host: KVM RHEL 7.6.0 PC (i440FX + PIIX, 1996) 
   /ssssssssssshdmmNNmmyNMMMMhssssss/      Kernel: 5.15.0-73-generic 
  +ssssssssshmydMMMMMMMNddddyssssssss+     Uptime: 2 mins 
 /sssssssshNMMMyhhyyyyhmNMMMNhssssssss/    Packages: 3336 (dpkg) 
.ssssssssdMMMNhsssssssssshNMMMdssssssss.   Shell: bash 5.1.16 
+sssshhhyNMMNyssssssssssssyNMMMysssssss+   Resolution: 1024x768 
ossyNMMMNyMMhsssssssssssssshmmmhssssssso   Terminal: /dev/pts/0 
ossyNMMMNyMMhsssssssssssssshmmmhssssssso   CPU: Intel (Haswell, IBRS) (4) @ 2.493GHz 
+sssshhhyNMMNyssssssssssssyNMMMysssssss+   GPU: 00:02.0 Cirrus Logic GD 5446 
.ssssssssdMMMNhsssssssssshNMMMdssssssss.   Memory: 353MiB / 7949MiB 
 /sssssssshNMMMyhhyyyyhdNMMMNhssssssss/
  +sssssssssdmydMMMMMMMMddddyssssssss+                             
   /ssssssssssshdmNNNNmyNMMMMhssssss/                              
    .ossssssssssssssssssdMMMNysssso.
      -+sssssssssssssssssyyyssss+-
        `:+ssssssssssssssssss+:`
            .-/+oossssoo+/-.

osalbahr@vclvm177-191:~$ 

osalbahr avatar Jun 06 '23 01:06 osalbahr

@FreeBSD-fan Neither clients in Ubuntu repos are official, if you plan on using it from repos then I would suggest a popular community client tealdeer. But it is better to install NodeJS and then install our official npm client listed in the README of main repo.

kbdharun avatar Jun 06 '23 01:06 kbdharun

@FreeBSD-fan Neither clients in Ubuntu repos are official, if you plan on using it from repos then I would suggest a popular community client tealdeer. But it is better to install NodeJS and then install our official npm client listed in the README of main repo.

osalbahr@vclvm177-191:~$ sudo apt install tealdeer
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
E: Unable to locate package tealdeer
osalbahr@vclvm177-191:~$ 

Not sure if tealdeer is available in the repos, at least not for Ubuntu

osalbahr avatar Jun 06 '23 01:06 osalbahr

yeah, tealdeer is available in many distros but not Ubuntu, for some reason https://dbrgn.github.io/tealdeer/installing.html#package-managers

osalbahr avatar Jun 06 '23 01:06 osalbahr

yeah, tealdeer is available in many distros but not Ubuntu, for some reason https://dbrgn.github.io/tealdeer/installing.html#package-managers

Just now checked, it is available in Debian repos but nobody seems to have imported it for Ubuntu. Your best bet is to install the NPM client then.

kbdharun avatar Jun 06 '23 01:06 kbdharun