perf archive: Correct cutting of symbolic link

If a '$PERF_BUILDID_DIR'(typically $HOME/.debug) is a symbolic link
directory, cutting of the path will fail.

Here is an example where a buildid directory is a symbolic link.

/ # ls -al /root
lrwxrwxrwx    1 root     root            13 Mar 26  2012 /root -> opt/home/root
/ # cd ~
/opt/home/root # perf record -a -g sleep 1
[ perf record: Woken up 1 times to write data ]
[ perf record: Captured and wrote 0.322 MB (~14057 samples) ]
/opt/home/root # perf archive
tar: Removing leading `/' from member names
Now please run:

$ tar xvf -C ~/.debug

wherever you need to run 'perf report' on.
/opt/home/root # mkdir temp
/opt/home/root # tar xf -C ./temp
/opt/home/root # find ./temp -name "*kernel*"

-> If successfully cut off the path, [kernel.kallsyms] is located
in top of the archived file.

This patch enables to cut correctly even if the buildid directory
is a symbolic link.

Signed-off-by: Chanho Park <>
Signed-off-by: Kyungmin Park <>
Cc: Ingo Molnar <>
Cc: Kyungmin Park <>
Cc: Paul Mackerras <>
Cc: Peter Zijlstra <>
Signed-off-by: Arnaldo Carvalho de Melo <>
1 file changed