Why are tar generating different tar file on different OS for the same text file? Here is how to reproduce the problem:
This is host 1: US[keli@ tmp]uname -a Linux Smiles-station-001 4.4.0-040400-generic #201601101930 SMP Mon Jan 11 00:32:41 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux US[keli@ tmp]tar --version tar (GNU tar) 1.28 Copyright (C) 2014 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html >. This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. Written by John Gilmore and Jay Fenlason. US[keli@ tmp]echo "hello" >test.txt US[keli@ tmp]tar -cf test.tar test.txt US[keli@ tmp]md5sum test.txt test.tar b1946ac92492d2347c6235b4d2611184 test.txt 40b61cbcd8c4144fa224f40927be2869 test.tar This is host 2: U18.04.S225[keli@ tmp]uname -a Linux smiles-Precision-T7500 4.15.0-42-generic #45-Ubuntu SMP Thu Nov 15 19:32:57 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux U18.04.S225[keli@ tmp]tar --version tar (GNU tar) 1.29 Copyright (C) 2015 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html >. This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. Written by John Gilmore and Jay Fenlason. U18.04.S225[keli@ tmp]tar -cf test.tar test.txt U18.04.S225[keli@ tmp]md5sum test.txt test.tar b1946ac92492d2347c6235b4d2611184 test.txt dae6737634e6f1c381fae91fae8e1e04 test.tar It's obvious that the test.txt file have same md5 value, but the tar file generate by same file have different md5 values. I am wondering the reason. Is it related to kerner version or tar version? Any help? Thanks.
