ruby fails to install

I'm without port-mgmt/portupgrade right now because all version of lang/ruby are failing to install. The error always looks something like this:

install  -m 0644 /usr/ports/lang/ruby23/work/ruby-2.3.3/ext/bigdecimal/sample/*.rb  /usr/ports/lang/ruby23/work/stage/usr/local/share/examples/ruby23/bigdecimal/
(cd /usr/ports/lang/ruby23/work/ruby-2.3.3/sample/ && /bin/sh -c '(/usr/bin/find -Ed $0 $2 | /usr/bin/cpio -dumpl $1 >/dev/null 2>&1) &&  /usr/bin/find -Ed $0 $2 \(   -type d -exec /bin/sh -c '\''cd '\''$1'\'' && chmod 755 "$@"'\'' -- . {} +  -o -type f -exec /bin/sh -c '\''cd '\''$1'\'' && chmod 444 "$@"'\'' -- . {} + \)' -- . /usr/ports/lang/ruby23/work/stage/usr/local/share/examples/ruby23/)
====> Compressing man pages (compress-man)
===>  Installing for ruby23-2.3.3_1,1
===>  Checking if ruby23 already installed
===>   Registering installation for ruby23-2.3.3_1,1
Installing ruby23-2.3.3_1,1...
pkg-static: Fail to create temporary file: /usr/local/share/ri/2.3/system/XMLRPC/Service/PublicInstanceMethodsInterface/.new-c.ri.AqEjiEtrvqEx: File exists
*** Error code 70

make[1]: stopped in /usr/ports/lang/ruby23
*** Error code 1

I've removed the /usr/local/share/ri/2.x directory entirely before the installation, but it doesn't help. Without port-mgmt/portupgrade, I can't do a portupgrade -a to just update everything at once.

I've tried lang/ruby21, lang/ruby22, and lang/ruby23 to no avail. The error message for each is slightly different, but it's the same premise -- a temporary file cannot be created because it already exists. Right now, I have none of them installed.

Any suggestions?
UPDATE: I was able to get the port to install by changing the config to so it doesn't build and install Rdoc indexes. If I only need ruby for portupgrade, do I need those Rdoc things?

I was also running an older version of perl, so I'm going to update to 5.24 and try to rebuild everything and see if that fixes anything.
UPDATED UPDATE: Well, I give up. I updated perl, recompiled all ports, and I've still got exactly the same problem. But it looks like the RDocs are not necessary, so for the moment all is well.

Maybe something will be magically fixed in a future update.

I'm still willing to try things to fix the original problem if anyone has suggestions. I'll post results so future Googlers will have an answer if they run into this same problem.
The ports-mgmt/portupgrade tool was nice when there was no other tool. But one of the biggest drawbacks is its dependency on Ruby and the database it creates. In this respect ports-mgmt/portmaster is a better tool, it has no dependencies and doesn't require an easily corruptible database.

But probably the biggest reason things go haywire is when people blindly run portmaster -a or portupgrade -a. Always, yes always, read /usr/ports/UPDATING. Sometimes things need to be built in a specific order or you need to remove certain packages beforehand. Neither tool will follow those instructions and you end up with broken stuff.

no issues building/installing ruby.

# freebsd-version 

The following 2 package(s) will be affected (of 0 checked):

New packages to be INSTALLED:
    vim: 8.0.0134 [Synth]
    ruby: 2.2.6_1,1 [Synth]

Number of packages to be installed: 2

The process will require 69 MiB more space.

Proceed with this action? [y/N]: y
[1/2] Installing ruby-2.2.6_1,1...
[1/2] Extracting ruby-2.2.6_1,1: 100%
[2/2] Installing vim-8.0.0134...
[2/2] Extracting vim-8.0.0134: 100%
Message from ruby-2.2.6_1,1:
Some of the standard commands are provided as separate ports for ease
of upgrading:

    devel/ruby-gems:    gem - RubyGems package manager
    devel/rubygem-rake:    rake - Ruby Make

And some of the standard libraries are provided as separate ports
since they require extra dependencies:

    databases/ruby-gdbm:    GDBM module

Install them as occasion demands.

# pkg info ruby 
Name           : ruby
Version        : 2.2.6_1,1
Installed on   : Fri Dec 23 19:18:42 2016 CET
Origin         : lang/ruby22
Architecture   : freebsd:11:x86:64
Prefix         : /usr/local
Categories     : ipv6 ruby lang
Licenses       : RUBY or BSD2CLAUSE
Maintainer     :
WWW            :
Comment        : Object-oriented interpreted scripting language
Options        :
    CAPIDOCS       : off
    DEBUG          : off
    DOCS           : on
    EXAMPLES       : on
    GMP            : off
    LIBEDIT        : on
    RDOC           : on
    READLINE       : off
Shared Libs required:
Shared Libs provided:
Annotations    :
    cpe            : cpe:2.3:a:ruby-lang:ruby:2.2.6:p0::::freebsd11:x64:1
    repo_type      : binary
    repository     : Synth
Flat size      : 39.6MiB
Description    :
Ruby is the interpreted scripting language for quick and
easy object-oriented programming.  It has many features to
process text files and to do system management tasks (as in
Perl).  It is simple, straight-forward, and extensible.

Features of Ruby are shown below.

  + Simple Syntax
  + *Normal* Object-Oriented features(ex. class, method calls)
  + *Advanced* Object-Oriented features(ex. Mix-in, Singleton-method)
  + Operator Overloading
  + Exception Handling
  + Iterators and Closures
  + Garbage Collection
  + Dynamic Loading of Object files(on some architecture)
  + Highly Portable(works on many UNIX machines, and on DOS,
    Windows, Mac, BeOS etc.)


ASX I know. My workstation compiled fine but two of my servers didn't. One other guy on that bug said he had a problem and I saw some other guy on a forum complain about the same thing.
Just to complete the story for future googlers, the problem was not with ruby, but with (as the bugzilla link suggested) pkg.

Due to the holidays, I don't know exactly when the update came out, but after updating ports and installing the new pkg, everything compiled and installed successfully with Rdocs turned on.

Another of those port-related problems that just works itself out if you wait a few days, I guess.