Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > gnu.bash.bug > #15099

Re: file access time and file modification time

Path csiph.com!xmission!news.snarked.org!news.linkpendium.com!news.linkpendium.com!panix!usenet.stanford.edu!not-for-mail
From "" <kfm@plushkava.net>
Newsgroups gnu.bash.bug
Subject Re: file access time and file modification time
Date Tue, 9 Jul 2019 17:12:04 +0100
Lines 42
Approved bug-bash@gnu.org
Message-ID <mailman.661.1562688734.2688.bug-bash@gnu.org> (permalink)
References <20190708092807.02edd68a60130b89a7775425@plushkava.net> <c7525b0b-937c-48e3-92f6-c5e5734b0426@email.android.com> <20190709111616.26148014b42ea4210f634e1e@plushkava.net> <80df53ac-2861-73e4-d1cb-86bf265b5550@case.edu> <20190709171204.d1cc42a73ef2f1148556a0d5@plushkava.net>
NNTP-Posting-Host lists.gnu.org
Mime-Version 1.0
Content-Type text/plain; charset=US-ASCII
Content-Transfer-Encoding 7bit
X-Trace usenet.stanford.edu 1562688734 32145 209.51.188.17 (9 Jul 2019 16:12:14 GMT)
X-Complaints-To action@cs.stanford.edu
Cc Mischa Baars <mjbaars1977.bug-bash@cyberfiber.eu>, bug-bash@gnu.org
To chet.ramey@case.edu
Envelope-to bug-bash@gnu.org
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=plushkava.net; h=date:from:to:cc:subject:message-id:in-reply-to:references :mime-version:content-type:content-transfer-encoding; s=fm3; bh= BHaI1Rk5Byx/mE4BJI9s4IaHL4VSc1UnMpUfSMjBzE4=; b=MeIpkcPLZjNXtocy E/VhTeDV36XfPTq9X05hVuH1Csqay+6LUfxLnFrhSMS9GzQoUfpD7D/brO9O6d9t ZFiyovnzisyQ1NIgolMr6qIjiAjUmAXl1vR+G2aAxsbF24cSGGMuxKrUfr9yzbkC AeWBr3KuBblsmpkQDvNust5Zv7JWkKQbpXFF6cjyF5tVpI5XZW7pfdFth5h6jzd3 OmH2EHLddhGdYKM9jUi2dpLfOBF+xH1y+n14t1IF9XG9IKjsvJbelb+obsYW5q6K NKcQ2k5x6/tsOc/p7WCvF6gJqS4eCntOf9y0tSL4cHE8w0KU8AWk6CC3hnoUTxUz HL0/Zg==
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender :x-sasl-enc; s=fm3; bh=BHaI1Rk5Byx/mE4BJI9s4IaHL4VSc1UnMpUfSMjBz E4=; b=NMm6HuE3IXbULQT2dEXSXU/QtrgcLfeRrN1qCwm+KjOFajgJ2YZAK4wpG NBLPA8O+DPHzrwZCk482s6Zzhh0CU6gJ6ko29xZjH+BbitNjvt6qzJRD+m2Wl/Rz /3UNvt9yu0PEd3jr2Y4q0RaLc17bmiHWYBidiSGkD5IicBfOpacHYc/J8F8WtgM3 bZLUFYzCs/FJpubzozIEEcuOUMKMIYMZGi1nJuyrufHzDlNOKsn9R6lv1i5PlS8K FGVro145qF3gGl0sWet3CEDzKuKX/WTTJOhcXb3xeqCgKHJ0CQhj2X+mKYtX6dKj SW4MScWME4NmMFALiXr+TlYJTGN5w==
X-ME-Sender <xms:1rwkXUNgrknbfX_QhwruwiL_v4vZ8kHQHZc4G9mSBzzgL6Og45hWTA>
X-ME-Proxy-Cause gggruggvucftvghtrhhoucdtuddrgeduvddrgedvgddutddtucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucgogfhmphhthietlhhirghsucdlfeelmdenucfjug hrpeffhffvuffkjghfofggtgfgsehtjeertdfjtddvnecuhfhrohhmpedffdcuoehkfhhm sehplhhushhhkhgrvhgrrdhnvghtqeenucfkphepudelfedrudefkedrvddukedrudeltd enucfrrghrrghmpehmrghilhhfrhhomhepkhhfmhesphhluhhshhhkrghvrgdrnhgvthen ucevlhhushhtvghrufhiiigvpedt
X-ME-Proxy <xmx:1rwkXQxB2CaYge5_DwJVUDUJxuswCQtfNy_3IPSxuKpAtcNoVVBf9g> <xmx:1rwkXQm0FHuY28Ol_z5TGCLy4P2IyVT9siBkk6eDoAEWi2xMqTJQXQ> <xmx:1rwkXXADuIrs0pqXc4c3XrT3iC-cqDvEW89sBQJQAWMwJhacgQQDpQ> <xmx:17wkXWYtDvu-9kM7_6cdgxnzqqbua7hv4XAFkfdB3dY_ODVzn1rWcw>
In-Reply-To <80df53ac-2861-73e4-d1cb-86bf265b5550@case.edu>
X-Mailer Sylpheed 3.7.0 (GTK+ 2.24.32; x86_64-unknown-linux-gnu)
X-detected-operating-system by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic]
X-Received-From 66.111.4.25
X-BeenThere bug-bash@gnu.org
X-Mailman-Version 2.1.23
Precedence list
List-Id Bug reports for the GNU Bourne Again SHell <bug-bash.gnu.org>
List-Unsubscribe <https://lists.gnu.org/mailman/options/bug-bash>, <mailto:bug-bash-request@gnu.org?subject=unsubscribe>
List-Archive <https://lists.gnu.org/archive/html/bug-bash>
List-Post <mailto:bug-bash@gnu.org>
List-Help <mailto:bug-bash-request@gnu.org?subject=help>
List-Subscribe <https://lists.gnu.org/mailman/listinfo/bug-bash>, <mailto:bug-bash-request@gnu.org?subject=subscribe>
X-Mailman-Original-Message-ID <20190709171204.d1cc42a73ef2f1148556a0d5@plushkava.net>
X-Mailman-Original-References <20190708092807.02edd68a60130b89a7775425@plushkava.net> <c7525b0b-937c-48e3-92f6-c5e5734b0426@email.android.com> <20190709111616.26148014b42ea4210f634e1e@plushkava.net> <80df53ac-2861-73e4-d1cb-86bf265b5550@case.edu>
Xref csiph.com gnu.bash.bug:15099

