If it is empty at the beginning, the operation is free.

Today it is a narrow check for mfs.  Tomorrow someone will want to
add tmpfs to this.  And next month, some other crazy configuration.

So I do not see the point of this diff, at all.

The find operation is free.  The echo doesn't stab you in the eye.
Just ignore it.

Klemens Nanni <[email protected]> wrote:

> There is no problem to fix, but every boot I read "/clearing /tmp" and
> know it is a useless step since my /tmp live on volatile RAM anyway.
> 
> Other steps in rc(8) also check and print/log conditionally, so this
> can do as well, saving yet another line.
> 
> There is also the unconditional
>       echo 'preserving editor files.'; /usr/libexec/vi.recover
> which will never find anything to recover on mfs, but the script also
> creates directories, so skipping it on mfs would actually break things.
> 
> cvs diff -wU0:
>       |@@ -544,0 +545 @@ fi
>       |+if ! df -t mfs /tmp >/dev/null 2>&1; then
>       |@@ -548 +548,0 @@ echo clearing /tmp
>       |-# (not needed with mfs /tmp, but doesn't hurt there...).
>       |@@ -552,0 +553 @@ echo clearing /tmp
>       |+fi
> 
> Feedback? Objection? OK?
> 
> Index: rc
> ===================================================================
> RCS file: /cvs/src/etc/rc,v
> retrieving revision 1.564
> diff -u -p -r1.564 rc
> --- rc        29 Aug 2022 11:51:05 -0000      1.564
> +++ rc        4 Oct 2022 22:45:09 -0000
> @@ -542,14 +542,15 @@ if [[ -f /etc/ptmp ]]; then
>           'password file may be incorrect -- /etc/ptmp exists'
>  fi
>  
> -echo clearing /tmp
> +if ! df -t mfs /tmp >/dev/null 2>&1; then
> +     echo clearing /tmp
>  
> -# Prune quickly with one rm, then use find to clean up /tmp/[lqv]*
> -# (not needed with mfs /tmp, but doesn't hurt there...).
> -(cd /tmp && rm -rf [a-km-pr-uw-zA-Z]*)
> -(cd /tmp &&
> -    find . -maxdepth 1 ! -name . ! -name lost+found ! -name quota.user \
> -     ! -name quota.group ! -name vi.recover -execdir rm -rf -- {} \;)
> +     # Prune quickly with one rm, then use find to clean up /tmp/[lqv]*
> +     (cd /tmp && rm -rf [a-km-pr-uw-zA-Z]*)
> +     (cd /tmp &&
> +         find . -maxdepth 1 ! -name . ! -name lost+found ! -name quota.user \
> +             ! -name quota.group ! -name vi.recover -execdir rm -rf -- {} \;)
> +fi
>  
>  # Create Unix sockets directories for X if needed and make sure they have
>  # correct permissions.
> 

Reply via email to