voxpupuli/puppet-archive

Issue On AIX when archive file between File systems

Closed this issue · 1 comments

Affected Puppet, Ruby, OS and module versions/distributions

Found a wired issue on an AIX platform. When the archive moved across file systems getting utime error. See below details

  • Puppet:

/opt/puppetlabs/bin/puppet apply --modulepath=/tmp/development -e 'archive {"/etc/hosts": path => "/opt/hosts",source=>"/etc/hosts"}'

Error message:

Error: Could not set 'present' on ensure: Invalid argument @ utime_internal - /opt/hosts at 1:

Error: Could not set 'present' on ensure: Invalid argument @ utime_internal - /opt/hosts at 1:

Wrapped exception:

Invalid argument @ utime_internal - /opt/hosts

Error: /Stage[main]/Main/Archive[/etc/hosts]/ensure: change from absent to present failed: Could not set 'present' on ensure: Invalid argument @ utime_internal - /opt/hosts at 1:

Same above code with small change:
When copying files with in /tmp it works. Since Archive module copy the source to /tmp and them mv the file to destination. When this ahppen with the filesystem it works.

/opt/puppetlabs/bin/puppet apply --modulepath=/tmp/development -e 'archive {"/etc/hosts": path => "/tmp/hosts",source=>"/etc/hosts"}'

  • Ruby:

#!/opt/puppetlabs/puppet/bin/ruby
require 'fileutils'
FileUtils.mv('/tmp/hosts', '/opt/hosts')

/opt/puppetlabs/puppet/lib/ruby/2.1.0/fileutils.rb:1411:in utime': Invalid argument @ utime_internal - /opt/hosts (Errno::EINVAL) from /opt/puppetlabs/puppet/lib/ruby/2.1.0/fileutils.rb:1411:in copy_metadata'
from /opt/puppetlabs/puppet/lib/ruby/2.1.0/fileutils.rb:472:in block in copy_entry' from /opt/puppetlabs/puppet/lib/ruby/2.1.0/fileutils.rb:1512:in call'
from /opt/puppetlabs/puppet/lib/ruby/2.1.0/fileutils.rb:1512:in wrap_traverse' from /opt/puppetlabs/puppet/lib/ruby/2.1.0/fileutils.rb:466:in copy_entry'
from /opt/puppetlabs/puppet/lib/ruby/2.1.0/fileutils.rb:527:in rescue in block in mv' from /opt/puppetlabs/puppet/lib/ruby/2.1.0/fileutils.rb:524:in block in mv'
from /opt/puppetlabs/puppet/lib/ruby/2.1.0/fileutils.rb:1579:in block in fu_each_src_dest' from /opt/puppetlabs/puppet/lib/ruby/2.1.0/fileutils.rb:1595:in fu_each_src_dest0'
from /opt/puppetlabs/puppet/lib/ruby/2.1.0/fileutils.rb:1577:in fu_each_src_dest' from /opt/puppetlabs/puppet/lib/ruby/2.1.0/fileutils.rb:514:in mv'
from /tmp/test.rb:3:in `

'

  • Distribution:
    Puppet Enterprise: 2016 (Puppet version V4.7.0)
  • Module version: puppet-archive 1.3.0

How to reproduce (e.g Puppet code you use)

See issue description

What are you seeing

Note Sure the issue is with ruby or with OS. When run with truss notices that ruby use utimenat system call that fails.
So created a test C code to simulate the issue. The code works on Linux not on AIX. Can some one check they also have similar issue.
#include <stdio.h>
#include <sys/time.h>
main(){
struct timespec tm[2];
tm[0].tv_sec = 1544218804;
tm[0].tv_nsec = 7766;
tm[1].tv_sec = 1544218804;
tm[1].tv_nsec = 7766;
struct timespec ts[2];
struct timespec times[2] = {{.tv_sec = 1544218804, .tv_nsec = 456},
{.tv_sec = 1544218804, .tv_nsec = 567}};
int i;
i = utimensat(-2, "/opt/test/hosts", times, 0);
fprintf(stdout,"Retrun code %d\n",i);

}

What behaviour did you expect instead

The issue could be AIX. I tested the C code on AIX 7 and AIX 6 both behave same symptom. Tested the ruby/puppet code in AIX 7 only. Can some ruby/C expert see the bug is with ruby or with AIX.

Output log

Any additional information you'd like to impart

You can ignore the issue. The root cause of the issue is with ControlMinder CA product software which wrongly trap the system call.