(PUP-3558) Fix offset error of '[' lexing when multibyte chars are used

If there were multibyte characters anywhere before a '[' and the '['
should have been lexed as a LBRACK the difference in byte position and
char position could result in looking at the wrong position for the
character preceding the '['. If that character (wrong position) was
a whitespace, the lexer would emit a LISTSTART token instead of LBRACK.

The correct way to translate byte offset to char offset is to
use the locator.char_offset(byte_offset) method (since the method varies
depending on Ruby version).

If jupiter aligned with mars the result could be a syntax error on the
'[' because a literal list was not accepted in that position, or worse,
an access expression (x[y]), could be broken apart into two expressions;
a value followed by a literal list. The latter could go unnoticed except
for not producing the wanted answer.

This commit changes the method to get the char offset to use the locator
instead of using the byte offset as a char index when looking at the
preceding character of a '['.
Merge pull request #3250 from hlindberg/PUP-3558_non-ascii-chars-breaks-liststart-check

(PUP-3558) Fix offset error of '[' lexing when multibyte chars are used
(PUP-3593) Ensure puppet-server is stopped before cleaning certs.

This will prevent cert cleaning from happening while puppet-server is still
starting up, for example when one of the last actions by the previous test case
was to restart the master.
(PUP-3555) Override-able cache expiration service

This commit introduces an override-able cache
expiration service for directory environment cache
entries.  A caller may provide a custom implementation
of the expiration service, and it will receive
callbacks whenever a cache entry is created,
checked for expiration, or evicted.
Merge pull request #3260 from cprice404/feature/master/PUP-3555-cache-expiration-service

(PUP-3555) Override-able cache expiration service
Merge pull request #3258 from waynr/quickfix

(PUP-3593) Address SSL cleanup and puppetserver restart timing issues in acceptance tests.
(PUP-3471) Don't clobber variables in system path

Bumps puppet_for_the_win dependency for PUP-3471.
(PUP-3601) Adjust Facter dependency for Windows

This moves the Facter dependency to 2.3.0 since it was just released and should
be released with the next version of the Puppet MSI that we ship (3.7.3).
Merge pull request #3262 from ferventcoder/ticket/stable/PUP-3601-update-facter-for-windows

(PUP-3601) Adjust Facter dependency for Windows
(PUP-3602) Do not convert 0eN strings to floating point

This prevents strings that could be interpreted as 0 (any number of
of value digits or decimals) times 10 raised to some value to be
converted to floating point. Any such literal entry can be replaced by a
numeric value that is just 0 in source if indeed someone entered such a
strange constant as a string and expecting it to be a numeric 0.

The problem with allowing the conversion to take place is that strings
as produced by md5 fingerprinting typically starts with 0e thus making
all md5 fingerprints equal due to all being numerical 0.

This fix changes the conversion so that zero (in any form) followed by
eE and digits is not converted.
(PUP-3602) Make string to number not convert infinite values

Strings that can be converted to a floating point value that is infinite
should not be converted to floating point.

This also fixes the alternative code path when values are converted
and the radix is returned. (An odd code path for floating point
values)
(PUP-3602) Fix faulty spec it-titles
(PUP-3602) Break out common match to floating point logic

This breaks out the repeated sequence of converting a match
to a floating point value. The exact same sequence was performed
for both to_n, and to_n_with_radix.
Merge pull request #3263 from hlindberg/PUP-3602_do_not_convert_scientific_0e_strings_to_float

(PUP-3602) Do not convert 0eN strings to floating point
(packaging) Update PUPPETVERSION to 3.7.3
(PUP-3277) Check if puppetdb has emptied queue before reports test

The PE version of acceptance/tests/reports/submission.rb queries
puppetdb before and after an agent run to check that a new report has
been stored. Occasionally, depending on load issues in our testing
environment, Beaker would request the current report time before
puppetdb had had a chance to finish processing, and the test would fail
because we would see the previous timestamp.  This patch borrows a
helper from puppetdb which checks that the worker queue is empty before
querying for the latest report.
Merge branch 'maint/stable/reports-submission-test' into stable

* maint/stable/reports-submission-test:
  (PUP-3277) Check if puppetdb has emptied queue before reports test
(PUP-3446) Sign certificates used in testing

On versions of OpenSSL around version 0.9.8y, it was possible to decode certificates
that had not been signed. However OpenSSL 1.0.1i cannot decode unsigned
certificates. Given the following PEM encoded cert:

    -----BEGIN CERTIFICATE-----
    MIGqMIGgoAMCAQICAQAwAgYAMAAwHhcNMTQxMDAxMTgzNTQ5WhcNMTQxMDAxMTkz
    NTQ5WjASMRAwDgYDVQQDDAd0ZXN0aW5nMFwwDQYJKoZIhvcNAQEBBQADSwAwSAJB
    ALiOQvoQaSIRDogCJwLKmM11vObOnBm93AdGkezbpdHI/TFebvvZYT2J6ukPmyVD
    bGa0ZEpg5gc2yJ+sgJTwbSsCAwEAATACBgADAQA=
    -----END CERTIFICATE-----

When printed to text this results in the following:

    Certificate:
        Data:
            Version: 3 (0x2)
            Serial Number: 0 (0x0)
        Signature Algorithm: NULL
            Issuer:
            Validity
                Not Before: Oct  1 18:35:49 2014 GMT
                Not After : Oct  1 19:35:49 2014 GMT
            Subject: CN=testing
            Subject Public Key Info:
                Public Key Algorithm: rsaEncryption
                    Public-Key: (512 bit)
                    Modulus:
                        00:b8:8e:42:fa:10:69:22:11:0e:88:02:27:02:ca:
                        98:cd:75:bc:e6:ce:9c:19:bd:dc:07:46:91:ec:db:
                        a5:d1:c8:fd:31:5e:6e:fb:d9:61:3d:89:ea:e9:0f:
                        9b:25:43:6c:66:b4:64:4a:60:e6:07:36:c8:9f:ac:
                        80:94:f0:6d:2b
                    Exponent: 65537 (0x10001)
        Signature Algorithm: NULL

OpenSSL 1.0.1i can convert the certificate to PEM and DER, but it cannot
decode it. Decoding the PEM encoded text directly as a cert results in
the following error:

    OpenSSL::X509::Certificate.new(minimal_certificate.to_pem)
    OpenSSL::X509::CertificateError: nested asn1 error

Decoding the DER encoded cert as raw ASN1 results in the following:

    OpenSSL::ASN1.decode(minimal_certificate.to_der)
    OpenSSL::ASN1::ASN1Error: invalid object encoding

So OpenSSL is convinced that we have a mangled certificate.

The solution to this to self-sign the certificate, so that the
certificate can be properly encoded and decoded.
Merge pull request #3273 from kylog/issue/pup-3446/sign-cert-in-spec-test

(PUP-3446) Sign certificates used in testing
(PUP-3391) Plugin synced for incorrect environment while agent is resolving environment

Before this commit if an agents environment was changed the plugins from
the initial environment were synced instead of the plugins from the
environment where the node would end up. This would cause problems where
a manifest from one environment would be applied with custom types and
providers from a different environment.

This commit changes the behavior to sync plugins after every environment
resolution. We need to sync the plugins after every environment change
because this action needs to be performed before we can retrieve a
manifest for the node in a particular environment.