I open this bug for several suggestions which are treated by one patch: 1. Depending on the system configuration, it might be desirable for the user to also clean /tmp directories on chroot partitions. Therefore I suggest to use WIPE_DIRS instead of WIPE_TMP in /etc/conf.d/bootmisc where WIPE_DIRS is a list of temporary directories to clean. 2. In /etc/init.d/bootmisc there was a remark that one should open a bug if one knows a cleaner solution than "eval". Such a cleaner solution would be to use a function which accepts the "exceptions" as arguments. 3. In the rmdir call there was '--' missing (which is probably usually not necessary, but certainly more secure). 4. Since GNU find is POSIX compatible meanwhile (and this compatible version of find is stable for quite a while now, I suppose), it might be better (and even slightly faster) to use the POSIX compliant '-exec rm ... +' instead of the GNU-specific '-print0 | xargs -0 rm ...'
Created attachment 130398 [details, diff] Patch for the above suggestions In the attached patch against /etc/init.d/bootmisc of baselayout-1.12-9-r2, all the issues are addressed. In addition, I avoided bashisms in the patched parts (except for the ${PWD} sanity test - I don't know how compatible this variable is; it might be necessary to use $(pwd) instead) and I used grouping {...} instead of a subshell (...) where possible, because it usually executes faster.
(In reply to comment #1) > In addition, I avoided bashisms in the patched parts > (except for the ${PWD} sanity test - I don't know how compatible this variable > is; it might be necessary to use $(pwd) instead) and I used grouping {...} > instead of a subshell (...) where possible, because it usually executes faster. > Getting rid of the [[ ... ]] tests is important also for bash users who use bash in its POSIX incarnation (called with /bin/sh or the POSIXLY_CORRECT environment variable set), so thanks. ${var} is kosher, but "/tmp/.{ICE,X11}-unix" should be expanded to "/tmp/.ICE-unix /tmp/.X11-unix" -- it will work with bash and posix bash, but not with true bourne shells. (BTW, Debian-based distros and OpenBSD have a "checkbashisms" script you might find useful.) Other than that, you're making an invalid assumption by placing this cleanup in bootmisc: That services started after bootmisc all use local mounts. What if you have a tmp directory on an NFS mount? apache is often run on multiple servers against sharing a single repository, and is notorious for leaving sess_* files in its tmp directory.
(In reply to comment #2) > Other than that, you're making an invalid assumption by placing > this cleanup in bootmisc: That services started after bootmisc all use > local mounts. What if you have a tmp directory on an NFS mount? I am aware of that, but in such a case the only proper solutions is to run two cleanup scripts (maybe it would be appropriate to add a comment to /etc/conf.d/bootmisc, warning that only local directories can be used): Of course, the only reasonable place to clean "runtime" temporary directories is as soon as possible after mounting, because at any later time some files could already have been created in a temporary directory. IMHO the user should have the possibility to extend this list of "runtime" temporary directories to more than just /tmp (e.g., he might want to start some net related stuff in a chroot environment which then needs such a directory to be cleaned even before net is mounted). Of course, I would not protest, if you decide e.g. to put the new wipedir (and findwipe) function into a new script which is sourced (or executed) from bootmisc *and* in addition from some new /etc/init.d/clean-after-net. However, I consider the latter somewhat dangerous, because the user must be very well aware that at this time no tool he started so far has produced some file in the directories he wants to clean at this stage - maybe such things are better totally left to the user.
Comment on attachment 130398 [details, diff] Patch for the above suggestions baselayout-1.x is not seeing any bashism changes
implemented in baselayout-2