Under the covers of perldoc

Sometime last year I had to go find out what happens under the covers when a user types a command like "perldoc strict." Here's the trace of which commands call which other commands. It's all in good fun.

I'd used strace to get a process-by-process trace of what happened to just the execve and clone syscalls.

strace -e trace=clone,execve -ff perldoc strict

And the eventual picture resolved:

/usr/bin/perldoc strict
    /home/josh/bin/stty -a
    /home/josh/src/git-utils/stty -a
    /home/josh/bin/stty -a
    /home/josh/src/git-utils/stty -a
    /usr/local/sbin/stty -a
    /usr/local/bin/stty -a
    /usr/sbin/stty -a
    /usr/bin/stty -a
    /sbin/stty -a
    /bin/stty -a
    /bin/sh -c "/usr/bin/pod2man --lax /usr/share/perl/5.10/strict.pod | nroff -man -rLL=229n"
        /usr/bin/pod2man --lax /usr/share/perl/5.10/strict.pod
        /usr/bin/nroff -man -rLL=229n
            /usr/bin/locale charmap
            /usr/bin/groff -mtty-char -Tutf8 -man -rLL=229n
                /usr/bin/troff -mtty-char -man -rLL=229n -Tutf8
                /usr/bin/grotty
    /bin/sh -c "/usr/bin/sensible-pager \"/tmp/eHhH5a9wPU\""
        /usr/bin/sensible-pager /tmp/eHhH5a9wPU
            /usr/bin/pager /tmp/eHhH5a9wPU
                /bin/sh -c "/bin/bash -c \\ /usr/bin/lesspipe\\ /tmp/eHhH5a9wPU"
                    /bin/bash -c " /usr/bin/lesspipe /tmp/eHhH5a9wPU"
                    /usr/bin/lesspipe /tmp/eHhH5a9wPU
                        /usr/bin/basename /usr/bin/lesspipe
                            /usr/bin/tr "[:upper:]" "[:lower:]"

Leave a comment

About Josh ben Jore

user-pic