Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Custom cleaner fails to find files when walking a directory tree. Files are found when walking similar tree #1636

Open
BusterRaid opened this issue Feb 13, 2024 · 0 comments
Labels

Comments

@BusterRaid
Copy link

When attempting to run a custom cleaner (cleanerML), unexpectedly few files are found when compared to running the "same" custom cleaner against a synthesised copy of the original directory tree.

The error/behaviour is consistent on every execution.

My speculation is that it may be due to the cleaner hitting a permission issue and then failing completely, rather than attempting the next object. However it may be behaviour by design or a fat-fingered operator misunderstanding issue.

Note: This is being run against a VM, hence "damage" to the file system is not an issue.
Note: In this development all I am doing is using the "Preview" facility, not the "Clean" function.

The cleaner is designed to search for files using a regex - finding file that match the pattern "*.log"
"testcleaner1" - Cleaner XML:

<?xml version="1.0" encoding="UTF-8"?>
<cleaner id="testcleaner1" os="windows">
  <label>testcleaner1</label>
  <description>Test cleaner 1</description>
  <!-- -->    
  <option id="test1_items">
    <label>Windows bits 1</label>
    <description>Delete Windows stuff 1.</description>
	<action command="delete" search="walk.files" path="C:\Windows\System32\" regex=".*\.log$" type="f"/>
  </option>
</cleaner>

To Reproduce

  • Logged in to Windows desktop as a "normal" user - not a member of the "administrators" group.
  • As an administrator user, start up a dos prompt ("Run as administrator").
  • CAUTION: Don't carry out the next step unless you are on an expendable resource.
  • Use the script below to drop some files into the folder structure "C:\Windows\System32":
REM
REM Put some dummy log files into the folder structure.
REM
echo "Test" > C:\Windows\System32\LogFiles\setupcln\tmp.log
echo "Test" > C:\Windows\System32\tmp.log
echo "Test" > C:\Windows\System32\SleepStudy\ScreenOn\tmp.log
echo "Test" > C:\Windows\System32\Sysprep\Panther\tmp.log
echo "Test" > C:\Windows\System32\LogFile\setupcln\tmp.log
mkdir C:\Windows\System32\tlog
echo "Test" > C:\Windows\System32\tlog\tmp.log
REM
dir /s C:\Windows\System32\*.log
REM

... These "tmp.log" files should be locatable by the cleaner.

  • As a non admin user, BleachBit is started ("BleachBit", not "BleachBit no UAC").
  • At the UAC, an admin user/password is supplied.
  • The option "Hide irrelevant cleaners" is unticked, so the cleaner ("cleanertest1.xml") becomes available.
  • All other cleaners are deselected, so that "cleanertest1" is the only cleaner selected.
  • The "Preview" option is chosen and the cleaner executes.

On my system I see 3 or 4 candidate files:

clean_operation('testcleaner1'), options = '['test1_items']'
Delete 12.9kB C:\Windows\System32\LogFiles\setupcln\setupact.log
Delete 1kB C:\Windows\System32\LogFiles\setupcln\setuperr.log
Delete 1.3kB C:\Windows\System32\LogFiles\setupcln\tmp.log

Disk space to be recovered: 15.2kB
Files to be deleted: 3
elapsed time: 3 seconds

... But I would expect to see more (including more of the synthesised ones, created in the first step).

  • Close BleachBit.

I then copied the contents of "C:\Windows\System32" to "C:\Temp\Windows\System00", providing admin authentication and skipping any "issue" files.

The cleaner ("testcleaner1.xml") is then modified to point at "C:\Temp\Windows\System00"
Create a second cleaner, containing the above modification, if more convienent.

  • As a non admin user, BleachBit is started ("BleachBit", not "BleachBit not UAC").
  • At the UAC, an admin user/password is supplied.
  • The "Preview" option is chosen and the cleaner executes.

This time far more files are found:

