Subject: [PATCH] dget: avoid an infinite loop when a .changes or .dsc file references itself

From: Raphael Geissert <[email-masked]>
Date: Fri, 14 Sep 2012 13:34:51 -0500

The loop is usually broken when reaching resource exhaustion (when
reaching RLIMIT_NOFILE, for instance.)

Signed-off-by: Raphael Geissert <[email-masked]>
---
 scripts/dget.pl |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/scripts/dget.pl b/scripts/dget.pl
index 2ed2d36..b691939 100755
--- a/scripts/dget.pl
+++ b/scripts/dget.pl
@@ -220,6 +220,8 @@ sub get_file {
 	return 0;
     }
 
+    $seen{$file} = 1;
+
     if ($file =~ /\.(?:changes|dsc)$/) {
 	parse_file($dir, $file);
     }
@@ -227,7 +229,6 @@ sub get_file {
 	$found_dsc = $file;
     }
 
-    $seen{$file} = 1;
     return 1;
 }
 
-- 
1.7.10