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

When applying a mode of 0466 on Windows, a mode of 0666 is applied instead

    XMLWordPrintable

Details

    • Bug
    • Status: Closed
    • Normal
    • Resolution: Won't Fix
    • PUP 3.4.0, PUP 3.4.1, PUP 3.4.2
    • None
    • None

    Description

      In spec/unit/type/file/mode_spec.rb there is a test that mentions a problem with the lower nibble support on Windows (for the sake of tests)

        describe "#sync with a symbolic mode" do
          let(:resource_sym) { Puppet::Type.type(:file).new :path => path, :mode => 'u+w,g-w' }
          let(:mode_sym) { resource_sym.property(:mode) }
       
          before { FileUtils.touch(path) }
       
          it "changes only the requested bits" do
            # lower nibble must be set to 4 for the sake of passing on Windows
            Puppet::FileSystem.chmod(0464, path)
       
            pp Puppet::Util::Windows::Security.get_mode(path).to_s(8)
            pp Puppet::Util::Windows::Security.get_security_descriptor(path)
       
            mode_sym.sync
            stat = Puppet::FileSystem.stat(path)
       
            pp Puppet::Util::Windows::Security.get_mode(path).to_s(8)
            pp Puppet::Util::Windows::Security.get_security_descriptor(path)
       
            (stat.mode & 0777).to_s(8).should == "644"
          end
        end
      

      Under the current tests, this will output the following:

      "464"
      BUILTIN\Administrators
      VAGRANT-2008R2\None
        BUILTIN\Administrators:                       0x1f0189
        VAGRANT-2008R2\None:                          0x12019f
        Everyone:                                     0x120089
        NT AUTHORITY\SYSTEM:                          0x1f01ff
       
      "644"
      BUILTIN\Administrators
      VAGRANT-2008R2\None
        BUILTIN\Administrators:                       0x1f019f
        VAGRANT-2008R2\None:                          0x120089
        Everyone:                                     0x120089
        NT AUTHORITY\SYSTEM:                          0x1f01ff
      

      If the line of the test that initially sets the mode is changed to set a mode of 0466 instead of 0464

      Puppet::FileSystem.chmod(0466, path)
      

      The following is output instead:

      "666"
      BUILTIN\Administrators
      VAGRANT-2008R2\None
        BUILTIN\Administrators:                       0x1f0189
        VAGRANT-2008R2\None:                          0x12019f
        Everyone:                                     0x12019f
        NT AUTHORITY\SYSTEM:                          0x1f01ff
       
      "666"
      BUILTIN\Administrators
      VAGRANT-2008R2\None
        BUILTIN\Administrators:                       0x1f019f
        VAGRANT-2008R2\None:                          0x120089
        Everyone:                                     0x12019f
        NT AUTHORITY\SYSTEM:                          0x1f01ff
      

      Note that instead of setting the mode to 0466, the mode is initially set to 0666. Furthermore, when trying to sync the permission changes, the mode should be changed to 0646, but instead remains at 0666.

      This behavior is incorrect.

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              ethan Ethan Brown
              Erik Dasher Erik Dasher
              Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Zendesk Support