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

Slow tldr -u (tldr --update) #94

Open
osalbahr opened this issue Dec 22, 2022 · 20 comments
Open

Slow tldr -u (tldr --update) #94

osalbahr opened this issue Dec 22, 2022 · 20 comments
Labels

Comments

@osalbahr
Copy link

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)

@kbdharun kbdharun added the bug label Dec 22, 2022
@kbdharun
Copy link
Member

kbdharun commented Dec 22, 2022

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 kbdharun transferred this issue from tldr-pages/tldr Dec 22, 2022
@MasterOdin
Copy link
Contributor

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 tldr-pages/tldr#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.

@FreeBSD-fan
Copy link

FreeBSD-fan commented Jun 5, 2023

I am new to tldr. I was following steps in man tldr:
git clone git@github.com: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).

@osalbahr
Copy link
Author

osalbahr commented Jun 5, 2023

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

@FreeBSD-fan
Copy link

Try running

git --version

$ git --version
git version 2.34.1

@FreeBSD-fan
Copy link

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

@osalbahr
Copy link
Author

osalbahr commented Jun 5, 2023

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

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

@FreeBSD-fan
Copy link

FreeBSD-fan commented Jun 5, 2023 via email

@FreeBSD-fan
Copy link

FreeBSD-fan commented Jun 5, 2023 via email

@FreeBSD-fan
Copy link

FreeBSD-fan commented Jun 5, 2023 via email

@osalbahr
Copy link
Author

osalbahr commented Jun 5, 2023

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

@osalbahr
Copy link
Author

osalbahr commented Jun 5, 2023

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.

@FreeBSD-fan
Copy link

FreeBSD-fan commented Jun 5, 2023 via email

@osalbahr
Copy link
Author

osalbahr commented Jun 5, 2023

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

@FreeBSD-fan
Copy link

FreeBSD-fan commented Jun 5, 2023 via email

@osalbahr
Copy link
Author

osalbahr commented Jun 6, 2023

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+/-.               osalbahr@vclvm177-191.vcl.ncsu.edu 
        `:+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:~$ 

@kbdharun
Copy link
Member

kbdharun commented Jun 6, 2023

@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
Copy link
Author

osalbahr commented Jun 6, 2023

@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
Copy link
Author

osalbahr commented Jun 6, 2023

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

@kbdharun
Copy link
Member

kbdharun commented Jun 6, 2023

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants