X-Recipient: archive-cygwin AT delorie DOT com 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 MIME-Version: 1.0 In-Reply-To: <32903475.post@talk.nabble.com> References: <32903475 DOT post AT talk DOT nabble DOT com> Date: Fri, 2 Dec 2011 12:19:46 -0500 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 AT cygwin DOT com Content-Type: text/plain; charset=ISO-8859-1 X-IsSubscribed: yes Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from quoted-printable to 8bit by delorie.com id pB2HKB0f010030 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.  MS-DOS exhibits this same behavior if I run the bash script > as a batch job. > >    bash.exe &> log.txt > > Adding content to log.txt through redirection does not change log.txt's last > modified time while bash.exe is executing. > > Baseline: >    # ls -la --full-time log.txt >    -r-xr-x---+ 1 user Domain Users 66455 2011-11-30 16:16:45.246664800 > -0500 log.txt > > Some time later: >    # ls -la --full-time log.txt >    -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 has > not changed.  The last modified time is updated only when bash.exe > terminates. > > Ubuntu 11.04 handles this scenario, IMO, correctly.  Is there a way I can > get the last modified time to be updated when the content of the file > changes and while bash.exe is executing? > > Cygwin:  CYGWIN_NT-6.1 > MS-DOS:  Microsoft 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