[PUP-3008] Already initialized constant warning when running puppet Created: 2014/08/04  Updated: 2016/10/19  Resolved: 2014/08/20

Status: Closed
Project: Puppet
Component/s: None
Affects Version/s: PUP 3.6.2
Fix Version/s: PUP 3.7.0

Type: Bug Priority: Normal
Reporter: Josh Cooper Assignee: Rob Reynolds
Resolution: Fixed Votes: 0
Labels: windows
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Relates
relates to PUP-2396 Support ruby 2.0 x64 on windows Closed
relates to PUP-3126 Update win32-service gem to 0.8.6+ Closed
Template:
Epic Link: Windows ruby x64
Story Points: 2
Sprint: 2014-08-20
QA Contact: Eric Thompson

 Description   

C:\Windows\system32>puppet agent -t
C:/Program Files (x86)/Puppet Labs/Puppet/sys/ruby/lib/ruby/gems/1.9.1/gems/win32-eventlog-0.6.1/lib/win32/windows/constants.rb:26: warning: already initialized constant ERROR_INSUFFICIENT_BUFFER
C:/Program Files (x86)/Puppet Labs/Puppet/sys/ruby/lib/ruby/gems/1.9.1/gems/win32-eventlog-0.6.1/lib/win32/windows/constants.rb:31: warning: already initialized constant INFINITE
C:/Program Files (x86)/Puppet Labs/Puppet/sys/ruby/lib/ruby/gems/1.9.1/gems/win32-eventlog-0.6.1/lib/win32/windows/constants.rb:32: warning: already initialized constant WAIT_FAILED
C:/Program Files (x86)/Puppet Labs/Puppet/sys/ruby/lib/ruby/gems/1.9.1/gems/win32-eventlog-0.6.1/lib/win32/windows/constants.rb:52: warning: already initialized constant FORMAT_MESSAGE_IGNORE_INSERTS

The issue is that these constants are defined in multiple win32 gems, but are not namespaced to avoid collisions.



 Comments   
Comment by Josh Cooper [ 2014/08/04 ]

C:\work\puppet-win32-ruby [1.9.3-x86]> git grep ERROR_INSUFFICIENT_BUFFER
ruby/lib/ruby/gems/1.9.1/gems/win32-eventlog-0.6.1/lib/win32/windows/constants.rb:    ERROR_INSUFFICIENT_BUFFER = 122
ruby/lib/ruby/gems/1.9.1/gems/win32-service-0.8.5/lib/win32/windows/constants.rb:    ERROR_INSUFFICIENT_BUFFER = 122

C:\work\puppet-win32-ruby [1.9.3-x86]> git grep INFINITE
ruby/lib/ruby/gems/1.9.1/gems/win32-eventlog-0.6.1/lib/win32/windows/constants.rb:    INFINITE    = 0xFFFFFFFF
ruby/lib/ruby/gems/1.9.1/gems/win32-process-0.7.4/lib/win32/process/constants.rb:  INFINITE = 0xFFFFFFFF
ruby/lib/ruby/gems/1.9.1/gems/win32-service-0.8.5/lib/win32/windows/constants.rb:    INFINITE = 0xFFFFFFFF

C:\work\puppet-win32-ruby [1.9.3-x86]> git grep WAIT_FAILED
ruby/lib/ruby/gems/1.9.1/gems/win32-eventlog-0.6.1/lib/win32/windows/constants.rb:    WAIT_FAILED = 0xFFFFFFFF
ruby/lib/ruby/gems/1.9.1/gems/win32-service-0.8.5/lib/win32/windows/constants.rb:    WAIT_FAILED = 0xFFFFFFFF

C:\work\puppet-win32-ruby [1.9.3-x86]> git grep FORMAT_MESSAGE_IGNORE_INSERTS
ruby/lib/ruby/gems/1.9.1/gems/win32-eventlog-0.6.1/lib/win32/windows/constants.rb:    FORMAT_MESSAGE_IGNORE_INSERTS = ...
ruby/lib/ruby/gems/1.9.1/gems/win32-service-0.8.5/lib/win32/windows/constants.rb:    FORMAT_MESSAGE_IGNORE_INSERTS = ...

Comment by Michael Smith [ 2014/08/15 ]

puppet-win32-ruby:1.9.3-x86

Comment by Michael Smith [ 2014/08/15 ]

Response from djberg96: "I should probably rename the modules. Sloppy of me."

I'll continue working to get the issue resolved in his gems. Having a resolution to that should be addressed prior to functional review.

Comment by Josh Cooper [ 2014/08/19 ]

2.0.0-x64, before change:

