From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 18043 invoked by alias); 2 Dec 2011 17:20:04 -0000 Received: (qmail 17981 invoked by uid 22791); 2 Dec 2011 17:20:02 -0000 X-SWARE-Spam-Status: No, hits=-1.7 required=5.0 tests=AWL,BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW X-Spam-Check-By: sourceware.org Received: from mail-ww0-f45.google.com (HELO mail-ww0-f45.google.com) (74.125.82.45) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Fri, 02 Dec 2011 17:19:48 +0000 Received: by wgbds13 with SMTP id ds13so1212378wgb.2 for ; Fri, 02 Dec 2011 09:19:46 -0800 (PST) MIME-Version: 1.0 Received: by 10.216.172.205 with SMTP id t55mr1587125wel.109.1322846386885; Fri, 02 Dec 2011 09:19:46 -0800 (PST) Received: by 10.216.21.196 with HTTP; Fri, 2 Dec 2011 09:19:46 -0800 (PST) In-Reply-To: <32903475.post@talk.nabble.com> References: <32903475.post@talk.nabble.com> Date: Fri, 02 Dec 2011 17:20:00 -0000 Message-ID: Subject: Re: Redirecting output from running proc doesn't modify the "last modified time" field for target file From: Jon Clugston To: cygwin@cygwin.com Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-IsSubscribed: yes Mailing-List: contact cygwin-help@cygwin.com; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner@cygwin.com Mail-Followup-To: cygwin@cygwin.com X-SW-Source: 2011-12/txt/msg00024.txt.bz2 On Fri, Dec 2, 2011 at 11:51 AM, ajshower wrote: > > I've got a bash script running in Cygwin whose output has been redirected= to > another file. =A0MS-DOS exhibits this same behavior if I run the bash scr= ipt > as a batch job. > > =A0 =A0bash.exe &> log.txt > > Adding content to log.txt through redirection does not change log.txt's l= ast > modified time while bash.exe is executing. > > Baseline: > =A0 =A0# ls -la --full-time log.txt > =A0 =A0-r-xr-x---+ 1 user Domain Users 66455 2011-11-30 16:16:45.246664800 > -0500 log.txt > > Some time later: > =A0 =A0# ls -la --full-time log.txt > =A0 =A0-r-xr-x---+ 1 user Domain Users 66838 2011-11-30 16:16:45.246664800 > -0500 log.txt > > Note that even though log.txt has gotten larger, the last modified time h= as > not changed. =A0The last modified time is updated only when bash.exe > terminates. > > Ubuntu 11.04 handles this scenario, IMO, correctly. =A0Is there a way I c= an > get the last modified time to be updated when the content of the file > changes and while bash.exe is executing? > > Cygwin: =A0CYGWIN_NT-6.1 > MS-DOS: =A0Microsoft Windows [Version 6.1.7601] > I don't see how this could be a Cygwin issue. If writing to a file (while it is open) doesn't immediately update the last modified time on Windows, there is no reasonable way for Cygwin to "fix" that. IMHO, this is a very dubious "feature" to depend upon. If you want to know if the file has changed, why not check its length instead? Jon -- Problem reports: http://cygwin.com/problems.html FAQ: http://cygwin.com/faq/ Documentation: http://cygwin.com/docs.html Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple