[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#33097: test has filetest -a but man page doesn't list it
From: |
Bernhard Voelker |
Subject: |
bug#33097: test has filetest -a but man page doesn't list it |
Date: |
Mon, 22 Oct 2018 22:18:21 +0200 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.2.1 |
On 10/22/18 2:11 PM, Pádraig Brady wrote:
> On 21/10/18 16:06, Bernhard Voelker wrote:
>> On 10/21/18 2:09 AM, Paul Eggert wrote:
>>> I have the opposite impression. Any scripts using this confusing -a
>>> operator are
>>> already broken, and we should phase it out. Not that anybody actually
>>> *uses*
>>> coreutils "test -a".
>>
>> Done with the attached 1st patch.
>>
>> The 2nd patch is a cleanup avoiding the redundant checking of unary operators
>> in test_unop and unary_operator.
>>
>> The 3rd patch adds support for 'test -N FILE' as in bash.
>> Please check (on various platforms / file systems if possible).
>
> Very nice.
> atime has 24 hour resolution on vfat I think,
> though I think your test should handle that.
Thanks for the review - indeed, see:
https://en.wikipedia.org/wiki/File_Allocation_Table#Directory_table
Date resolution
2 seconds for last modified time,
10 ms for creation time,
1 day for access date,
2 seconds for deletion time
Although I think it's unlikely that someone will dare to run the coreutils
test-suite on vfat, I'd change the atime/mtime to set back in the test
to 2 resp. 4 days:
--- a/tests/misc/test-N.sh
+++ b/tests/misc/test-N.sh
@@ -24,13 +24,13 @@ touch file || framework_failure_
stat file
returns_ 1 env test -N file || fail=1
-# Set access time to yesterday at noon: 'test -N' returns 0.
-touch -a -d "12:00 today -1 days" file || framework_failure_
+# Set access time to 2 days ago: 'test -N' returns 0.
+touch -a -d "12:00 today -2 days" file || framework_failure_
stat file
env test -N file || fail=1
-# Set mtime to the day before yesterday: 'test -N' returns 1;
-touch -m -d "12:00 today -2 days" file || framework_failure_
+# Set mtime to 2 days before atime: 'test -N' returns 1;
+touch -m -d "12:00 today -4 days" file || framework_failure_
stat file
returns_ 1 env test -N file || fail=1
> Also -N should work with common relatime mount option.
What do you mean exactly? I mean, -N just reads what is stored in the
file system, so there's nothing 'test' could do about it.
Well, we could include a note to the texinfo page that -N
heavily relies on the underlying file system and mount option.
Thanks & have a nice day,
Berny