Discussion:
[Bug-tar] tar doesn't extract original date & timestamps on cifs mounts ??
F.Hofmann
2018-08-06 08:58:45 UTC
Permalink
<html><head></head><body><div style="font-family: Verdana;font-size: 12.0px;"><div>Hi,</div>

<div>&nbsp;</div>

<div>i believe that tar (GNU tar) 1.27.1 in&nbsp; Debian GNU/Linux 8 &#92;n &#92;l has a bug when you extract tar archives on a cifs mounted directory. let me explain what I mean.</div>

<div>&nbsp;</div>

<div>mounted a windows cifs share to /media/deepspace directory. there are a couple of older tar.gz archives inside.</div>

<div>&nbsp;</div>

<div>&nbsp;</div>

<div>/etc/fstab:</div>

<div>&nbsp;</div>

<div>//deepspace/EDIStorage&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; /media/deepspace cifs file_mode=0775,iocharset=utf8,noperm,dir_mode=0775,sec=ntlm,vers=2.1,credentials=/root/.biscredentials&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 0&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 0</div>

<div>&nbsp;</div>

<div>&nbsp;</div>

<div>
<div>Dateisystem&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 1K-Bl&ouml;cke&nbsp;&nbsp; Benutzt Verf&uuml;gbar Verw% Eingeh&auml;ngt auf<br/>
/dev/sda1&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 29526092&nbsp;&nbsp; 2947996&nbsp; 25055204&nbsp;&nbsp; 11% /<br/>
udev&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 10240&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n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p;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 406076&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 0&nbsp;&nbsp;&nbsp; 406076&nbsp;&nbsp;&nbsp; 0% /run/user/1000<br/>
//deepspace/EDIStorage 335396860 111916744 223480116&nbsp;&nbsp; 34% /media/deepspace</div>

<div>&nbsp;</div>

<div>
<div>***@debiandfu:~# ls -als&nbsp; /media/deepspace/Temp/KSZ_DC_060879_20170222965.tar.gz</div>

<div><br/>
92 -rwxrwxr-x 1 root root 92731 Feb 22&nbsp; 2017 /media/deepspace/Temp/KSZ_DC_060879_20170222965.tar.gz</div>
</div>

<div>&nbsp;</div>
</div>

<div>tried to extract the&nbsp;KSZ_DC_060879_20170222965.tar.gz file from 22.02.2017 with files inside from 22.12.2016</div>

<div>&nbsp;</div>

<div>
<div>***@debiandfu:/media/deepspace/Temp/test# tar tvfz ../KSZ_DC_060879_20170222965.tar.gz<br/>
-rwxr-xr-x root/root&nbsp;&nbsp;&nbsp; 119542 2016-12-22 20:08 000000017795<br/>
-rwxr-xr-x root/root&nbsp;&nbsp;&nbsp;&nbsp; 59264 2016-12-22 20:08 000000017796<br/>
-rwxr-xr-x root/root&nbsp;&nbsp;&nbsp; 568240 2016-12-22 20:09 000000017797<br/>
-rwxr-xr-x root/root&nbsp;&nbsp;&nbsp; 640734 2016-12-22 20:09 000000017798<br/>
-rwxr-xr-x root/root&nbsp;&nbsp;&nbsp;&nbsp; 93144 2016-12-22 20:09 000000017799<br/>
-rwxr-xr-x root/root&nbsp;&nbsp;&nbsp; 347313 2016-12-22 20:09 000000017800<br/>
-rwxr-xr-x root/root&nbsp;&nbsp;&nbsp; 189032 2016-12-22 20:09 000000017801<br/>
-rwxr-xr-x root/root&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 7243 2016-12-22 20:09 000000017802<br/>
-rwxr-xr-x root/root&nbsp;&nbsp;&nbsp;&nbsp; 39876 2016-12-22 20:09 000000017803<br/>
-rwxr-xr-x root/root&nbsp;&nbsp;&nbsp;&nbsp; 68277 2016-12-22 20:09 000000017804<br/>
-rwxr-xr-x root/root&nbsp;&nbsp;&nbsp; 321799 2016-12-22 20:11 000000017805<br/>
-rwxr-xr-x root/root&nbsp;&nbsp;&nbsp;&nbsp; 57720 2016-12-22 20:13 000000017806<br/>
-rwxr-xr-x root/root&nbsp;&nbsp;&nbsp;&nbsp; 30014 2016-12-22 20:11 000000017807<br/>
-rwxr-xr-x root/root&nbsp;&nbsp;&nbsp; 161049 2016-12-22 20:12 000000017808<br/>
-rwxr-xr-x root/root&nbsp;&nbsp;&nbsp;&nbsp; 34090 2016-12-22 20:12 000000017809<br/>
-rwxr-xr-x root/root&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 6662 2016-12-22 20:10 000000017810<br/>
-rwxr-xr-x root/root&nbsp;&nbsp;&nbsp; 182991 2016-12-22 20:11 000000017811<br/>
-rwxr-xr-x root/root&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 7005 2016-12-22 20:11 000000017812<br/>
-rwxr-xr-x root/root&nbsp;&nbsp;&nbsp;&nbsp; 21500 2016-12-22 20:10 000000017813<br/>
-rwxr-xr-x root/root&nbsp;&nbsp;&nbsp; 131538 2016-12-22 20:11 000000017814</div>

