[Pkg-privacy-commits] [libgsecuredelete] 49/168: Partial fix for progression when deleting directories

Ulrike Uhlig u-guest at moszumanska.debian.org
Thu Jul 7 20:06:38 UTC 2016


This is an automated email from the git hooks/post-receive script.

u-guest pushed a commit to branch master
in repository libgsecuredelete.

commit c69fd4fbb4596ca70cafdce1e0106bd8ee757e32
Author: Colomban Wendling <ban at herbesfolles.org>
Date:   Mon Feb 22 23:58:15 2010 +0100

    Partial fix for progression when deleting directories
    
    Now the GsdDeleteOperation progress never overflows but rather
    restarts from 0 if it would do so.
---
 TODO                                |  4 +++-
 gsecuredelete/delete-operation.vala | 17 +++++++++++++++++
 2 files changed, 20 insertions(+), 1 deletion(-)

diff --git a/TODO b/TODO
index 5eca3a6..3e48d7d 100644
--- a/TODO
+++ b/TODO
@@ -13,7 +13,8 @@ FIXMEs:
 * Fix progress behavior when deleting folder(s):
   srm reports the progression for each files in the directory and not for the
   directory itself. The problem is obviously that then the progress overflows
-  the percent (100*(n_files_in_dir -1)).
+  the percent (100*(n_files_in_dir -1)) since our progress computation method is
+  (total_current_srm_progress / (n_input_files * n_passes_per_file)).
   I see 3 "fixes" with pro and cons:
     1) Just don't report over 100% (clamp).
       pros:
@@ -22,6 +23,7 @@ FIXMEs:
         * The progression is obviously wrong, stuck to 100% after the first
           file.
     2) Report (n % 1.0), so overflow are something like restarts.
+       [This is now the current behavior]
       pros:
         * Should be quite easy;
         * Better than 1).
diff --git a/gsecuredelete/delete-operation.vala b/gsecuredelete/delete-operation.vala
index 208efab..6599552 100644
--- a/gsecuredelete/delete-operation.vala
+++ b/gsecuredelete/delete-operation.vala
@@ -116,5 +116,22 @@ namespace Gsd
     {
       return base.get_max_progress () * this.n_files;
     }
+    
+    /* This overrides the parent one not to overflow if we delete a directory
+     * and we don't know the number of files in it. This is not the most perfect
+     * fix for the user point of view, but it is quite correct and easy. See
+     * FIXME in TODO file for details. */
+    protected override uint get_progress ()
+    {
+      uint progress = base.get_progress ();
+      
+      /* don't overflow n_passes */
+      if ((this.passes + progress) > this.n_passes) {
+        progress = (this.passes + progress) % this.n_passes;
+        this.passes = 0;
+      }
+      
+      return progress;
+    }
   }
 }

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-privacy/packages/libgsecuredelete.git



More information about the Pkg-privacy-commits mailing list