pkgsrc-Users archive

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

Re: Error running "mozilla-rootcerts install" on macOS



On 03/22, J. Lewis Muir wrote:
> Hello, pkgsrc Users!
> 
> On macOS Sierra 10.12.3, I installed Mercurial using pkgin from my own
> binaries produced from pkgsrc -current yesterday:
> 
> # pkgin install mercurial
> 
> This pulled in a dependency on mozilla-rootcerts.  Since
> mozilla-rootcerts got installed, I thought I should do what its MESSAGE
> file says:
> 
> # mozilla-rootcerts install
> 
> This eventually failed with exit status 1.  The last three lines of
> output were:
> 
> ===
> mozilla-rootcert-98.pem => 4bfab552.0
> mozilla-rootcert-99.pem => 09789157.0
> ERROR: /etc/ssl/certs already exists, aborting.
> ===
> 
> Indeed, /etc/ssl/certs exists, but it's empty:
> 
> ===
> # ls -alF /etc/ssl/certs
> total 0
> drwxr-xr-x  2 root  wheel   68 Oct 20 17:53 ./
> drwxr-xr-x  6 root  wheel  204 Oct 20 17:53 ../
> ===
> 
> Should the check at line 208 of
> security/mozilla-rootcerts/files/mozilla-rootcerts.sh for the
> existence of $destdir$certdir instead be for the existence of
> $destdir$certdir/ca-certificates.crt?  In my case, this would have
> allowed the install to succeed.

Below is a patch to fix this.  It checks for the existence of
$destdir$certdir/ca-certificates.crt instead of $destdir$certdir, since
$destdir$certdir/ca-certificates.crt is what will be written and what we
don't want to clobber.  If the $destdir$certdir directory exists, that's
OK.

Thanks,

Lewis

diff --git a/security/mozilla-rootcerts/files/mozilla-rootcerts.sh b/security/mozilla-rootcerts/files/mozilla-rootcerts.sh
index 6c210da..86b175c 100644
--- a/security/mozilla-rootcerts/files/mozilla-rootcerts.sh
+++ b/security/mozilla-rootcerts/files/mozilla-rootcerts.sh
@@ -205,11 +205,11 @@ install)
        $self extract
        $self rehash
        set +e
-       if [ -d $destdir$certdir ]; then
-               ${ECHO} 1>&2 "ERROR: $destdir$certdir already exists, aborting."
+       if [ -e $destdir$certdir/ca-certificates.crt ]; then
+               ${ECHO} 1>&2 "ERROR: $destdir$certdir/ca-certificates.crt already exists, aborting."
                exit 1
        fi
        set -e
-       $MKDIR $destdir$certdir
+       [ -d $destdir$certdir ] || $MKDIR $destdir$certdir
        cat $destdir$SSLDIR/*.pem > $destdir$certdir/ca-certificates.crt
 esac


Home | Main Index | Thread Index | Old Index