The following commit has been merged in the lab-refactor branch:
commit 99b3dc65fbedcda4402a4814aab1b75c6c5914da
Author: Niels Thykier <[email protected]>
Date:   Wed Nov 2 09:57:45 2011 +0100

    L::L::Entry: Be consistent in error handling
    
    create_entry consistenly uses croak for all errors.
    update_status_file sets $! when the causing error does not set it.
    
    Signed-off-by: Niels Thykier <[email protected]>

diff --git a/lib/Lintian/Lab/Entry.pm b/lib/Lintian/Lab/Entry.pm
index dd8ef25..eef16b8 100644
--- a/lib/Lintian/Lab/Entry.pm
+++ b/lib/Lintian/Lab/Entry.pm
@@ -245,7 +245,7 @@ sub create_entry {
         # In the pool we may have to create multiple directories. On
         # error we only remove the "top dir" and that is enough.
         system ('mkdir', '-p', $base_dir) == 0
-            or return 0;
+            or croak "mkdir -p $base_dir failed";
         $madedir = 1;
     }
     if ($pkg_type eq 'changes'){
@@ -257,10 +257,12 @@ sub create_entry {
     } else {
         croak "create_entry cannot handle $pkg_type";
     }
-    unless (symlink($pkg_path, $link)){
+    unless (symlink ($pkg_path, $link)){
+        my $err = $!;
         # "undo" the mkdir if the symlink fails.
-        rmdir($base_dir) if($madedir);
-        return 0;
+        rmdir $base_dir  if $madedir;
+        $! = $err;
+        croak "symlinking $pkg_path failed: $!";
     }
     if ($pkg_type eq 'source'){
         # If it is a source package, pull in all the related files
@@ -346,7 +348,10 @@ sub update_status_file {
     my $file;
     my @sc;
 
-    return 0 unless $self->entry_exists;
+    unless ($self->entry_exists) {
+        $! = "Entry does not exists";
+        return 0;
+    }
 
     $file = $self->base_dir () . '/.lintian-status';
     open my $sfd, '>', $file or return 0;

-- 
Debian package checker


-- 
To UNSUBSCRIBE, email to [email protected]
with a subject of "unsubscribe". Trouble? Contact [email protected]
Archive: http://lists.debian.org/[email protected]

Reply via email to