Issue #2521 has been updated by Daniel Pittman.

Kjetil Torgrim Homme wrote:
> Daniel Pittman wrote:
> > This ticket should be rejected: mtime reflects the time of changes to the 
> > content of the file, which rename is not.  The fact that only ctime changes 
> > is, in fact, courtesy the kernel, not Ruby, which would have to do strange, 
> > non-POSIX things to modify that behaviour.
> 
> rename(2) doesn't change ctime of the file, but it affects ctime and mtime 
> for the parent directory.  utime(2) is part of POSIX, it's not a strange, 
> non-POSIX things to do.  it should not be necessary, though.

ctime of the file and mtime of the directory, on Linux 2.6.32; this is 
explicitly an "implementation" behaviour.  The parent directory is required to 
be updated by POSIX.  Thank you for forcing clarification of that.

Meanwhile, indeed, hitting the renamed file with utime is odd – and Ruby 1.8.7 
is definitely not doing anything crazy; it just issues a rename syscall as 
expected.

> > I don't understand the root cause of the problem, but I certainly think we 
> > are better off tracking that down and understanding it, not just papering 
> > over it by adding non-POSIX semantics to file manipulation in puppet.
> 
> I wouldn't call it non-POSIX semantics, but clearly the daemon in question is 
> making assumptions which do not hold in all POSIX systems.  it would be nice 
> if Volcane could identify the errant daemon more accurately so we could 
> investigate the root cause.

Since the request was for mtime, and POSIX is silent about the topic of any 
platform updating mtime on change (plus, it not being the semantics of the 
field), I would call the request for non-POSIX semantics.

Anyway, I don't think trying to work around every poorly coded daemon is a long 
term winner, and still want this rejected.
----------------------------------------
Bug #2521: file{} should update all timestamps when renaming files from temp 
file.
https://projects.puppetlabs.com/issues/2521

Author: R.I. Pienaar
Status: Accepted
Priority: Normal
Assignee: 
Category: file
Target version: 
Affected Puppet version: 0.24.8
Keywords: 
Branch: 


At present puppet writes new files made with the file resource type using a 
temp file then renames the temp file.  Ruby rename only updates change time not 
mtime.

This is a problem when interacting with daemons that monitor directories for 
new files, like /etc/cron.d:

1) puppet creates /etc/cron.d/foo.zxxx
2) crond checks for new files matching its rules, the temp file does not match 
does not get noticed, crond saves last checked timestamp
3) puppet renames /etc/cron.d/foo.zxxx -> /etc/cron.d/foo and only ctime gets 
updated not mtime
4) crond checks for new files since last check, finds none.

I think puppet should probably touch both mtime and ctime after renaming a file.


-- 
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 post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/puppet-bugs?hl=en.

Reply via email to