-
Notifications
You must be signed in to change notification settings - Fork 483
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
add a script to clean up files "binned" by msys2-runtime #4622
Comments
I have not seen files in recycle bin related to msys2 or cygwin since first time using them. |
Try the script (or the pattern from the script, usually |
Could you provide any example output of that command? I have only desktop.ini files in there and could try to reproduce the issue with a new msys2 installation. |
I was actually just stepping through the cygwin code in gdb, so I have a bit of a standalone reproducer:
|
I can reproduce the issue with that command. Here is an example of those weird file.
Nice work btw, jeremy ❤️ |
As I kind of expected, docs suggest |
I've been considering this more, and trying to figure out how to replicate what cygwin does to find the recycle bin. The hardest part to script seems to be to get a list of volume mount points. This is what I've come up with so far: mountvol |
sed -ne '/^Possible values for VolumeName/,${/^\s\{8\}/{s///;/^\*\*\*/!p}}' |
cygpath -uf - |
xargs -i find '{}' -maxdepth 1 -iname '$Recycle.Bin' -print0 |
find -files0-from - -maxdepth 2 -name $'.\uDC6D\uDC73\uDC79\uDC73*' -o -name '.msys*' Allowing for making a C utility to get the volume mount points as ./volumes |
find -files0-from - -maxdepth 1 -iname '$Recycle.Bin' -print0 |
find -files0-from - -maxdepth 2 -name $'.\uDC6D\uDC73\uDC79\uDC73*' -o -name '.msys*' (for the record, on upstream cygwin the names would be |
https://cygwin.com/pipermail/cygwin/2024-June/256081.html - see if upstream has any more ideas |
Updating core packages (specifically pacman.exe and msys-2.0.dll I think) results in oddly-named files in the "recycle bin" directory (see https://github.com/msys2/msys2-runtime/blob/abcb3c6c0f330ac7568956b2be6bf3376517bb56/winsup/cygwin/syscalls.cc#L342). These files don't ever seem to get cleaned up, or indeed result as showing anything in the UI recycle bin. Hence, there should be some way to clean them up.
I made a simple script to do this (https://gist.github.com/jeremyd2019/4984ff0fa1f6fd8c99d7b8b244c52088)
This script wouldn't work right if the root of the volume is not the drive letter (like, a volume mounted on a directory). Maybe some other edge cases
I don't know where this should live though (
filesystem
? maybepacman-contrib
just because I associate this withpaccache
for regular cleanup operations).Another idea that I keep thinking of is, if the file absolutely cannot be deleted, maybe msys2-runtime could register it for deletion on reboot (with MoveFileEx with
lpNewFileName
NULL
andMOVEFILE_DELAY_UNTIL_REBOOT
flag). But I figure somebody would have tried that in cygwin at some point already...The text was updated successfully, but these errors were encountered: