delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2011/12/02/13:50:52

X-Recipient: archive-cygwin AT delorie DOT com
X-SWARE-Spam-Status: No, hits=-1.8 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: <32904332.post@talk.nabble.com>
References: <32903475 DOT post AT talk DOT nabble DOT com> <CAG_2cTn_1UHZy-13ACu-EPMaUSSSOr38s1_Rc0ccmdS2JDyJSQ AT mail DOT gmail DOT com> <32904332 DOT post AT talk DOT nabble DOT com>
Date: Fri, 2 Dec 2011 13:50:29 -0500
Message-ID: <CAG_2cTm+VQcNuRmDTFEheEyuOAeWA4tCW5+whH74E6D4UkAFAg@mail.gmail.com>
Subject: Re: Redirecting output from running proc doesn't modify the "last modified time" field for target file
From: Jon Clugston <jon DOT clugston AT gmail DOT com>
To: cygwin AT cygwin DOT com
X-IsSubscribed: yes
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Unsubscribe: <mailto:cygwin-unsubscribe-archive-cygwin=delorie DOT com AT cygwin DOT com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com
X-MIME-Autoconverted: from quoted-printable to 8bit by delorie.com id pB2Iomh6014976

On Fri, Dec 2, 2011 at 1:42 PM, ajshower <ajshower AT gmail DOT com> wrote:
>
>>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?
>
> I have switched to using the length instead but I was interested in what
> people thought of the issue.
>
> I'm having trouble reproducing this using just Cygwin so I'm not presenting
> the problem accurately.  My process is to call  Runtime.getRuntime.exec()
> within a java process which opens cygwin/bin/bash.exe and then runs the
> redirection command from within the bash.  From the same java process that
> called exec(), I'm trying to monitor the last modified time based on what's
> going on in the previously called bash.exe.  That does sound pretty
> convoluted.  I guess it's some kind of scope problem, but checking length()
> is working, so it's all moot anyway.
>

I reproduced your symptoms with this simple shell script:

while sleep 10 ; do
  echo
done >x.log &

While this loop is running, the timestamp on "x.log" doesn't change
(whereas on Linux it changes every 10 seconds).  It sure looks to me
that Windows just doesn't bother updating the file timestamp while it
is open.  I don't know if this update is required by POSIX - I would
doubt that it is.


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


- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019