Uploaded image for project: 'Puppet'
  1. Puppet
  2. PUP-8326

MacOS 10.13 unit test fails on APFS file system when creating invalid UTF-8 file name

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Normal
    • Resolution: Fixed
    • Affects Version/s: PUP 5.3.3
    • Fix Version/s: PUP 5.3.4
    • Component/s: None
    • Labels:
      None
    • Template:
      PUP Bug Template
    • Team:
      Platform OS
    • Method Found:
      Automated Test
    • Release Notes:
      Not Needed
    • QA Risk Assessment:
      No Action

      Description

      So I upgraded my Mac to High Sierra and now I've got a new unit test that is failing. It appears that I'm on the new APFS filesystem and it doesn't allows an invalid utf-8 encoding for the filename so the test fails.

      Failures:
       
        1) Puppet::Indirector::JSON#search raises if the content contains binary
           Failure/Error: File.binwrite(subject.path("foo#{binary}.bin", ''), "foo-binary")
           Errno::EILSEQ:
             Illegal byte sequence @ rb_sysopen - /var/folders/41/jfjd_k_n0tdg_m_gn_m7ykfh0000gq/T/rspecrun20180105-46754-10h4tji/jsondir20180105-46754-1s9q9vu/indirector_testing/foo??.bin
           # ./spec/unit/indirector/json_spec.rb:206:in `binwrite'
           # ./spec/unit/indirector/json_spec.rb:206:in `block (3 levels) in <top (required)>'
           # util/rspec_runner:44:in `run'
           # util/rspec_runner:59:in `<main>'
      Finished in 9.71 seconds (files took 3.05 seconds to load)
       
      Finished in 2 minutes 11.5 seconds
      23427 examples, 1 failure, 43 pending
       
      Failed examples:
      rspec ./spec/unit/indirector/json_spec.rb:202 # Puppet::Indirector::JSON#search raises if the content contains binary
      

      Here you can see that its really the binwrite that is throwing EILSEQ

      14:11 $ ruby --version
      ruby 2.4.2p198 (2017-09-14 revision 59899) [x86_64-darwin17]
      ✔ ~/work/my_repos/puppet [5.3.x ↓·6|✚ 1…1⚑ 1]
      14:11 $ irb
      irb(main):001:0> binary = "\xC0\xFF".force_encoding(Encoding::BINARY)
      => "\xC0\xFF"
      irb(main):002:0> File.binwrite("/tmp/foo#{binary}.bin", "foo-binary")
      Errno::EILSEQ: Illegal byte sequence @ rb_sysopen - /tmp/foo��.bin
      	from (irb):2:in `binwrite'
      	from (irb):2
      	from /Users/eric.delaney/.rbenv/versions/2.4.2/bin/irb:11:in `<main>'
      irb(main):003:0> binary.encoding
      => #<Encoding:ASCII-8BIT>
      irb(main):004:0> string = "/tmp/foo#{binary}.bin"
      => "/tmp/foo\xC0\xFF.bin"
      irb(main):005:0> File.binwrite(string, "bin")
      Errno::EILSEQ: Illegal byte sequence @ rb_sysopen - /tmp/foo��.bin
      	from (irb):5:in `binwrite'
      	from (irb):5
      	from /Users/eric.delaney/.rbenv/versions/2.4.2/bin/irb:11:in `<main>'
      irb(main):006:0>
      

      My mac is running on the new APFS filesystem:

      ✔ ~/work/my_repos/puppet [5.3.x ↓·6|✚ 1…1⚑ 1]
      14:18 $ mount
      /dev/disk1s1 on / (apfs, local, journaled)
      devfs on /dev (devfs, local, nobrowse)
      /dev/disk1s4 on /private/var/vm (apfs, local, noexec, journaled, noatime, nobrowse)
      map -hosts on /net (autofs, nosuid, automounted, nobrowse)
      map auto_home on /home (autofs, automounted, nobrowse)
      ✔ ~/work/my_repos/puppet [5.3.x ↓·6|✚ 1…1⚑ 1]
      

        Attachments

          Activity

            jsd-sla-details-panel

              People

              • Assignee:
                Unassigned
                Reporter:
                eric.delaney Eric Delaney
              • Votes:
                0 Vote for this issue
                Watchers:
                1 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:

                  Zendesk Support