<div>&nbsp;</div>

<div>
<div>***@debiandfu:/media/deepspace/Temp/test# tar xvfz ../KSZ_DC_060879_20170222965.tar.gz<br/>
000000017795<br/>
000000017796<br/>
000000017797<br/>
000000017798<br/>
000000017799<br/>
000000017800<br/>
000000017801<br/>
000000017802<br/>
000000017803<br/>
000000017804<br/>
000000017805<br/>
000000017806<br/>
000000017807<br/>
000000017808<br/>
000000017809<br/>
000000017810<br/>
000000017811<br/>
000000017812<br/>
000000017813<br/>
000000017814</div>

<div>&nbsp;</div>

<div>If I extraxt this file to a test folder and do a ls -als, the extracted files all have the actual date and timestamp.</div>

<div>&nbsp;</div>

<div>&nbsp;</div>

<div>***@debiandfu:/media/deepspace/Temp/test# ls -als<br/>
insgesamt 3056<br/>
-rwxrwxr-x 1 root root 119542 Aug&nbsp; 6 10:40 000000017795<br/>
-rwxrwxr-x 1 root root&nbsp; 59264 Aug&nbsp; 6 10:40 000000017796<br/>
-rwxrwxr-x 1 root root 568240 Aug&nbsp; 6 10:40 000000017797<br/>
-rwxrwxr-x 1 root root 640734 Aug&nbsp; 6 10:40 000000017798<br/>
-rwxrwxr-x 1 root root&nbsp; 93144 Aug&nbsp; 6 10:40 000000017799<br/>
-rwxrwxr-x 1 root root 347313 Aug&nbsp; 6 10:40 000000017800<br/>
-rwxrwxr-x 1 root root 189032 Aug&nbsp; 6 10:40 000000017801<br/>
-rwxrwxr-x 1 root root&nbsp;&nbsp; 7243 Aug&nbsp; 6 10:40 000000017802<br/>
-rwxrwxr-x 1 root root&nbsp; 39876 Aug&nbsp; 6 10:40 000000017803<br/>
-rwxrwxr-x 1 root root&nbsp; 68277 Aug&nbsp; 6 10:40 000000017804<br/>
-rwxrwxr-x 1 root root 321799 Aug&nbsp; 6 10:40 000000017805<br/>
-rwxrwxr-x 1 root root&nbsp; 57720 Aug&nbsp; 6 10:40 000000017806<br/>
-rwxrwxr-x 1 root root&nbsp; 30014 Aug&nbsp; 6 10:40 000000017807<br/>
-rwxrwxr-x 1 root root 161049 Aug&nbsp; 6 10:40 000000017808<br/>
-rwxrwxr-x 1 root root&nbsp; 34090 Aug&nbsp; 6 10:40 000000017809<br/>
-rwxrwxr-x 1 root root&nbsp;&nbsp; 6662 Aug&nbsp; 6 10:40 000000017810<br/>
-rwxrwxr-x 1 root root 182991 Aug&nbsp; 6 10:40 000000017811<br/>
-rwxrwxr-x 1 root root&nbsp;&nbsp; 7005 Aug&nbsp; 6 10:40 000000017812<br/>
-rwxrwxr-x 1 root root&nbsp; 21500 Aug&nbsp; 6 10:40 000000017813<br/>
-rwxrwxr-x 1 root root 131538 Aug&nbsp; 6 10:40 000000017814<br/>
***@debiandfu:/media/deepspace/Temp/test#</div>

