Is the following a known and long-standing inconsistency/feature of tar? I suspect the answer is yes.
cd mydir
tar cvpf dec14.tar .
tar xvpf dec14.tar -C .
Files are extracted to where they are supposed to be.
cd ..
tar cvpf dec14.tar mydir
tar xvpf dec14.tar -C mydir
Files are restored nested in mydir/mydir, in ot开发者_JAVA百科her words, nested one level lower than before.
No, it's not an inconsistency or bug. 'tar' is doing exactly what you told it to do. The '-C' option just means to change into the given directory first, it doesn't imply anything about trimming that string off the extracted paths.
精彩评论