tjohansen14 / diskscrub

Automatically exported from code.google.com/p/diskscrub
GNU General Public License v2.0
0 stars 0 forks source link

clean up after -X and fixes #9

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
Date: Fri, 2 Sep 2011 07:26:06 -0700
From: Peter Hyman <pete@peterhyman.com>
To: Jim Garlick <garlick@llnl.gov>
Subject: Scrub 2.4.1 enhancement, fixes

[-- Attachment #1 --]
[-- Type: text/plain, Encoding: quoted-printable, Size: 1.4K --]

Hello Jim.

I reviewed the changes and I noticed a couple of things.

1: in the scrub_dirent function, there was a bad ENUM test.
     for (i = 0; i < seq->len; i++) {
-        assert(seq->pat[i].ptype == REGULAR);
+   assert(seq->pat[i].ptype == NORMAL);

REGULAR has no meaning for patterns.

2: After free space was filled, the files were not removed. Ever. So, I
added code to not only do that, but also to scrub the dir as well.

+    /* clean up */
+    snprintf(scrubpath, sizeof(scrubpath), "%s/scrubfile", dirpath); /*
set dirent */
+    printf("Performing dirent and removing %3d temporary free-space
scrub files...\n", fileno);
+    for ( i = 0; i < fileno; i++ ) {
+        snprintf(path, sizeof(path), "%s/scrub.%.3d", dirpath, i);
+        scrub_dirent(path, scrubpath);
+        if (unlink(scrubpath) != 0) {
+            fprintf(stderr, "%s: unlink %s: %s\n", prog, scrubpath,
strerror(errno));
+            exit(1);
+        }
+    }
+    printf("%s: %3d free-space files removed.\n", prog, fileno);
+
+    if (rmdir(dirpath) < 0) {
+        fprintf(stderr, "%s: rmdir %s: %s\n", prog, dirpath,
strerror(errno));
+        exit(1);
+    }
+    printf("%s: %s free-space directory removed.\n", prog, dirpath);
 }

I also removed an unused variable *buf.

I did not bother to update the README, or ChangeLog file. You did not
the last time either. Please review.

Thanks for the excellent program.

--
Peter Hyman

Original issue reported on code.google.com by garlick....@gmail.com on 2 Sep 2011 at 4:44

GoogleCodeExporter commented 8 years ago
Date: Sat, 3 Sep 2011 10:48:16 -0700
From: Peter Hyman <pete@peterhyman.com>
To: Jim Garlick <garlick@llnl.gov>
Subject: Free Space Clearing

[-- Attachment #1 --]
[-- Type: text/plain, Encoding: quoted-printable, Size: 0.2K --]

I added an -XC | --freespace=C option argument.

It works nice. I changed a little text also. Please review, test, and
let me know.

Happy labor day!

--
Peter Hyman

Original comment by garlick....@gmail.com on 6 Sep 2011 at 10:34

Attachments:

GoogleCodeExporter commented 8 years ago
Just picked up the bad enum fix (sorry for delay!)
Reviewing other proposed changes...

Original comment by garlick....@gmail.com on 16 Apr 2012 at 10:49

GoogleCodeExporter commented 8 years ago
Peter, your fix will be in scrub 2.5.0.

After thinking about it for a while I dropped the -XC option and just made 
cleaning up the default (with verbose messages about what is going on).  I 
think I'm reversing
what I told you in email, so sorry about that.

No need to scrub the dirents since they are just machine generated.

Original comment by garlick....@gmail.com on 17 Apr 2012 at 5:33

GoogleCodeExporter commented 8 years ago
Peter, your fix will be in scrub 2.5.0.

After thinking about it for a while I dropped the -XC option and just made 
cleaning up the default (with verbose messages about what is going on).  I 
think I'm reversing
what I told you in email, so sorry about that.

No need to scrub the dirents since they are just machine generated.

Original comment by garlick....@gmail.com on 17 Apr 2012 at 5:33

GoogleCodeExporter commented 8 years ago
The commits associated with this bug are:

        commit 2af2ded1267bc80f5ad30bba2e8ae5e0fdff993e
        Author: Jim Garlick <garlick.jim@gmail.com>
        Date:   Tue Apr 17 15:33:07 2012 -0700

            Fix test t13 after rewording -X error message

        commit 5d58b847ebab6e45c719447f4e8edba8938ea067
        Author: Jim Garlick <garlick.jim@gmail.com>
        Date:   Tue Apr 17 11:46:23 2012 -0700

            Add missing break in pat2str (cosmetic)

        commit 98d36b4836d741c7cb7664cbd21b3ae1c138881e
        Author: Jim Garlick <garlick.jim@gmail.com>
        Date:   Tue Apr 17 10:32:50 2012 -0700

            Clean up -X temp files (issue 9) [Peter Hyman]

        commit 5084f61a86d1789dc88761b06f8cba865c455c8e
        Author: Jim Garlick <garlick.jim@gmail.com>
        Date:   Mon Apr 16 15:53:34 2012 -0700

            Fix incorrect assertion in scrub_dirent (issue 9)

            A typo prevented the scrub -D (scrub dirent) option from working.
            This was a collateral fix in issue 9 [Peter Hyman]

            Also address several compilation warnings on RHEL6.2

Original comment by garlick....@gmail.com on 24 Apr 2012 at 8:27