<div>&nbsp;</div>

<div>&nbsp;</div>

<div>&nbsp;</div>

<div>But if I extract the same tar archive to a local filesystem folder like /tmp/test, everythings is ok. The date and timestamps are the original date and time from the tar archive.</div>

<div>&nbsp;</div>

<div>
<div>***@debiandfu:/tmp/test# tar xvfz /media/deepspace/Temp/KSZ_DC_060879_20170222965.tar.gz<br/>
000000017795<br/>
000000017796<br/>
000000017797<br/>
000000017798<br/>
000000017799<br/>
000000017800<br/>
000000017801<br/>
000000017802<br/>
000000017803<br/>
000000017804<br/>
000000017805<br/>
000000017806<br/>
000000017807<br/>
000000017808<br/>
000000017809<br/>
000000017810<br/>
000000017811<br/>
000000017812<br/>
000000017813<br/>
000000017814</div>

<div>&nbsp;</div>

<div>***@debiandfu:/tmp/test# l<br/>
insgesamt 3056<br/>
-rwxr-xr-x 1 root root 119542 Dez 22&nbsp; 2016 000000017795<br/>
-rwxr-xr-x 1 root root&nbsp; 59264 Dez 22&nbsp; 2016 000000017796<br/>
-rwxr-xr-x 1 root root 568240 Dez 22&nbsp; 2016 000000017797<br/>
-rwxr-xr-x 1 root root 640734 Dez 22&nbsp; 2016 000000017798<br/>
-rwxr-xr-x 1 root root&nbsp; 93144 Dez 22&nbsp; 2016 000000017799<br/>
-rwxr-xr-x 1 root root 347313 Dez 22&nbsp; 2016 000000017800<br/>
-rwxr-xr-x 1 root root 189032 Dez 22&nbsp; 2016 000000017801<br/>
-rwxr-xr-x 1 root root&nbsp;&nbsp; 7243 Dez 22&nbsp; 2016 000000017802<br/>
-rwxr-xr-x 1 root root&nbsp; 39876 Dez 22&nbsp; 2016 000000017803<br/>
-rwxr-xr-x 1 root root&nbsp; 68277 Dez 22&nbsp; 2016 000000017804<br/>
-rwxr-xr-x 1 root root 321799 Dez 22&nbsp; 2016 000000017805<br/>
-rwxr-xr-x 1 root root&nbsp; 57720 Dez 22&nbsp; 2016 000000017806<br/>
-rwxr-xr-x 1 root root&nbsp; 30014 Dez 22&nbsp; 2016 000000017807<br/>
-rwxr-xr-x 1 root root 161049 Dez 22&nbsp; 2016 000000017808<br/>
-rwxr-xr-x 1 root root&nbsp; 34090 Dez 22&nbsp; 2016 000000017809<br/>
-rwxr-xr-x 1 root root&nbsp;&nbsp; 6662 Dez 22&nbsp; 2016 000000017810<br/>
-rwxr-xr-x 1 root root 182991 Dez 22&nbsp; 2016 000000017811<br/>
-rwxr-xr-x 1 root root&nbsp;&nbsp; 7005 Dez 22&nbsp; 2016 000000017812<br/>
-rwxr-xr-x 1 root root&nbsp; 21500 Dez 22&nbsp; 2016 000000017813<br/>
-rwxr-xr-x 1 root root 131538 Dez 22&nbsp; 2016 000000017814</div>

<div>&nbsp;</div>

<div>&nbsp;</div>

<div>What is the problem ?? I believe it has something to do with the cifs mount to /media/deepspace but I don&#39;t have a clue where exactly the problem comes from. Can you help me ?</div>

<div>&nbsp;</div>

<div>Regards,</div>

<div>Frank</div>
</div>

<div>&nbsp;</div>

<div>&nbsp;</div>
</div>
</div></div></body></html>
Paul Eggert
2018-08-06 21:11:30 UTC
Permalink
I suggest running tar under strace to see what system calls it's using, and
which of them goes wrong.

Loading...