clean_operation('testcleaner1'), options = '['test1_items']'
Delete 65.5kB C:\Temp\Windows\System00\config\systemprofile\AppData\Local\DataSharing\Storage\DSS.log
Delete 65.5kB C:\Temp\Windows\System00\config\systemprofile\AppData\Local\DataSharing\Storage\DSS00008.log
Delete 65.5kB C:\Temp\Windows\System00\config\systemprofile\AppData\Local\DataSharing\Storage\DSStmp.log
Delete 524.3kB C:\Temp\Windows\System00\config\systemprofile\AppData\Local\Microsoft\Windows\WebCache\V01.log
Delete 524.3kB C:\Temp\Windows\System00\config\systemprofile\AppData\Local\Microsoft\Windows\WebCache\V01tmp.log
Delete 28.7kB C:\Temp\Windows\System00\config\BCD-Template.LOG
Delete 12.9kB C:\Temp\Windows\System00\LogFiles\setupcln\setupact.log
Delete 1kB C:\Temp\Windows\System00\LogFiles\setupcln\setuperr.log
Delete 1.3kB C:\Temp\Windows\System00\LogFiles\setupcln\tmp.log
Delete 9B C:\Temp\Windows\System00\logfoldertest\tmp.log
Delete 16.4kB C:\Temp\Windows\System00\MsDtc\Trace\dtctrace.log
Delete 4.2MB C:\Temp\Windows\System00\MsDtc\MSDTC.LOG
Delete 1.3kB C:\Temp\Windows\System00\SleepStudy\ScreenOn\tmp.log
Delete 1.3kB C:\Temp\Windows\System00\SleepStudy\tmp.log
Delete 65.5kB C:\Temp\Windows\System00\sru\SRU.log
Delete 65.5kB C:\Temp\Windows\System00\sru\SRU00394.log
Delete 65.5kB C:\Temp\Windows\System00\sru\SRU00395.log
Delete 65.5kB C:\Temp\Windows\System00\sru\SRU00396.log
Delete 65.5kB C:\Temp\Windows\System00\sru\SRUtmp.log
Delete 17.5kB C:\Temp\Windows\System00\Sysprep\Panther\setupact.log
Delete 0B C:\Temp\Windows\System00\Sysprep\Panther\setuperr.log
Delete 10B C:\Temp\Windows\System00\Sysprep\Panther\tmp.log
Delete 9B C:\Temp\Windows\System00\Testlogfolder\tmp.log
Delete 0B C:\Temp\Windows\System00\ma-log4cpp.log
Delete 9B C:\Temp\Windows\System00\ma-log4cpp_rolling.log
Delete 9B C:\Temp\Windows\System00\providerFx-log4cpp.log
Delete 9B C:\Temp\Windows\System00\providerFx-log4cpp_rolling.log
Delete 17B C:\Temp\Windows\System00\tmp.log

Disk space to be recovered: 5.8MB
Files to be deleted: 28
elapsed time: 6 seconds

Expected behaviour
The cleaner is expected to find the files or detail permission failures and continue to the next object.

Observations and notes
If we consider one of the dummy "tmp.log" files we created in the path "C:\Windows\System32\Sysprep\Panther":
... we find it can be opened by a normal user (not member of the "administrator" group):

notepad C:\Windows\System32\Sysprep\Panther\tmp.log

On attempting to save a modification to the above, we see a warning:

C:\Windows\System32\Sysprep\Panther\tmp.log
You do not have permission to open this file. See the owner of the file or an adminsitrator to obtain permission.

The folder is visible if the same user attempts a "dir" command:

dir C:\Windows\System32\Sysprep\Panther

Output:

Volume in drive C is SYSTEM
Volume Serial Number is 3E7D-AC3A

Directory of C:\Windows\System32\Sysprep\Panther

13/02/2024 17:48

.
13/02/2024 17:48 ..
13/02/2024 08:27 3,813 diagerr.xml
13/02/2024 08:27 4,123 diagwrn.xml
13/02/2024 08:27 17,537 setupact.log
27/10/2022 18:07 0 setuperr.log
13/02/2024 17:48 10 tmp.log
5 File(s) 25,483 bytes
2 Dir(s) 23,596,908,544 bytes free

Desktop (please complete the following information):
Windows 10 Pro x64 running under VMWare Player hypervisor.
BleachBit version 4.6.0
Build number 2537
GTK version 3.18.9
GTK theme = Adwaita
GTK icon theme = Adwaita
GTK prefer dark theme = True
SQLite version 3.43.2
local_cleaners_dir = None
locale_dir = C:\Program Files (x86)\BleachBit\share\locale
options_dir = C:\Users\Chris Bennett\AppData\Roaming\BleachBit
personal_cleaners_dir = C:\Users\Chris Bennett\AppData\Roaming\BleachBit\cleaners
system_cleaners_dir = C:\Program Files (x86)\BleachBit\share\cleaners
locale.getdefaultlocale = ('en_GB', 'cp1252')
os.getenv('APPDATA') = C:\Users\Chris Bennett\AppData\Roaming
os.getenv('cd') = C:\Program Files (x86)\BleachBit
os.getenv('LocalAppData') = C:\Users\Chris Bennett\AppData\Local
os.getenv('LocalAppDataLow') = C:\Users\Chris Bennett\AppData\LocalLow
os.getenv('Music') = C:\Users\Chris Bennett\Music
os.getenv('USERPROFILE') = C:\Users\Chris Bennett
os.getenv('ProgramFiles') = C:\Program Files (x86)
os.getenv('ProgramW6432') = C:\Program Files
os.getenv('TMP') = C:\Users\CHRISB1\AppData\Local\Temp
os.path.expanduser('
') = C:\Users\Chris Bennett
platform.win32_ver1 = 10.0.19041
platform.platform = Windows-10-10.0.19041
platform.version = 10.0.19041
sys.argv = ['C:\Program Files (x86)\BleachBit\bleachbit.exe', '--no-uac', '--gui']
sys.executable = C:\Program Files (x86)\BleachBit\bleachbit.exe
sys.version = 3.4.4 (v3.4.4:737efcadf5a6, Dec 20 2015, 19:28:18) [MSC v.1600 32 bit (Intel)]
win32com.shell.shell.IsUserAnAdmin() = False
file = C:\Program Files (x86)\BleachBit\library.zip\bleachbit\SystemInformation.pyo

@BusterRaid BusterRaid added the new label Feb 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant