Path: csiph.com!goblin2!goblin1!goblin.stu.neva.ru!usenet.stanford.edu!not-for-mail From: Mischa Baars Newsgroups: gnu.bash.bug Subject: Re: file access time and file modification time Date: Tue, 24 Sep 2019 08:48:30 +0200 Lines: 57 Approved: bug-bash@gnu.org Message-ID: References: <20190708092807.02edd68a60130b89a7775425@plushkava.net> <20190709111616.26148014b42ea4210f634e1e@plushkava.net> <32f71d294578fd6eaf292ad52f277f627c9ee690.camel@cyberfiber.eu> NNTP-Posting-Host: lists.gnu.org Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit X-Trace: usenet.stanford.edu 1569307834 2248 209.51.188.17 (24 Sep 2019 06:50:34 GMT) X-Complaints-To: action@cs.stanford.edu Cc: bug-bash@gnu.org To: kfm@plushkava.net Envelope-to: bug-bash@gnu.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=cyberfiber.eu; s=default; h=Content-Transfer-Encoding:MIME-Version: Content-Type:References:In-Reply-To:Date:Cc:To:From:Subject:Message-ID:Sender :Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help: List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=5A7eEijtLNm9COexjMv8+/vdiKG1q6gOKvTkEA3+178=; b=S6B0Ocf8e72WlFFu0fi1fZ/whT 9FTkbISW59IGUzEIZFWGSZG2FVDEYe94XMdqDP8J776DlAMY57MFXMtEAf6Cy+gcFLDk13cYnkyLC jXloUvQKwDvOHU+WP6pnZsT/zlHRL/XkbogAK3GhPjCj5MEino0KP6QqcjnfT8D3326txjq3F8QuM 7CeWCqTi7k+bZ4/dWzcU8hzXC99TJdRALN/WaNpR9D5UTzwjCU0POiFDGYPwIqv6q2655LSzqRZpx +xH8PqCXoAsnzN98twE7jdDKtiUB3phcu3/agydpwQpJvr26pSUYzmraqst5vTyY4msgGhk1vulYx OxrGenAg==; In-Reply-To: <20190709111616.26148014b42ea4210f634e1e@plushkava.net> User-Agent: Evolution 3.32.4 (3.32.4-1.fc30) X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - www98.totaalholding.nl X-AntiAbuse: Original Domain - gnu.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - cyberfiber.eu X-Get-Message-Sender-Via: www98.totaalholding.nl: authenticated_id: mjbaars1977.bug-bash@cyberfiber.eu X-Authenticated-Sender: www98.totaalholding.nl: mjbaars1977.bug-bash@cyberfiber.eu X-Source: X-Source-Args: X-Source-Dir: X-Originating-IP: 185.94.230.81 X-SpamExperts-Domain: out.totaalholding.nl X-SpamExperts-Username: 185.94.230.81 Authentication-Results: totaalholding.nl; auth=pass smtp.auth=185.94.230.81@out.totaalholding.nl X-SpamExperts-Outgoing-Class: ham X-SpamExperts-Outgoing-Evidence: Combined (0.08) X-Recommended-Action: accept X-Filter-ID: Mvzo4OR0dZXEDF/gcnlw0dWQ8c9lblW44odAlK6ziUapSDasLI4SayDByyq9LIhVEP9pMYdzJR2n O1x/flp1NETNWdUk1Ol2OGx3IfrIJKywOmJyM1qr8uRnWBrbSAGDu+MuAbNHX7Qd+PEd0ms9H80D SEpCfISRYCKsig5kq2J7Vt98dgKBp5ekEz9iy+/dZIOQYaDXB30lsHjt7j8HkKlf0W50n6AuXIMv hlU4BzhNwITHhljpqKk+Ratvp0JPhh8OzJWiBXhoyvdBz/MpXE9H2jTXggI6z2khZfw60sm0pAwS QD/zK/rnlT7zD5CjaNJScrTO/pZaeJIu6m+LfxVVJ2mVvokCO2vVjpfr/eX3+RWxljT0AAJgouHP rg5R6cTrAfIBtLJVe62uoyOAUop4cZXX4YNvBwClFIJz3G8Bi53Psle5cUmOuJZEMw7GmFVVgWdB XKkEH0++/JhR/Qa+FEE+TmTK/6Hl36Y/23+8Ksk+aedMfNWSnJswrtlNLvt8g5xNnRDJKGvWdqSF OI2azxuHF97acinCSKJAyH/YQ5Td2RXsWX2IABvakz06874MD/XDMPpcnv6l5Hrq7jOPc3EG53uL 3j4HL+IhMsqbPc0mYnNMTVPrDKDVIdcLr9fqW2Z10/kPBgXER1Dmg+J7ma0X+2zItFkUeqWfp1mZ hL2wvzPO43AJCAHFvxiW5pD+htWe7e7J6w5h4SbDHPrBvfM+vO14O3RLrOHXx6oQq76vNFyA+95Z JjK+335kjGuI8rMSAKNyzPgk8pR8s0NiuVI4YCZn5t4Ev1x+lU/CvC5IOBiuDlC0ScPsxM+phezs RKUt0dmpzGqrNd7vWutcDGyxNtE+P0bSrgLY38yrcIEadlYgj2eBXfpSoJyKRYzEWSIy+7kOfCAE FR/Ag36m+UeFXprlCOm3BAEbJtBJgK/wJSvu5exU03hwZzffByoxoTq6Raz8sAZyY0abz8qMfINb C8WZiIbqNH9tRUBdBlbRnbEF8XekrEHvBBagtIvIeIRvBOxbqjF/RJylgKln/Hb8GmeWdll4hUxh RMhSMLysKfhf0QF58gYlVZrj9jihx+Za/cV70jOJzN2r4A== X-Report-Abuse-To: spam@filter01.totaalholding.nl X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a02:40c0:1000:1000:0:2:ffff:10 X-BeenThere: bug-bash@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Bug reports for the GNU Bourne Again SHell List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Mailman-Original-Message-ID: <32f71d294578fd6eaf292ad52f277f627c9ee690.camel@cyberfiber.eu> X-Mailman-Original-References: <20190708092807.02edd68a60130b89a7775425@plushkava.net> <20190709111616.26148014b42ea4210f634e1e@plushkava.net> Xref: csiph.com gnu.bash.bug:15423 Hi Kerin and Chet, Testing mailing list. My earlier replies didn't come through. Regards, Mischa. On Tue, 2019-07-09 at 11:16 +0100, kfm@plushkava.net wrote: > Hi Mischa, > > On Tue, 09 Jul 2019 09:05:45 +0200 > Mischa Baars wrote: > > > Hi Kerin, > > > > That indeed solves the problem in 'accesstime.sh', although I would > > recommend some sort of reference from the bash manpage to the mount > > manpage. > > > > 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. 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 > > That was with ext4 as the filesystem backing the TMPDIR. I also > tested FreeBSD/UFS, with the same results, even if sleeping one > second before updating the mtime. Perhaps Chet would be so kind as to > clarify what's going on here. In the meantime, your technique of > comparing the timestamps lexicographically seems like a good > workaround, although you should use [[ instead. For example: > > # check() { local at=$(stat -c %x "$1") mt=$(stat -c %y "$1"); [[ $mt > > $at ]]; } > # f=$(mktemp); check "$f"; echo $?; touch -m "$f"; check "$f"; echo > $? > 1 > 0 >