Issue #7680 has been updated by Chris Boot.

Because this bug appears to be going nowhere, I thought I would add a few test 
cases to very simply trigger this bug:

First, some setup:

`crb@chris ~ $ echo testing > testfile
crb@chris ~ $ ln -s testfile testlink`

First test, to create a file that doesn't exist:

`crb@chris ~ $ puppet resource file $(pwd)/newfile ensure=file links=follow 
source=$(pwd)/testlink mode=0644
err: /File[/home/crb/newfile]/ensure: change from absent to present failed: 
Could not rename temporary file /home/crb/newfile.puppettmp_6080 to 
/home/crb/newfile: File written to disk did not match checksum; discarding 
changes ( vs {md5}d41d8cd98f00b204e9800998ecf8427e)
file { '/home/crb/newfile':
  ensure => 'absent',
}`

As you can see, the file is not created and Puppet produces an error.

Second test, to update the contents of the file if it exists with the
wrong content:

`crb@chris ~ $ echo foobar > newfile
crb@chris ~ $ puppet resource file $(pwd)/newfile ensure=file links=follow 
source=$(pwd)/testlink mode=0644
file { '/home/crb/newfile':
  ensure => 'file',
  group  => '1000',
  mode   => '644',
}
crb@chris ~ $ cat newfile
foobar`

This time, Puppet does not produce an error at all, but the contents of
the file remains unchanged and un-managed. In this case, this is silent
corruption as Puppet fails to enforce the content change on the file.

The patch in #6 fixes both of the test cases above.

Best regards,
Chris
----------------------------------------
Bug #7680: Checksum missmatch when copying followed symlinks
https://projects.puppetlabs.com/issues/7680#change-84677

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