bug-tar
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Bug-tar] [patch] tar 1.23 hangs in tight loop when extracting already e


From: Ico Doornekamp
Subject: [Bug-tar] [patch] tar 1.23 hangs in tight loop when extracting already existing symlinks when using -k option
Date: Thu, 25 Mar 2010 11:01:22 +0100
User-agent: Mutt/1.5.18 (2008-05-17)

Tar 1.23 hangs when trying to extract an already exisiting symlink when
using the -k (--keep-old-files) option.  

The open() call in create_placeholder_file() fails because of the O_EXCL
bit, so create_placeholder_file() starts retrying the operation in a
tight loop because it does not seem to handle to return value
RECOVER_SKIP from maybe_recoverable().

The following patch solves the problem for me:

--- ../../tar-1.23-org/src/extract.c    2010-01-26 12:28:09.000000000 +0100
+++ ../../tar-1.23/src/extract.c        2010-03-25 10:36:24.256827175 +0100
@@ -888,7 +888,7 @@ create_placeholder_file (char *file_name
   struct stat st;
 
   while ((fd = open (file_name, O_WRONLY | O_CREAT | O_EXCL, 0)) < 0)
-    if (! maybe_recoverable (file_name, interdir_made))
+    if (maybe_recoverable (file_name, interdir_made) != RECOVER_OK)
       break;
 
   if (fd < 0)

It seems that the new return value RECOVER_SKIP was newly added in 1.23.
Browsing through extract.c I noticed there might be more calls to
maybe_recoverable() where the return value is interpreted as a boolean and the
value EXTRACT_OK is not explicitly checked, so there might be more similar
problems in the code for which the above patch does not provide a fix.

-- 
:wq
^X^Cy^K^X^C^C^C^C




reply via email to

[Prev in Thread] Current Thread [Next in Thread]