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

Puppet::Util.safe_posix_fork fails if /proc/self is not a directory

    XMLWordPrintable

Details

    • Bug
    • Status: Resolved
    • Normal
    • Resolution: Fixed
    • None
    • PUP 7.19.0
    • None
    • Phoenix
    • 1
    • Phoenix 2022-08-03, Phoenix 2022-08-17
    • Needs Assessment
    • Bug Fix
    • Puppet handles misconfigured /proc filesystems correctly
    • Needs Assessment

    Description

      Puppet Version: 7.12.0
      Puppet Server Version: N/A
      OS Name/Version: macOS 12.5

      If a host has /proc/self but as a file, safe_posix_fork will throw an unhandled Errno::ENOTDIR, leading to a failed puppet run.

      This is not typical, but we had a user on a macOS 12 machine set up /proc/self in this way:

      1. AppendĀ proc Volumes/proc to /etc/synthentic.conf
      2. sudo mkdir /Volumes/proc
      3. Reboot
      4. sudo touch /proc/self

      Subsequent puppet executions will fail:

      Error: Could not create resources for managing Puppet's files and directories in sections [:main, :agent, :ssl]: Could not get group list from DirectoryService
      Error: Could not prepare for execution: Could not create resources for managing Puppet's files and directories in sections [:main, :agent, :ssl]: Could not get group list from DirectoryService
      

      Adding Errno::ENOTDIR to the rescue here works around the issue.

      Desired Behavior:
      Puppet handles misconfigured /proc filesystems correctly

      Actual Behavior:
      Puppet runs fail.

      $ echo "notice('test')" | sudo /Library/GoogleCorpSupport/bin/puppet apply --test --trace --debug
      Error: Could not create resources for managing Puppet's files and directories in sections [:main, :agent, :ssl]: Could not get group list from DirectoryService
      /Library/GoogleCorpSupport/Puppet/lib/ruby/site_ruby/puppet/provider/nameservice/directoryservice.rb:101:in `rescue in list_all_present'
      /Library/GoogleCorpSupport/Puppet/lib/ruby/site_ruby/puppet/provider/nameservice/directoryservice.rb:98:in `list_all_present'
      /Library/GoogleCorpSupport/Puppet/lib/ruby/site_ruby/puppet/provider/nameservice/directoryservice.rb:151:in `single_report'
      /Library/GoogleCorpSupport/Puppet/lib/ruby/site_ruby/puppet/provider/nameservice/directoryservice.rb:504:in `getinfo'
      /Library/GoogleCorpSupport/Puppet/lib/ruby/site_ruby/puppet/provider/nameservice.rb:192:in `exists?'
      /Library/GoogleCorpSupport/Puppet/lib/ruby/site_ruby/puppet/type/group.rb:234:in `exists?'
      /Library/GoogleCorpSupport/Puppet/lib/ruby/site_ruby/puppet/settings.rb:888:in `service_group_available?'
      /Library/GoogleCorpSupport/Puppet/lib/ruby/site_ruby/puppet/settings/file_setting.rb:52:in `safe_to_use_settings_value?'
      /Library/GoogleCorpSupport/Puppet/lib/ruby/site_ruby/puppet/settings/file_setting.rb:43:in `value'
      /Library/GoogleCorpSupport/Puppet/lib/ruby/site_ruby/puppet/settings/file_setting.rb:95:in `group'
      /Library/GoogleCorpSupport/Puppet/lib/ruby/site_ruby/puppet/settings/file_setting.rb:157:in `to_resource'
      /Library/GoogleCorpSupport/Puppet/lib/ruby/site_ruby/puppet/settings.rb:1052:in `block in to_catalog'
      /Library/GoogleCorpSupport/Puppet/lib/ruby/site_ruby/puppet/settings.rb:1048:in `each'
      /Library/GoogleCorpSupport/Puppet/lib/ruby/site_ruby/puppet/settings.rb:1048:in `to_catalog'
      /Library/GoogleCorpSupport/Puppet/lib/ruby/site_ruby/puppet/settings.rb:1123:in `use'
      /Library/GoogleCorpSupport/Puppet/lib/ruby/site_ruby/puppet/application/apply.rb:310:in `setup'
      /Library/GoogleCorpSupport/Puppet/lib/ruby/site_ruby/puppet/application.rb:413:in `block in run'
      /Library/GoogleCorpSupport/Puppet/lib/ruby/site_ruby/puppet/util.rb:744:in `exit_on_fail'
      /Library/GoogleCorpSupport/Puppet/lib/ruby/site_ruby/puppet/application.rb:413:in `run'
      /Library/GoogleCorpSupport/Puppet/lib/ruby/site_ruby/puppet/util/command_line.rb:143:in `run'
      /Library/GoogleCorpSupport/Puppet/lib/ruby/site_ruby/puppet/util/command_line.rb:77:in `execute'
      /Library/GoogleCorpSupport/Puppet/bin/puppet:5:in `<main>'
      Error: Could not prepare for execution: Could not create resources for managing Puppet's files and directories in sections [:main, :agent, :ssl]: Could not get group list from DirectoryService
      Could not get group list from DirectoryService
      /Library/GoogleCorpSupport/Puppet/lib/ruby/site_ruby/puppet/provider/nameservice/directoryservice.rb:101:in `rescue in list_all_present'
      /Library/GoogleCorpSupport/Puppet/lib/ruby/site_ruby/puppet/provider/nameservice/directoryservice.rb:98:in `list_all_present'
      /Library/GoogleCorpSupport/Puppet/lib/ruby/site_ruby/puppet/provider/nameservice/directoryservice.rb:151:in `single_report'
      /Library/GoogleCorpSupport/Puppet/lib/ruby/site_ruby/puppet/provider/nameservice/directoryservice.rb:504:in `getinfo'
      /Library/GoogleCorpSupport/Puppet/lib/ruby/site_ruby/puppet/provider/nameservice.rb:192:in `exists?'
      /Library/GoogleCorpSupport/Puppet/lib/ruby/site_ruby/puppet/type/group.rb:234:in `exists?'
      /Library/GoogleCorpSupport/Puppet/lib/ruby/site_ruby/puppet/settings.rb:888:in `service_group_available?'
      /Library/GoogleCorpSupport/Puppet/lib/ruby/site_ruby/puppet/settings/file_setting.rb:52:in `safe_to_use_settings_value?'
      /Library/GoogleCorpSupport/Puppet/lib/ruby/site_ruby/puppet/settings/file_setting.rb:43:in `value'
      /Library/GoogleCorpSupport/Puppet/lib/ruby/site_ruby/puppet/settings/file_setting.rb:95:in `group'
      /Library/GoogleCorpSupport/Puppet/lib/ruby/site_ruby/puppet/settings/file_setting.rb:157:in `to_resource'
      /Library/GoogleCorpSupport/Puppet/lib/ruby/site_ruby/puppet/settings.rb:1052:in `block in to_catalog'
      /Library/GoogleCorpSupport/Puppet/lib/ruby/site_ruby/puppet/settings.rb:1048:in `each'
      /Library/GoogleCorpSupport/Puppet/lib/ruby/site_ruby/puppet/settings.rb:1048:in `to_catalog'
      /Library/GoogleCorpSupport/Puppet/lib/ruby/site_ruby/puppet/settings.rb:1123:in `use'
      /Library/GoogleCorpSupport/Puppet/lib/ruby/site_ruby/puppet/application/apply.rb:310:in `setup'
      /Library/GoogleCorpSupport/Puppet/lib/ruby/site_ruby/puppet/application.rb:413:in `block in run'
      /Library/GoogleCorpSupport/Puppet/lib/ruby/site_ruby/puppet/util.rb:744:in `exit_on_fail'
      /Library/GoogleCorpSupport/Puppet/lib/ruby/site_ruby/puppet/application.rb:413:in `run'
      /Library/GoogleCorpSupport/Puppet/lib/ruby/site_ruby/puppet/util/command_line.rb:143:in `run'
      /Library/GoogleCorpSupport/Puppet/lib/ruby/site_ruby/puppet/util/command_line.rb:77:in `execute'
      /Library/GoogleCorpSupport/Puppet/bin/puppet:5:in `<main>'
      

      Attachments

        Activity

          People

            tony.vu Tony Vu
            ccaviness Clay Caviness
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Zendesk Support