Bug 259808 - etc/periodic/daily/100.clean-disks: Fix error (Directory not empty) when removing ports matching '*.core'
Summary: etc/periodic/daily/100.clean-disks: Fix error (Directory not empty) when remo...
Status: Open
Alias: None
Product: Base System
Classification: Unclassified
Component: conf (show other bugs)
Version: Unspecified
Hardware: Any Any
: --- Affects Some People
Assignee: freebsd-bugs (Nobody)
URL:
Keywords: easy, needs-qa
: 259906 (view as bug list)
Depends on:
Blocks:
 
Reported: 2021-11-13 03:12 UTC by Alexander Sheiko
Modified: 2024-01-20 18:01 UTC (History)
2 users (show)

See Also:
koobs: mfc-stable13?


Attachments
100.clean-disks.patch (462 bytes, patch)
2021-11-13 03:12 UTC, Alexander Sheiko
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Alexander Sheiko 2021-11-13 03:12:43 UTC
Created attachment 229461 [details]
100.clean-disks.patch

Cleaning disks:
rm: py-pyroute2.core: Directory not empty

/etc/periodic/daily/100.clean-disks attempt to remove *.core named ports. For example:

/usr/ports/net/py-pyroute2.core

Fix: /usr/ports/ (ports directory) must be excluded in script - see attached patch.

Set daily_clean_disks_files="" in /etc/periodic.conf (bug #41777) - is not fix for it.
Comment 1 Andriy Gapon freebsd_committer freebsd_triage 2021-11-15 14:01:27 UTC
There is nothing terribly special about /usr/ports, there can be other places where *.core is a precious file or directory.
So, the script should be extended with a notion of configurable excluded paths.

Or, better yet, just don't use this script.  I think that the idea that a certain name pattern would match only useless files globally can be dangerous.
Comment 2 Alexander Sheiko 2021-11-15 19:03:42 UTC
Configurable excluded paths is good idea.

I use this script since FreeBSD 4.x and have no any problems before subject error.
Comment 3 Kubilay Kocak freebsd_committer freebsd_triage 2021-11-18 00:27:55 UTC
*** Bug 259906 has been marked as a duplicate of this bug. ***
Comment 4 epopen 2022-09-29 15:09:46 UTC
Configurable excluded paths is very good idea.

I hit the problem also.
Because MySQL using prefix of "#" as many file/directory name.
And MySQL had been crash because critical files deleted by the feature.
Unfortunately the problem of "#" can not modify. 

Thank very much.
Comment 5 epopen 2022-10-25 09:41:46 UTC
Hi All

My workaround about this issue affects MySQL

- rc=$(find / \( ! -fstype local -o -fstype rdonly \) -prune -o \
+ rc=$(find / \( ! -fstype local -o -fstype rdonly -o -path '[MYSQL_DB_DIR]' -o -path '[OTHER_EXCLUDE_DIR]' \) -prune -o \
  \( $args \) -atime +$daily_clean_disks_days \