C:\work\puppet [master +12 ~0 -0 !]> .\ext\envpuppet puppet agent -t
c:/work/puppet-win32-ruby/ruby/lib/ruby/gems/2.0.0/gems/win32-eventlog-0.6.1/lib/win32/windows/constants.rb:26: warning: already initialized constant Windows::Constants::ERROR_INSUFFICIENT_BUFFER
c:/work/puppet-win32-ruby/ruby/lib/ruby/gems/2.0.0/gems/win32-service-0.8.5/lib/win32/windows/constants.rb:136: warning: previous definition of ERROR_INSUFFICIENT_BUFFER was here
c:/work/puppet-win32-ruby/ruby/lib/ruby/gems/2.0.0/gems/win32-eventlog-0.6.1/lib/win32/windows/constants.rb:31: warning: already initialized constant Windows::Constants::INFINITE
c:/work/puppet-win32-ruby/ruby/lib/ruby/gems/2.0.0/gems/win32-service-0.8.5/lib/win32/windows/constants.rb:120: warning: previous definition of INFINITE was here
c:/work/puppet-win32-ruby/ruby/lib/ruby/gems/2.0.0/gems/win32-eventlog-0.6.1/lib/win32/windows/constants.rb:32: warning: already initialized constant Windows::Constants::WAIT_FAILED
c:/work/puppet-win32-ruby/ruby/lib/ruby/gems/2.0.0/gems/win32-service-0.8.5/lib/win32/windows/constants.rb:141: warning: previous definition of WAIT_FAILED was here
c:/work/puppet-win32-ruby/ruby/lib/ruby/gems/2.0.0/gems/win32-eventlog-0.6.1/lib/win32/windows/constants.rb:52: warning: already initialized constant Windows::Constants::FORMAT_MESSAGE_IGNORE_INSERTS
c:/work/puppet-win32-ruby/ruby/lib/ruby/gems/2.0.0/gems/win32-service-0.8.5/lib/win32/windows/constants.rb:126: warning: previous definition of FORMAT_MESSAGE_IGNORE_INSERTS was here

2.0.0-x64, with change, merged in 18eaa515

C:\work\puppet [master +12 ~0 -0 !]> .\ext\envpuppet puppet agent -t
Info: Retrieving pluginfacts

1.9.3-x86, before change:

C:\work\puppet [master +12 ~0 -0 !]> .\ext\envpuppet puppet agent -t
c:/work/puppet-win32-ruby/ruby/lib/ruby/gems/1.9.1/gems/win32-eventlog-0.6.1/lib/win32/windows/constants.rb:26: warning: already initialized constant ERROR_INSUFFICIENT_BUFFER
c:/work/puppet-win32-ruby/ruby/lib/ruby/gems/1.9.1/gems/win32-eventlog-0.6.1/lib/win32/windows/constants.rb:31: warning: already initialized constant INFINITE
c:/work/puppet-win32-ruby/ruby/lib/ruby/gems/1.9.1/gems/win32-eventlog-0.6.1/lib/win32/windows/constants.rb:32: warning: already initialized constant WAIT_FAILED
c:/work/puppet-win32-ruby/ruby/lib/ruby/gems/1.9.1/gems/win32-eventlog-0.6.1/lib/win32/windows/constants.rb:52: warning: already initialized constant FORMAT_MESSAGE_IGNORE_INSERTS

1.9.3-x86, with change, merged in 7329dd9a

C:\work\puppet [master +12 ~0 -0 !]> .\ext\envpuppet puppet agent -t
Info: Retrieving pluginfacts

Comment by Josh Cooper [ 2014/08/19 ]

For review:

  1. install puppet x86 from: http://jenkins-release.delivery.puppetlabs.net/view/Windows%20Builds/job/Windows%20On%20Demand/8/ARCH=x86,label=win-build/artifact/pkg/puppet-3.6.2-1040-g58401f3.msi
  2. Run puppet agent -t and verify there are no already initialized constant messages.
  3. Repeat with puppet x64 from: http://jenkins-release.delivery.puppetlabs.net/view/Windows%20Builds/job/Windows%20On%20Demand/ARCH=x64,label=win-build/8/artifact/pkg/puppet-3.6.2-1040-g58401f3-x64.msi
Comment by Rob Reynolds [ 2014/08/20 ]

x86 passed review:

C:\>where puppet
C:\Program Files (x86)\Puppet Labs\Puppet\bin\puppet.bat
 
C:\>puppet apply -e "user {'Administrator':ensure=>present,}"
Notice: Compiled catalog for win2008r2x64 in environment production in 0.30 seconds
Notice: Finished catalog run in 0.05 seconds

x64 passed review

C:\>where puppet
C:\Program Files\Puppet Labs\Puppet\bin\puppet.bat
 
C:\>puppet apply -e "user {'Administrator':ensure=>present,}"
Notice: Compiled catalog for win2008r2x64 in environment production in 0.34 seconds
Notice: Finished catalog run in 0.14 seconds

Generated at Mon Nov 19 12:22:49 PST 2018 using JIRA 7.7.1#77002-sha1:e75ca93d5574d9409c0630b81c894d9065296414.