Source-Changes-D archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: CVS commit: src/etc/rc.d



On Fri, Dec 14, 2012 at 06:42:26PM +0000, Alan Barrett wrote:
> Module Name:  src
> Committed By: apb
> Date:         Fri Dec 14 18:42:25 UTC 2012
> 
> Modified Files:
>       src/etc/rc.d: random_seed
> 
> Log Message:
> Avoid using programs from /usr/bin.  This should fix PR 47326.
> 
> - no need for "dirname", because "df -G" can take a file name directly.
> - replace use of "awk" with a shell while read loop.
> - replace use of "stat -s" with "ls -ldn".
> - no need for "tail" now that the use of "stat" has changed.
> 
> While here, also add some shell quotes and improve the grammar in a comment.

With this change, i do still see a bootstrap problem when
${random_file} doesn't exists ...

njoly@lynche [~]# ls -l /var/db/entropy-file
ls: /var/db/entropy-file: No such file or directory
root@lynche [~]# /etc/rc.d/random_seed stop
df: /var/db/entropy-file: No such file or directory

Actually, if the file does not exists it will fail to create one.

random_save()
{
        oum=$(umask)
        umask 077

        rm -Pf "${random_file}"

        if ! fs_safe "${random_file}"; then
                return 1
        fi

        if rndctl -S "${random_file}"; then
                echo "Saved entropy to disk."
        fi
}

First, rm(1) is called before fs_safe() check which will always
fail. Even with the rm call commented or better moved just before
rndctl, the fs_safe call will fail in df(1) if file does not already
exists. Chicken or Egg ...

-- 
Nicolas Joly

Biology IT Center
Institut Pasteur, Paris.


Home | Main Index | Thread Index | Old Index