X-Recipient: archive-cygwin@delorie.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.post@talk.nabble.com> <32904332.post@talk.nabble.com> Date: Fri, 2 Dec 2011 13:50:29 -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@cygwin.com Content-Type: text/plain; charset=ISO-8859-1 X-IsSubscribed: yes Mailing-List: contact cygwin-help@cygwin.com; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner@cygwin.com Mail-Followup-To: cygwin@cygwin.com Delivered-To: mailing list cygwin@cygwin.com Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from quoted-printable to 8bit by delorie.com id pB2Iomh6014976 On Fri, Dec 2, 2011 at 1:42 PM, ajshower 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