Package: tar
Version: 1.15.91-2
Followup-For: Bug #377330

Hi All.

It seems that there are 2 bugs in incremen.c:
1) uninitialized variable stract stat st, as was correctly pointed
by Kurt Roeckx.
2) wrong file type check in 
  || (*entry == 'D' && S_ISDIR (st.st_mode))
  || (*entry == 'Y' && !S_ISDIR (st.st_mode)))

I made a patch that fixes these problems.

Attached the patch and a script I used to test the
stock debian tar and after several iterations it always fails. 

-- System Information:
Debian Release: testing/unstable
  APT prefers testing
  APT policy: (500, 'testing')
Architecture: amd64 (x86_64)
Shell:  /bin/sh linked to /bin/bash
Kernel: Linux 2.6.16-2-amd64-k8
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)

Versions of packages tar depends on:
ii  libc6                        2.3.6.ds1-4 GNU C Library: Shared libraries

tar recommends no packages.

-- no debconf information
--- tar-1.15.91/src/incremen.c	2006-06-08 14:28:16.000000000 +0300
+++ tar-1.15.91-mod/src/incremen.c	2006-09-07 09:06:07.000000000 +0300
@@ -1299,10 +1299,6 @@ try_purge_directory (char const *directo
 	free (p);
       p = new_name (directory_name, cur);
 
-      if (!(entry = dumpdir_locate (current_stat_info.dumpdir, cur))
-	  || (*entry == 'D' && S_ISDIR (st.st_mode))
-	  || (*entry == 'Y' && !S_ISDIR (st.st_mode)))
-	{
 	  if (deref_stat (false, p, &st))
 	    {
 	      if (errno != ENOENT) /* FIXME: Maybe keep a list of renamed
@@ -1321,6 +1317,10 @@ try_purge_directory (char const *directo
 		     quotearg_colon (p)));
 	      continue;
 	    }
+      if (!(entry = dumpdir_locate (current_stat_info.dumpdir, cur))
+	  || (*entry == 'D' && !S_ISDIR (st.st_mode))
+	  || (*entry == 'Y' && S_ISDIR (st.st_mode)))
+	{
 
 	  if (! interactive_option || confirm ("delete", p))
 	    {

Attachment: rrr
Description: application/shellscript

Reply via email to