28

I'm looking for the latest source code of man command, the version in my Linux is pretty old(v1.6f), but I failed after googling a while.

I mean the latest source code of man, not man-pages but the binary file in /usr/bin/man itself which can be compiled and installed.

CodyChan
  • 954

4 Answers4

28

You can usually query your distribution to see where sources come from. For example, I'm on Fedora, and I can see that the man command comes from the man-db package:

$ rpm -qf /usr/bin/man
man-db-2.6.7.1-16.fc21.x86_64

I can then query the man-db package for the upstream url:

$ rpm -qi man-db | grep -i url
URL         : http://www.nongnu.org/man-db/

And there you are, http://www.nongnu.org/man-db/.

You can perform a similar sequence of steps with the packaging systems used on other distributions.

larsks
  • 34,737
  • Thanks, I've already got man-db after I posted this question, it seems I cannot just compile man from the source code because of many dependencies. – CodyChan Sep 01 '15 at 05:53
  • That is true. You are going to have to resolve all the dependencies first. even then, your new man binary may not be useful to you because of dependencies on other newer binaries. – fpmurphy Sep 01 '15 at 08:18
  • 1
    If there are only linear dependencies, this is easy ;-) There are program systems line GNOME that have circular dependencies. I hope that some OSS developers learn to create sources with documented linear dependencies only. – schily Sep 01 '15 at 09:14
  • 1
    For future reference, on Debian based distributions the equivalent commands are dpkg -S /usr/bin/man and apt-cache show man-db | grep Homepage – Tim Nov 21 '17 at 18:42
8

On Debian based distributions, same like Ubuntu, you can find and download source code like below:

$ which man
/usr/bin/man
$ dpkg --search /usr/bin/man
man-db: /usr/bin/man
$ apt-get source man-db

This will put the source code in your current working directory.

Aaron Hall
  • 465
  • 4
  • 19
Yu Jiaao
  • 231
2

The source code is now available on GitLab.

Matthias
  • 103
  • 4
-2

Linux is not an operating system but just a kernel. So in theory every distro is free to use whatever they like.

Even rpm is not necessarily used on every linux distro, so the first step is to find out which implementation is used. This can typically be done by using strings on the binary and then use a significant string in double quotes as search string on Google.

schily
  • 19,173
  • 1
    If rpm -qf or dpkg -S or the equivalent for your packaging system for `"$(command -v man)" returns the name of a package, then that method is going to be a lot more reliable than googling for strings found in the binary though. Bear in mind that most distributions patch the software from upstream. So the source package for your distribution is the only place to go for the exact source code as compiled for your /usr/bin/man. – Stéphane Chazelas Sep 01 '15 at 10:05
  • There are more than a dozen different packaging systems, so you would need to mention many methods..... but you are correct: In general, many distributions are non-collaborative and either patch bugs into the software or do not report useful patches upstream. – schily Sep 01 '15 at 10:28