Issue #7680 has been updated by Adrien Thebo.

Status changed from In Topic Branch Pending Review to Code Insufficient

I've done some investigating and I believe that the tmpfile on disk is not 
being written with the content of the sourced symlink. Admittedly this is a 
complex bug, but the resolution would be ensuring that the right content was 
being copied to the tmpfile and that the checksum was compared with the right 
source file.

I've looked at the attached files and it's not clear how this change works or 
how it fixes the problems. I applied this patch to test the actual behavior 
change:

<pre>
>From baf159deab87a3f3b80f5359c7f569f1edcb2ca4 Mon Sep 17 00:00:00 2001
From: Adrien Thebo <[email protected]>
Date: Fri, 15 Feb 2013 15:27:17 -0800
Subject: [PATCH] re-enable file symlink test

---
 spec/integration/type/file_spec.rb | 1 -
 1 file changed, 1 deletion(-)

diff --git a/spec/integration/type/file_spec.rb 
b/spec/integration/type/file_spec.rb
index 3fce598..107f1a8 100755
--- a/spec/integration/type/file_spec.rb
+++ b/spec/integration/type/file_spec.rb
@@ -327,7 +327,6 @@ describe Puppet::Type.type(:file) do
             let(:target) { tmpfile('file_target') }
 
             it "should create the file, not a symlink (#2817, #10315)" do
-              pending "bug #2817, #10315"
 
               catalog.add_resource described_class.new(:path => path, :source 
=> link, :mode => 0600, :links => :follow)
               catalog.apply
-- 
1.8.0.2

</pre>

This fails, indicating that this patch doesn't actually fix the problem, and 
produces the following:

<pre>
bundle exec rspec spec/integration/type/file_spec.rb -e "when following links 
to a file should create the file"  
Run options:
  include {:full_description=>/when\ following\ links\ to\ a\ file\ should\ 
create\ the\ file/}
  exclude {:broken=>true}
F

Failures:

  1) Puppet::Type::File when setting permissions when setting mode for links 
when following links to a file should create the file, not a symlink (#2817, 
#10315)
     Failure/Error: File.should be_file(path)
       expected 
file?("/var/folders/53/57p0cvmx07v8z_vlxq8fmkpm0000gp/T/rspecrun20130215-6549-dbxz66/file_spec20130215-6549-2sfnfv/file_testing")
 to return true, got false
     # ./spec/integration/type/file_spec.rb:334:in `block (7 levels) in <top 
(required)>'

Finished in 0.12302 seconds
1 example, 1 failure

Failed examples:

rspec ./spec/integration/type/file_spec.rb:329 # Puppet::Type::File when 
setting permissions when setting mode for links when following links to a file 
should create the file, not a symlink (#2817, #10315)
</pre>

Since this patch doesn't resolve the bug I'm going to go ahead and close this 
pull request for the time being.
----------------------------------------
Bug #7680: Checksum missmatch when copying followed symlinks
https://projects.puppetlabs.com/issues/7680#change-83361

Author: Mikael Svantesson
Status: Code Insufficient
Priority: Normal
Assignee: 
Category: file
Target version: 
Affected Puppet version: 2.6.8
Keywords: symlink file
Branch: https://github.com/puppetlabs/puppet/pull/1476


When trying to copy a file (using a symlink), Puppet does not calculate the 
correct checksum for the temporary file.

This work in 2.6.7, I have not tried 2.7.x.

**Error:**
    err: /Stage[pre]/Sudo/File[/etc/sudoers]/ensure: change from absent to 
present failed: Could not rename temporary file /etc/sudoers.puppettmp_4293 to 
/etc/sudoers:
    File written to disk did not match checksum; discarding changes ( vs 
{md5}d41d8cd98f00b204e9800998ecf8427e) at 
/etc/puppet/modules/sudo/manifests/init.pp:12 at 
/etc/puppet/modules/sudo/manifests/init.pp:12

**Manifest:**
    class sudo {
      package { 'sudo': ensure => installed }
    
      file { '/etc/sudoers':
        ensure  => file,
        source  => ["puppet:///modules/sudo/sudoers-${hostname}", 
'puppet:///modules/sudo/sudoers'],
        links   => follow,
        replace => true,
        owner   => 'root',
        group   => 'root',
        mode    => '0440',
      }
    }

**File structure:**
    modules/sudo/files
    |-- sudoers
    |-- sudoers-host1
    `-- sudoers-host2 -> sudoers-host1




-- 
You have received this notification because you have either subscribed to it, 
or are involved in it.
To change your notification preferences, please click here: 
http://projects.puppetlabs.com/my/account

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Bugs" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/puppet-bugs?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to