From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Parkin Frank - fparki Newsgroups: gmane.os.tru64.managers Subject: SUMMARY: Bug in find command - tru64 v5.1a??? Date: Thu, 07 Aug 2003 13:21:21 +0100 Sender: tru64-unix-managers-owner@ornl.gov Message-ID: NNTP-Posting-Host: deer.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 X-Trace: main.gmane.org 1060258669 31349 80.91.224.253 (7 Aug 2003 12:17:49 GMT) X-Complaints-To: usenet@main.gmane.org NNTP-Posting-Date: Thu, 7 Aug 2003 12:17:49 +0000 (UTC) Original-X-From: tru64-unix-managers-owner-gotm-tru64-unix-managers=m.gmane.org@sws1.ctd.ornl.gov Thu Aug 07 14:18:12 2003 Return-path: Original-Received: from sws1.ornl.gov ([160.91.1.101]) by deer.gmane.org with smtp (Exim 3.35 #1 (Debian)) id 19kjie-0005Yb-00 for ; Thu, 07 Aug 2003 14:18:12 +0200 Original-Received: (qmail 30981 invoked by uid 5); 7 Aug 2003 12:18:03 -0000 Original-Followup-To: poster Precedence: bulk Original-Received: (qmail 30972 invoked by uid 49493); 7 Aug 2003 12:18:02 -0000 Original-Received: from fparki@acxiom.co.uk by sws1 by uid 49491 with qmail-scanner-1.16 (clamscan: 20030605. spamassassin: 2.55. Clear:SA:0(0.0/5.0):. Processed in 0.450758 secs); 07 Aug 2003 12:18:02 -0000 Original-Received: from unknown (HELO emroute1.cind.ornl.gov) (160.91.4.119) by 0 with SMTP; 7 Aug 2003 12:18:02 -0000 Original-Received: from emroute1.cind.ornl.gov (localhost [127.0.0.1]) by emroute1.cind.ornl.gov (PMDF V6.2 #30669) with ESMTP id <0HJ900HCJ0TX9X@emroute1.cind.ornl.gov> for tru64-unix-managers@sws1.ctd.ornl.gov (ORCPT tru64-unix-managers@ornl.gov) ; Thu, 07 Aug 2003 08:18:01 -0400 (EDT) Original-Received: from aerynsun.acxiom.com (aerynsun.acxiom.com [198.160.100.121]) by emroute1.cind.ornl.gov (PMDF V6.2 #30669) with ESMTP id <0HJ900CHD0TWN0@emroute1.cind.ornl.gov> for tru64-unix-managers@sws1.ctd.ornl.gov (ORCPT tru64-unix-managers@ornl.gov) ; Thu, 07 Aug 2003 08:17:56 -0400 (EDT) Original-Received: from relay.conway.acxiom.com (unverified) by aerynsun.acxiom.com (Content Technologies SMTPRS 4.3.10) with ESMTP id for ; Thu, 07 Aug 2003 07:17:50 -0500 Original-Received: from srvlon20.uk.acxiom.com (unverified [10.150.100.51]) by relay.conway.acxiom.com (Content Technologies SMTPRS 4.3.10) with ESMTP id for ; Thu, 07 Aug 2003 07:17:49 -0500 Original-Received: by srvlon20.uk.acxiom.com with Internet Mail Service (5.5.2653.19) id ; Thu, 07 Aug 2003 13:10:24 +0100 Content-return: allowed Original-To: "'tru64-unix-managers@ornl.gov'" X-Mailer: Internet Mail Service (5.5.2653.19) Xref: main.gmane.org gmane.os.tru64.managers:5058 X-Report-Spam: http://spam.gmane.org/gmane.os.tru64.managers:5058 Thanks go to Nikola Milutinovic and Joerg Bruehe. Special thanks to Tim Cutts with this excellent response... If you've created the file before, and it already exists, then creat() truncates it rather than creating a new file. This means that the atime() does not change. Consider the following program: #include #include #include #include #include int main(void) { int fd; struct stat s; fd = open("testfile", O_CREAT | O_WRONLY | O_TRUNC, 0644); if (fd == -1) { perror("Could not create file"); return 1; } if (fstat(fd, &s) != 0) { perror("Could not fstat descriptor"); return 1; } if (write(fd, "some data\n", sizeof("some data\n")) == -1) { perror("Could not write to file"); return 1; } printf("atime: %d\nctime: %d\nmtime: %d\n\n", s.st_atime, s.st_ctime, s.st_mtime); close(fd); return 0; } This program creates a file, writes some data to it, and then reports the atime ctime and mtime values. The first time it's run, it produced the following output: ecs2f:/nfs/acari/tjrc$ ./t atime: 1060257520 ctime: 1060257520 mtime: 1060257520 all three the same. Fine. Now, if I run the program again a few seconds later: ecs2f:/nfs/acari/tjrc$ ./t atime: 1060257520 ctime: 1060257573 mtime: 1060257573 Aha! The ctime and mtime have changed, but atime has not! So, if this file you have is being created with creat() or with an open() O_TRUNC flag as above, the file is not actually created anew, and the atime on the inode does not change. You need to actually unlink() the file between invocations of the program for the atime to be updated. -----Original Message----- From: Parkin Frank - fparki Sent: 07 August 2003 12:28 To: 'tru64-unix-managers@ornl.gov' Subject: Bug in find command - tru64 v5.1a??? We use a find command in an automated process to delete files. find . -atime +7 -exec rm -ef {} ;\ The command has worked perfectly for several months. However, last night it deleted 6 files that were in the process of being written. Is this correct behaviour? Thanks Frank ********************************************************************** The information contained in this communication is confidential, is intended only for the use of the recipient named above, and may be legally privileged. If the reader of this message is not the intended recipient, you are hereby notified that any dissemination, distribution, or copying of this communication is strictly prohibited. If you have received this communication in error, please re-send this communication to the sender and delete the original message or any copy of it from your computer system. Thank You.