yum clean bug

Sean seanlkml at sympatico.ca
Fri Dec 9 07:50:52 UTC 2005


On Thu, December 8, 2005 7:19 pm, Konstantin Ryabitsev said:

> cd /var/cache/yum
> for DIR in *; do
>     if ! grep -q "[$DIR]" /etc/yum.repos.d/*.repo; then
>         rm -rf $DIR
>     fi
> done
>
> There you go. You can put it in your cron.weekly.


This script is a bit fragile.  There will be bad consequences if
/var/cache/yum goes missing for whatever reason; it's likely to wipe out
your entire filesystem.   Better to fail rather than proceed if the "cd"
fails.   Even with that fixed the script could do unintended things if any
of the directories happen to have a space in them because $DIR isn't
properly quoted.

Sean




More information about the fedora-devel-list mailing list