Show key headers only | View raw


On Tue, 9 Jul 2019 10:48:32 -0400
Chet Ramey <chet.ramey@case.edu> wrote:

> On 7/9/19 6:16 AM, kfm@plushkava.net wrote:
> 
> >> Did you have a look at the 'conditional.sh' script too? Looks like the '-N' switch compares only the integer part of the timestamp seconds.
> > 
> > The stat structure supports timestamp fields of nanosecond granularity since POSIX.1-2008, so it should work. I tried a simple test case here, and the behaviour of -N seems generally broken:
> > 
> > # f=$(mktemp); [[ -N $f ]]; echo $?; touch -m "$f"; [[ -N $f ]]; echo $?
> > 0
> > 0
> > 
> > I expected the value of $? to be non-zero at first, followed by 0 after updating the mtime. 
> 
> The code just returns (atime <= mtime), and has since 1997. It uses the
> st_atime and st_mtime fields. I should update it to use timespecs if
> they're available, and (mtime > atime) might work closer to your
> expectations.
> 
> After the call to mktemp, the atime and mtime are the same, so the test
> returns true.

I see. Indeed, it is confusing to me because I would not consider a file whose atime and mtime are equal to have been "modified since it was last read", notwithstanding that the newborn file has not yet been read at all. I think that it would help for the documentation to address this nuance.

As for the possibility of using the timespec fields, that would be terrific.

> 
> Using the test command that ships with GNU coreutils (v8.31) exhibits the
> same problem:
> > 
> > # f=$(mktemp); command test -N "$f"; echo $?; touch -m "$f"; command test -N "$f"; echo $?
> > 0
> > 0
> 
> It might, but that's not what you tested. This runs the builtin test.

Ah, how silly of me. I had also tried with the fully qualified path of test before posting, at least.

-- 
Kerin Millar <kfm@plushkava.net>

Back to gnu.bash.bug | Previous | Next | Find similar | Unroll thread


Thread

Re: file access time and file modification time "" <kfm@plushkava.net> - 2019-07-09 17:12 +0100

csiph-web