Please stop deleting whitelisted logs...
Hi.
Bleachbit does 'not' have a whitelist feature to prevent deletion of incorrectly determined 'rotated logs'.
Can I alter the Cleaner.py and/or the Unix.py to 'exclude' or 'whitelist' the log that Bleachbit is
accidentally delting?
/var/log/paco/paco-2.0.7
Thank you.
andrew
Fri, 04/30/2010 - 15:38
Permalink
Hard coded white listing
For BleachBit 0.7.4, you want to modify the function rotated_logs() in Unix.py which is here
http://bleachbit.svn.sourceforge.net/viewvc/bleachbit/trunk/bleachbit/Un...
Look at line 536
---
Andrew, lead developer
Justin
Fri, 04/30/2010 - 18:02
Permalink
Hi. In my version, 64 bit
Hi.
In my version, 64 bit debian... 'Unix.py' contains the following for 'rotated_logs()'
What exactly do I change to disallow deleting /var/log/paco/paco-2.0.7
-------------------------------------------------------------------------------------------------------------------
def rotated_logs():
"""Yield a list of rotated (i.e., old) logs in /var/log/"""
# Ubuntu 9.04
# /var/log/dmesg.0
# /var/log/dmesg.1.gz
# Fedora 10
# /var/log/messages-20090118
globpaths = ( '/var/log/*.[0-9]', \
'/var/log/*/*.[0-9]', \
'/var/log/*.gz', \
'/var/log/*/*gz', \
'/var/log/*/*.old', \
'/var/log/*.old' )
for globpath in globpaths:
for path in glob.iglob(globpath):
yield path
regex = '-[0-9]{8}$'
globpaths = ( '/var/log/*-*', '/var/log/*/*-*' )
for path in FileUtilities.globex(globpaths, regex):
whitelist_re = '^/var/log/(removed_)?(packages|scripts)'
if None == re.match(whitelist_re, path): # for Slackware, Launchpad #367575
yield path
andrew
Sat, 05/01/2010 - 18:32
Permalink
Hard code white list
Replace
whitelist_re = '^/var/log/(removed_)?(packages|scripts)'withwhitelist_re = '^/var/log/paco'Then you can test it with a preview.
---
Andrew, lead developer
Justin
Sun, 05/02/2010 - 05:38
Permalink
Sorry, your suggestion did
Sorry, your suggestion did not work.
Edited: /usr/share/bleachbit/bleachbit/Unix.py
for path in FileUtilities.globex(globpaths, regex):
whitelist_re = '^/var/log/paco'
if None == re.match(whitelist_re, path): # for Slackware, Launchpad #367575
yield path
Bleachbit Result;
Delete 4.1kB /var/log/paco/paco-2.0.7
Bleachbit is still deleting the log /var/log/paco/paco/paco-2.0.7
Could this be because there is no .log ending in the logfile /var/log/paco/paco-2.0.7 ?
Thank you.
Justin
Tue, 05/04/2010 - 10:00
Permalink
Bleachbit still is deleting
Bleachbit still is deleting everything in the /var/logs/
Anyone have a solution, the whitelist suggestion did not work.
Thanks.
Justin
andrew
Tue, 05/04/2010 - 11:06
Permalink
Trying again
I see. The whitelist code needs to be a litle higher in his section
530 for globpath in globpaths:
531 for path in glob.iglob(globpath):
532 yield path
Replace line 532 with these three lines:
whitelist_re = '^/var/log/paco'
if None == re.match(whitelist_re, path):
yield path
Use proper indentation. (The third line is indented more than the first two.)
---
Andrew, lead developer
Justin
Wed, 05/05/2010 - 07:51
Permalink
Thank you. I tried following
Thank you.
I tried following your instructions resulting in this - /usr/share/bleachbit/bleachbit/Unix.py
530 for globpath in globpaths:531 for path in glob.iglob(globpath):
532 whitelist_re = '^/var/log/paco'
533 if None == re.match(whitelist_re, path):
534 yield path
FANTASTIC! It worked!
I would like to submit a feature request to offer a Whitelist option for those who wish to selectively ignore
files or directories from Bleachbit.
Thank you for a wonderful time saver.
Justin
andrew
Wed, 05/05/2010 - 15:11
Permalink
White list
The white list feature is on my short list, so I hope to add it "soon" (though I've been busy lately)
---
Andrew, lead developer
Justin
Wed, 05/12/2010 - 12:26
Permalink
OK. When the next version
OK.
When the next version updates via apt-get dist-upgrade, will the custom Unix.py be overwritten with the new?
Regards.
andrew
Wed, 05/12/2010 - 15:29
Permalink
Update
Yes, I believe it will
---
Andrew, lead developer
andrew
Sat, 06/05/2010 - 10:51
Permalink
White listing feature added
BleachBit 0.8.0 is released with support for white listing files and folders
http://bleachbit.sourceforge.net/news/bleachbit-080-released
---
Andrew, lead developer