[Pkg-privacy-commits] [libgsecuredelete] 15/168: Actually implement FillOperation.
Ulrike Uhlig
u-guest at moszumanska.debian.org
Thu Jul 7 20:06:33 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 8a5b80b66bd426b0051599ce2e4aaed79e548c09
Author: Colomban Wendling <ban at herbesfolles.org>
Date: Wed Sep 30 00:55:25 2009 +0200
Actually implement FillOperation.
FillOperation is now working for truth, and have progress support.
---
gsecuredelete/fill-operation.vala | 97 ++++++++++++++++++++++++++++++++++++++-
1 file changed, 95 insertions(+), 2 deletions(-)
diff --git a/gsecuredelete/fill-operation.vala b/gsecuredelete/fill-operation.vala
index 64dedb3..6f7d068 100644
--- a/gsecuredelete/fill-operation.vala
+++ b/gsecuredelete/fill-operation.vala
@@ -19,20 +19,42 @@
namespace SecureDelete
{
- /* FIXME: never tested, need test
- * FIXME: add progress support
+ /*
+ * TODO:
+ * support -i and -I options of sfill,
+ * perhaps support -l and -z.
*/
public class FillOperation : AsyncOperation
{
+ /** Whether to do fast and insecure filling */
public bool fast {
get;
set;
default = false;
}
+ /** FillOperation:directory:
+ * The directory to fill (must of course be on the filesystem to clean).
+ * I recommend you not to fill in a useful directory but inside a new and
+ * clean one. This can be useful if the filling is interrupted, voluntarily
+ * or not, as this process may spawn a lot of files that might not be
+ * deleted.
+ */
+ public string directory
+ {
+ get;
+ set;
+ default = null;
+ }
+ /* builds the argument vector */
private override string?[] build_args ()
+ throws AsyncOperationError
{
+ if (this.directory == null) {
+ throw new AsyncOperationError.ARGS_ERROR ("Missing directory to fill");
+ }
+
string?[] args = {
"sfill",
"-v"
@@ -40,9 +62,80 @@ namespace SecureDelete
if (this.fast) {
args += "-f";
}
+ args += this.directory;
args += null;
return args;
}
+
+ /* cleans up after subprocess termination */
+ private override void cleanup ()
+ {
+ this.directory = null;
+ }
+
+ private override uint get_max_progress ()
+ {
+ /* FIXME: 38 is the standard SFILL pass number, but may change with
+ * options like -l. If we support it one day, we need to fix this value
+ * (by getting the one SFILL reports) in order to get a meaningful
+ * progress information */
+ return 38;
+ }
+
+ /* gets the progress status of the child process */
+ private override uint get_progress ()
+ {
+ uint progress = 0;
+
+ try {
+ progress = FD.count_ready_bytes (this.fd_out, '*');
+ } catch (FDError e) {
+ warning ("Progression check failed: %s", e.message);
+ }
+
+ return progress;
+ }
+
+ /** run_sync:
+ * @directory: the directory to fill. It is exactly the same as setting
+ * the FillOperation:directory property, just a convenience
+ * possibility.
+ * @watch_interval: See AsyncOperation.run()
+ *
+ * Launches a secure filling asynchronously.
+ *
+ * Returns: whether subprocess started successfully.
+ */
+ public new bool run (string? directory = null,
+ uint watch_interval = 100)
+ throws SpawnError, AsyncOperationError
+ requires (! this.busy)
+ {
+ if (directory != null) {
+ this.directory = directory;
+ }
+ return base.run (null, SpawnFlags.SEARCH_PATH, watch_interval);
+ }
+
+ /** run_sync:
+ * @directory: the directory to fill. It is exactly the same as setting
+ * the FillOperation:directory property, just a convenience
+ * possibility.
+ *
+ * Launches a secure filling synchronously.
+ *
+ * Returns: whether filling was successful.
+ */
+ public new bool run_sync (string? directory = null)
+ throws SpawnError, AsyncOperationError
+ requires (! this.busy)
+ {
+ if (directory != null) {
+ this.directory = directory;
+ }
+ return base.run_sync (null, SpawnFlags.SEARCH_PATH |
+ SpawnFlags.STDOUT_TO_DEV_NULL, null);
+ }
}
}
--
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