Bugzilla – Bug 1225407
GNU tar hangs when extracting certain hard links
Last modified: 2024-07-22 18:45:27 UTC
The version of GNU tar 1.35 packaged for openSUSE Tumbleweed hangs when using --wildcards to extract a symlink to another file in the archive that does not match the wildcard. The problem may be specific to the openSUSE RPMs; I cannot reproduce it when using GNU tar 1.35 compiled from source. An example of an archive that can reproduce this problem is at <http://files.nothingisreal.com/tmp/news002f1.tar.bz2>. Using the command line tar xavf news002f1.tar.bz2 the archive is successfully extracted. But if I add a --wildcards option such as tar xavf news002f1.tar.bz2 --wildcards '*trek*' then tar hangs when it gets to the file news002f1/b5/net.startrek/24. This file, which matches the wildcard, is a symlink to the file news002f1/b5/net.sf-lovers/141, which does not match the wildcard. Running tar with strace shows that tar gets stuck in a loop: mkdirat(AT_FDCWD, "news002f1", 0755) = -1 EEXIST (File exists) mkdirat(AT_FDCWD, "news002f1/b5", 0755) = -1 EEXIST (File exists) mkdirat(AT_FDCWD, "news002f1/b5/net.startrek", 0755) = -1 EEXIST (File exists) newfstatat(AT_FDCWD, "news002f1/b5/net.startrek", {st_mode=S_IFDIR|0755, st_size=4096, ...}, 0) = 0 linkat(AT_FDCWD, "news002f1/b5/net.sf-lovers/141", AT_FDCWD, "news002f1/b5/net.startrek/24", 0) = -1 ENOENT (No such file or directory) newfstatat(AT_FDCWD, "news002f1/b5/net.sf-lovers/141", 0x7fffcaca26a0, AT_SYMLINK_NOFOLLOW) = -1 ENOENT (No such file or directory) By contrast, GNU tar 1.35 compiled from source does not hang; it instead emits the error messages of the following sort for the affected symlinks and then continues processing the archive: Cannot hard link to ‘news002f1/b5/net.sf-lovers/141’: No such file or directory
s/symlink/hard link/g
Thanks for reporting. Should now be fixed with request https://build.opensuse.org/request/show/1187615 Feel free to reopen the bug if the issue persists.