Bug 675539

Summary: PATCH: trash-empty fails to respect [days] argument
Product: [Fedora] Fedora Reporter: "FeRD" (Frank Dana) <ferdnyc>
Component: trash-cliAssignee: Rahul Sundaram <metherid>
Status: CLOSED ERRATA QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 14CC: metherid, sanjay.ankur
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
See Also: http://code.google.com/p/trash-cli/issues/detail?id=59
Whiteboard:
Fixed In Version: trash-cli-0.11.3-0.2.r315.fc14 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
: 692732 692735 (view as bug list) Environment:
Last Closed: 2011-03-30 19:56:17 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---
Attachments:
Description Flags
Patch trash-empty command to respect optional days argument
none
Updated patch to correct trash-empty handling of [days] argument none

Description "FeRD" (Frank Dana) 2011-02-06 12:36:52 UTC
Created attachment 477295 [details]
Patch trash-empty command to respect optional days argument

Description of problem:
trash-empty ignores its optional [days] argument, causing it to delete more than intended (in fact, everything) from the trash even when a minimum age is specified. The attached patch fixes handling of trash-empty's [days] argument.

Version-Release number of selected component (if applicable):
0.11.3-0.1.r315

How reproducible:
% date
Sun Feb  6 07:31:03 EST 2011
% trash-list
2011-02-06 07:22:34 <path>/trashcli
2011-01-06 07:22:43 <path>/build
% trash-empty 7  # Should remove contents at least 7 days old
  
Actual results:
%trash-list
%

Expected results:
% trash-list
2011-02-06 07:22:34 <path>/trashcli
% trash-empty
% trash-list
%

Additional info:
This has been reported (by someone else) to the upstream google code project as issue #59, but so far has not been fixed.
http://code.google.com/p/trash-cli/issues/detail?id=59

Comment 1 Fedora Update System 2011-02-06 14:04:23 UTC
trash-cli-0.11.3-0.2.r315.fc14 has been submitted as an update for Fedora 14.
https://admin.fedoraproject.org/updates/trash-cli-0.11.3-0.2.r315.fc14

Comment 2 Fedora Update System 2011-02-06 20:20:28 UTC
trash-cli-0.11.3-0.2.r315.fc14 has been pushed to the Fedora 14 testing repository.  If problems still persist, please make note of it in this bug report.
 If you want to test the update, you can install it with 
 su -c 'yum --enablerepo=updates-testing update trash-cli'.  You can provide feedback for this update here: https://admin.fedoraproject.org/updates/trash-cli-0.11.3-0.2.r315.fc14

Comment 3 "FeRD" (Frank Dana) 2011-02-07 12:02:55 UTC
Created attachment 477398 [details]
Updated patch to correct trash-empty handling of [days] argument

Whoops! Not quite there yet. Entirely my fault... many apologies.

In testing the new build, I caught a further issue with trash-empty that I hadn't noticed before. My first patch inadvertently exposes it.

If the argument passed to [days] is invalid, trash-empty will output usage information, but then continues right through to perform the deletion as if no argument had been passed. This results, once again, in an overzealous removal of all trash: contents.

% trash-list
2011-02-07 06:41:21 <path>/week06b.odp
2011-02-07 06:41:21 <path>/week06b.ppt
% trash-empty 0.5
Usage: trash-empty [days]

% trash-list
%

...Attaching a replacement patch which fixes this issue, as well.

Comment 4 Fedora Update System 2011-03-30 19:56:07 UTC
trash-cli-0.11.3-0.2.r315.fc14 has been pushed to the Fedora 14 stable repository.  If problems still persist, please make note of it in this bug report.

Comment 5 "FeRD" (Frank Dana) 2011-03-31 23:41:49 UTC
*** Bug 692732 has been marked as a duplicate of this bug. ***