-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA256 Dear developers,
seems there is a bug which causes tar to always update the contents of an archive if the directory ends with a slash in the FILE specified with "-T" flag, see below the example of this unexpected behavior and a patch that I made: - -- I've tried both version of tar arno@sony:~$ tar --version tar (GNU tar) 1.27.1 arno@sony:~/Downloads/src/tar-1.28$ ./src/tar --version tar (GNU tar) 1.28 - -- Normal and expected behavior arno@sony:~$ /bin/tar --create -vf archive.tar .ssh .ssh/ .ssh/id_ed25519 .ssh/id_ed25519.pub .ssh/known_hosts arno@sony:~$ /bin/tar --update -vf archive.tar .ssh arno@sony:~$ /bin/tar --update -vf archive.tar .ssh/ (with -v flag tar would output whether there is a "new" file go into an archive.tar) - -- Normal and expected behavior (using file list) arno@sony:~$ cat list.txt .ssh arno@sony:~$ /bin/tar --update -vf archive.tar -T list.txt arno@sony:~$ /bin/tar --update -vf archive.tar -T list.txt - -- BUG: Adding slash in the name of path (.ssh => .ssh/), causes tar to update the archive always arno@sony:~$ vim list.txt arno@sony:~$ cat list.txt .ssh/ arno@sony:~$ /bin/tar --update -vf archive.tar -T list.txt .ssh/ .ssh/id_ed25519 .ssh/id_ed25519.pub .ssh/known_hosts arno@sony:~$ /bin/tar --update -vf archive.tar -T list.txt .ssh/ .ssh/id_ed25519 .ssh/id_ed25519.pub .ssh/known_hosts arno@sony:~$ tar -tvf archive.tar drwx------ arno/arno 0 2015-10-12 23:48 .ssh/ - -rw------- arno/arno 444 2015-10-14 20:36 .ssh/id_ed25519 - -rw-r--r-- arno/arno 93 2015-07-29 21:59 .ssh/id_ed25519.pub - -rw-r--r-- arno/arno 3842 2015-10-15 20:51 .ssh/known_hosts drwx------ arno/arno 0 2015-10-12 23:48 .ssh/ - -rw------- arno/arno 444 2015-10-14 20:36 .ssh/id_ed25519 - -rw-r--r-- arno/arno 93 2015-07-29 21:59 .ssh/id_ed25519.pub - -rw-r--r-- arno/arno 3842 2015-10-15 20:51 .ssh/known_hosts drwx------ arno/arno 0 2015-10-12 23:48 .ssh/ - -rw------- arno/arno 444 2015-10-14 20:36 .ssh/id_ed25519 - -rw-r--r-- arno/arno 93 2015-07-29 21:59 .ssh/id_ed25519.pub - -rw-r--r-- arno/arno 3842 2015-10-15 20:51 .ssh/known_hosts - -- The patch I have decided to try myself and make a patch, please review it carefully, I do not want to break anything :-) Signed-off-by: Andrey Arapov <[email protected]> diff -u src/names.c.orig src/names.c - --- src/names.c.orig 2014-03-26 21:58:48.000000000 +0100 +++ src/names.c 2015-10-18 23:58:52.131318666 +0200 @@ -705,6 +705,10 @@ for (p = namelist; p; p = p->next) { + /* only zap trailing a slash */ + if (ISSLASH(p->name[length])) + p->name[length] = '\0'; + if (p->name[0] && exclude_fnmatch (p->name, file_name, p->matching_flags)) return p; kind regards, Andrey Arapov -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iQIcBAEBCAAGBQJWJBj3AAoJEDaN2i6aRx6s7iwP/34JQbDQhFnM8O1upuJg77+E qstMscV5BtFJ1eHWhmaDPQrSz2Z6zRGuYPEYZ7K8rtr6d64XZqS8/IPSBZxl4O3d +Lqk390Gxh9gDbsDD2vaJrgE2UGrBxvdFLLHHkBME0c+ksaMZP3pl8ui9wvaybsM H/tecz3SjjAHbUyzV60qk79p231hKO/wIN8dJxXymKJUrQ4WLzRjhOcRLw35WqvS ASGWUq1C0JlEMWeL0rPRGucKOgsDjJh7SUaWeMGW6wTSTbEE1bbTKy0kEfNjFRu1 nL7i24I0zxNFNb37eoBPfLMLvRXjI5tbaPvOl7MarwIfDiuOjKUbuO2Zm9lLUNDb 7fA8tJxxoYgI08vUN0LKMYNF3zQc+ETHu1yK+cb4y3ZAVhSbnVox4e2qfluXEu/U S8L1BETLFKQ8OVafVoAojI4rSc829Dn2SR7Pdr2WzEoGpfDFrTvq8EbiB4QppRGE 3E55AZryHEet+54xH1bZcIG8Ty5SB5i8hqu+cgSEMtemc4uplxbWGENV+giOtbVH JlhtwCa23WijD32jWCFLXeUChdNlO22W2V+IvaVPEZ7sMYnIt2N5ZNCwIQp1TvT5 eeBHHXJ+rpN7emFJoL7nqy5Fg/2qeSzPSWeDWWiLrhThwvtDOKzSL6BbWLrFVLLk 1YFyA3MrMS2xrXgbxwEK =ux7W -----END PGP SIGNATURE-----
