bugfindutils - Bugs: bug #57025, find -mtime will ignore large files

 
 

bug #57025: find -mtime will ignore large files

Submitter:  None
Submitted:  Wed 09 Oct 2019 12:14:44 PM UTC
   
 
Category:  find Severity:  2 - Minor
Item Group:  Wrong result Status:  Fixed
Privacy:  Public Assigned to:  berny
Originator Name:  Threewaters Originator Email:  -email is unavailable-
Open/Closed:  Closed Release:  4.6.0
Fixed Release:  4.8.0
* Mandatory Fields

Add a New Comment Rich Markup
   

Jump to the original submission

Sat 13 Feb 2021 02:34:56 PM UTC, comment #14: 

The problem is locality of information.

Indeed, that's nice for the -size option. But what's the point to add a comment specifically for that option, and not for say -mtime?

The current state of the man page seems to be in a mid-state regarding these numeric arguments. For some options, we repeat carefully that you can use +n/-n/n, for other options, we rely on the factorized text at the top of the section, and only say that it is "less than, more that, or exactly", which if you are a bit too formal, could conclude that it just match everything. At the very least, it generates confusion.

Changing the option format from

  -atime n

to

  -atime -n|+n|n

as you proposed in comment #7 would remove all ambiguities, and would make very obvious how the options work without even the need to read anything (mostly).

Another option is to add in the text for each option something like "(see NUMERIC ARGUMENT)", and make a dedicated section.

Another option, which I don't like, would be to group all the numeric options in a same section, and hope people will see the text at the top because the section would be small.

Patrick M. <fuujuhi>
Mon 08 Feb 2021 06:25:09 PM UTC, comment #13: 

The man page says for the -size option:

> The  + and - prefixes signify greater than and less than, as usual;
> i.e., an exact size of n units does not match.


This sounds as it would exactly what you want.

Bernhard Voelker <berny>
Group administrator
Mon 08 Feb 2021 07:28:37 AM UTC, comment #12: 

Thanks for the fast response, and sorry for my very slow reaction.

Yes, I have seen that sentence.

However the problem I have is that this clarification text is, for most options, quite far away from the specification of the option.

I had a ticket originally telling that despite my experience with find, I was frequently bitten by the fact that say -size 1M is only for files that are exactly 1M. And hence was proposing that the manpage was updated in some way.

The proposal in comment #7 is exactly the clarification needed I think: -amin -n|+n|n.

At least for me, and also combined with the text now added ("less than, more than or exactly"), this would be really great.

Patrick M. <fuujuhi>
Fri 15 Jan 2021 05:08:43 PM UTC, comment #11: 

Right before the description of -amin (which is the first option in the TESTS section),
I introduced this new sentence in a central place - as I didn't want to clutter all descriptions
of the tests taking numeric arguments:

       A numeric argument n can be specified to tests (like -amin, -mtime, -gid, -inum, -links, -size, -uid and -used) as

       +n     for greater than n,

       -n     for less than n,

       n      for exactly n.


I assume this is okay?
I'm not sure if this is already in the version you see on Debian - probably not.

Bernhard Voelker <berny>
Group administrator
Fri 15 Jan 2021 01:53:11 PM UTC, comment #10: 

Thanks for the fix.

I have findutils~4.7.0+git20201010-2 on my Debian Bullseye, and in the manpage, I see this:

    -amin n
          File was last accessed less than, more than or exactly n minutes ago.

This seems a bit confusing when given only the syntax "-amin n". Note that -amin is quite close to the text regarding numeric arguments, but other options are much farther (-size).

One may argue that searching for '-amin' or '-size', we always scan through that text regarding the numeric arguments. I see however that the proposal below was also to change "-amin n" into "-amin -n|+n|n", which I think would be uber great (something like "-amin [-+]n" would also be ok).

Patrick M. <fuujuhi>
Mon 04 Jan 2021 11:32:52 PM UTC, comment #9: 

Pushed in August 2020 at:
https://git.sv.gnu.org/cgit/findutils.git/commit/?id=b9ddd2bca10

Marking as Fixed.

Bernhard Voelker <berny>
Group administrator
Thu 13 Aug 2020 10:27:29 PM UTC, comment #8: 

3rd: the texinfo manual already contained such a clarification,
yet not in the place one would try to look for.
The attached new patch fixes that (too).

Have a nice day,
Berny

(file #49667)

Bernhard Voelker <berny>
Group administrator
Tue 29 Oct 2019 07:46:34 AM UTC, comment #7: 

thanks for the suggestions.

1st: ".BI" doesn't work well.  And IMO it bloats that sentence
with the "(...)" which disturbs the easy reading.
I played a bit with something like this:

.IP "\-amin \fI-n\fR|\fI+n\fR|\fIn\fR"

which compiles as

-amin -n|+n|n

i.e., leaving the explaining sentence as in my previous proposal,
and adding the alternatives more prominently to the option item itself.
I'm not sure this is valid syntax though.

2nd: hmm, rounding is indeed a little trap for the user.  But I think
repeating a description in all places (-ctime, -mtime, -atime) is not
ideal either.  One place - and a reference to it in the other option's
descriptions - is enough.

3rd: I agree, that part of the Texinfo manual should stay/get in sync with the man page.

Bernhard Voelker <berny>
Group administrator
Sun 27 Oct 2019 10:39:12 AM UTC, comment #6: 

I agree that the patch you proposed is a substantial improvement.

>  .IP "\-amin \fIn\fR"
> -File was last accessed \fIn\fR minutes ago.
> +File was last accessed less than, more than or exactly \fIn\fR minutes ago.


Do you think it is worthwhile to make things even more explicit?  For example,

File was last accessed less than (
.BI \-amin -n
), more than (
.BI \-amin -n
) or exactly (
.BI \-amin n
) minutes ago. 

(Caveat: I did not check that .BI actually works)

Secondly, for tests where comparisons are made after rounding, perhaps we should point that out, too.

Thirdly, does the Texinfo documentation need to be updated too?




James Youngman <jay>
Group administrator
Sat 19 Oct 2019 04:42:18 PM UTC, comment #5: 

I see - what about the attached patch to 'find.1'?

(file #47718)

Bernhard Voelker <berny>
Group administrator
Sat 12 Oct 2019 12:09:26 AM UTC, comment #4: 

Ok, I believed it's my fault...

Quote from man page:
-atime n
              File  was  last  accessed  n*24  hours  ago.   When find figures out how many 24-hour periods ago the file was last
              accessed, any fractional part is ignored, so to match -atime +1, a file has to have been accessed at least two days
              ago.

-mtime n
              File's data was last modified n*24 hours ago.  See the comments for -atime to understand how rounding  affects  the
              interpretation of file modification times.

So is that means:
"+n" >> n n*24 hours beyond (not include n*24)
"n" == n n*24 hours equal
"-n" << n n*24 hours within (not include n*24)

I believe the man page doc could be more enriched.
Thanks a lot!

Anonymous
Fri 11 Oct 2019 11:12:06 PM UTC, comment #3: 

I don't see from your examples why find -mtime would elide large files.

These are the 3 files in the 'ls' output larger than 3GiB:

-rw-rw-r-- 1 threewaters threewaters  4193711507 Oct  2 19:01 2574.part
 -rw-rw-r-- 1 threewaters threewaters  4652828672 Oct  6 14:08 3524.part
 -rw-rw-r-- 1 threewaters threewaters  8152317952 Oct  3 09:12 3625.part


The middle one, '3524.part', appears in the output of find,
and the other 2 have been ruled out by -mtime 4: show only files
which have been modified exactly 4 days ago.

Do I miss something?

Bernhard Voelker <berny>
Group administrator
Fri 11 Oct 2019 02:14:13 AM UTC, comment #2: 

find *.part -mtime 4 -type f -ls
 18483504 128096 -rw-rw-r--   1 threewaters threewaters 201725004 Oct  6 15:12 007.part
 18486530  56768 -rw-rw-r--   1 threewaters threewaters 559563054 Oct  6 10:17 1051.part
 18487093  29816 -rw-rw-r--   1 threewaters threewaters 200162867 Oct  6 15:32 1052.part
 18487245  27636 -rw-rw-r--   1 threewaters threewaters 127759980 Oct  7 00:54 1099.part
 18486787  29656 -rw-rw-r--   1 threewaters threewaters 559432108 Oct  7 00:41 1137.part
 18487095   8388 -rw-rw-r--   1 threewaters threewaters 302045139 Oct  7 07:29 1174.part
 18487625   6032 -rw-rw-r--   1 threewaters threewaters 488273477 Oct  7 05:28 1191.part
 18487386    860 -rw-rw-r--   1 threewaters threewaters 4524400640 Oct  7 05:38 1267.part
 18487838   9536 -rw-rw-r--   1 threewaters threewaters  744177664 Oct  6 22:17 1309.part
 18487952   2840 -rw-rw-r--   1 threewaters threewaters    2908160 Oct  7 06:30 1316.part
 18487587   1524 -rw-rw-r--   1 threewaters threewaters 2151446460 Oct  6 23:48 1336.part
 18488018  35644 -rw-rw-r--   1 threewaters threewaters  466064767 Oct  6 20:51 1373.part
 18488067 114044 -rw-rw-r--   1 threewaters threewaters  379431454 Oct  6 20:51 1470.part
 18488297  44584 -rw-rw-r--   1 threewaters threewaters  713529344 Oct  6 12:23 1479.part
 18488810    268 -rw-rw-r--   1 threewaters threewaters   97550787 Oct  7 05:29 1584.part
 18488862   4532 -rw-rw-r--   1 threewaters threewaters    4640543 Oct  6 23:29 1621.part
 18488879  44252 -rw-rw-r--   1 threewaters threewaters  476672000 Oct  6 18:22 1678.part
 18488860 415732 -rw-rw-r--   1 threewaters threewaters  470289854 Oct  6 20:44 1709.part
 18488269  47228 -rw-rw-r--   1 threewaters threewaters  236464361 Oct  7 01:09 1711.part
 18484294   4884 -rw-rw-r--   1 threewaters threewaters    4998254 Oct  6 11:08 191.part
 18489933   9840 -rw-rw-r--   1 threewaters threewaters   39258399 Oct  7 00:03 2127.part
 18491758 115952 -rw-rw-r--   1 threewaters threewaters  517317062 Oct  7 01:00 2576.part
 18491534 105516 -rw-rw-r--   1 threewaters threewaters  516995268 Oct  7 01:35 2771.part
 18484299  39436 -rw-rw-r--   1 threewaters threewaters  138872317 Oct  6 16:21 278.part
 18492401  18884 -rw-rw-r--   1 threewaters threewaters  306184192 Oct  6 13:39 2914.part
 18492817 105288 -rw-rw-r--   1 threewaters threewaters 2055536640 Oct  6 15:14 3181.part
 18492852 164076 -rw-rw-r--   1 threewaters threewaters  305135616 Oct  6 14:42 3192.part
 18483824 431212 -rw-rw-r--   1 threewaters threewaters  548852712 Oct  6 23:28 334.part
 18484469  57228 -rw-rw-r--   1 threewaters threewaters  362603384 Oct  7 07:30 343.part
 18494318  54004 -rw-rw-r--   1 threewaters threewaters 4652828672 Oct  6 14:08 3524.part
 18494898   5720 -rw-rw-r--   1 threewaters threewaters   35041280 Oct  7 03:05 3720.part
 18495057  10572 -rw-rw-r--   1 threewaters threewaters  949069824 Oct  6 21:52 3771.part
 18484464 171660 -rw-rw-r--   1 threewaters threewaters  424285823 Oct  7 03:49 395.part
 18495784  26552 -rw-rw-r--   1 threewaters threewaters  105987752 Oct  7 01:35 4004.part
 18484394  93628 -rw-rw-r--   1 threewaters threewaters 1026482143 Oct  6 22:18 501.part
 18485348  81056 -rw-rw-r--   1 threewaters threewaters  276438890 Oct  7 00:16 520.part
 18484467  34392 -rw-rw-r--   1 threewaters threewaters  233813092 Oct  7 01:40 522.part
 18484593 638436 -rw-rw-r--   1 threewaters threewaters  876685778 Oct  7 08:16 564.part
 18485540 165796 -rw-rw-r--   1 threewaters threewaters  329283492 Oct  7 02:06 584.part
 18485061 421608 -rw-rw-r--   1 threewaters threewaters 1810177956 Oct  7 08:36 709.part
 18486160   3044 -rw-rw-r--   1 threewaters threewaters   31101560 Oct  6 22:00 782.part

$ ls -t -l|tail -41
-rw-rw-r-- 1 threewaters threewaters          29 Oct  6 23:49 334.part.met.seeds
-rw-rw-r-- 1 threewaters threewaters          29 Oct  6 23:49 4004.part.met.seeds
-rw-rw-r-- 1 threewaters threewaters  2151446460 Oct  6 23:48 1336.part
-rw-rw-r-- 1 threewaters threewaters     4640543 Oct  6 23:29 1621.part
-rw-rw-r-- 1 threewaters threewaters   548852712 Oct  6 23:28 334.part
-rw-rw-r-- 1 threewaters threewaters  1026482143 Oct  6 22:18 501.part
-rw-rw-r-- 1 threewaters threewaters   744177664 Oct  6 22:17 1309.part
-rw-rw-r-- 1 threewaters threewaters    31101560 Oct  6 22:00 782.part
-rw-rw-r-- 1 threewaters threewaters   949069824 Oct  6 21:52 3771.part
-rw-rw-r-- 1 threewaters threewaters   466064767 Oct  6 20:51 1373.part
-rw-rw-r-- 1 threewaters threewaters   379431454 Oct  6 20:51 1470.part
-rw-rw-r-- 1 threewaters threewaters   470289854 Oct  6 20:44 1709.part
-rw-rw-r-- 1 threewaters threewaters          52 Oct  6 20:38 1709.part.met.seeds
-rw-rw-r-- 1 threewaters threewaters          29 Oct  6 20:38 1136.part.met.seeds
-rw-rw-r-- 1 threewaters threewaters          29 Oct  6 20:38 2462.part.met.seeds
-rw-rw-r-- 1 threewaters threewaters          52 Oct  6 19:34 1470.part.met.seeds
-rw-rw-r-- 1 threewaters threewaters   476672000 Oct  6 18:22 1678.part
-rw-rw-r-- 1 threewaters threewaters          29 Oct  6 17:25 860.part.met.seeds
-rw-rw-r-- 1 threewaters threewaters   138872317 Oct  6 16:21 278.part
-rw-rw-r-- 1 threewaters threewaters          29 Oct  6 15:34 278.part.met.seeds
-rw-rw-r-- 1 threewaters threewaters          29 Oct  6 15:34 709.part.met.seeds
-rw-rw-r-- 1 threewaters threewaters   200162867 Oct  6 15:32 1052.part
-rw-rw-r-- 1 threewaters threewaters  2055536640 Oct  6 15:14 3181.part
-rw-rw-r-- 1 threewaters threewaters   201725004 Oct  6 15:12 007.part
-rw-rw-r-- 1 threewaters threewaters   305135616 Oct  6 14:42 3192.part
-rw-rw-r-- 1 threewaters threewaters  4652828672 Oct  6 14:08 3524.part
-rw-rw-r-- 1 threewaters threewaters   306184192 Oct  6 13:39 2914.part
-rw-rw-r-- 1 threewaters threewaters   713529344 Oct  6 12:23 1479.part
-rw-rw-r-- 1 threewaters threewaters     4998254 Oct  6 11:08 191.part
-rw-rw-r-- 1 threewaters threewaters   559563054 Oct  6 10:17 1051.part
-rw-rw-r-- 1 threewaters threewaters          52 Oct  3 15:33 1221.part.met.seeds
-rw-rw-r-- 1 threewaters threewaters          29 Oct  3 15:33 3192.part.met.seeds
-rw-rw-r-- 1 threewaters threewaters  8152317952 Oct  3 09:12 3625.part
-rw-rw-r-- 1 threewaters threewaters          29 Oct  3 07:40 114.part.met.seeds
-rw-rw-r-- 1 threewaters threewaters   257621948 Oct  3 07:26 114.part
-rw-rw-r-- 1 threewaters threewaters     4879617 Oct  3 03:57 1631.part
-rw-rw-r-- 1 threewaters threewaters          29 Oct  3 03:01 1631.part.met.seeds
-rw-rw-r-- 1 threewaters threewaters          29 Oct  3 01:32 522.part.met.seeds
-rw-rw-r-- 1 threewaters threewaters          29 Oct  3 00:35 1934.part.met.seeds
-rw-rw-r-- 1 threewaters threewaters    46398162 Oct  3 00:19 1934.part
-rw-rw-r-- 1 threewaters threewaters  4193711507 Oct  2 19:01 2574.part

Anonymous
Wed 09 Oct 2019 07:35:13 PM UTC, comment #1: 

Please provide with some steps to reproduce it. I can't reproduce on Ubuntu 18.04.3 here with:


$ truncate -s 15T a
$ find . -mtime -1 -ls
 59965646      4 drwxrwxr-x   2 me me           4096 Oct  9 20:29 .
 59912668      0 -rw-rw-r--   1 me me 16492674416640 Oct  9 20:29 ./a


Please also clarify what you mean with "(the smallest one I saw)".

Stephane Chazelas <stephanechazelas>
Wed 09 Oct 2019 12:14:44 PM UTC, original submission:  

As I tested -mtime function, it ignore any -mtime meet files larger than 3.9GiB (the smallest one I saw).
System: Ubuntu Server 18.04.3 LTS

Anonymous

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

Attached Files
file #49667:  0001-doc-enhance-description-of-tests-accepting-numeric-a.patch added by berny (7KiB - text/x-patch - [PATCH] doc: enhance description of tests accepting numeric arguments in find.1)
file #47718:  0001-doc-enhance-description-of-tests-accepting-numeric-a.patch added by berny (5KiB - text/x-patch - [PATCH] doc: enhance description of tests accepting numeric arguments in find.1)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by fuujuhi (Posted a comment)
  • -email is unavailable- added by jay (Posted a comment)
  • -email is unavailable- added by berny (Posted a comment)
  • -email is unavailable- added by stephanechazelas (Posted a comment)
  • -email is unavailable- added by None (Submitted the item)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only logged-in users can vote.

     

    Follow 9 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2021-01-09 berny Open/ClosedOpen Closed
        Fixed ReleaseNone 4.8.0
    2021-01-04 berny StatusCode Review Fixed
    2020-08-13 berny Attached File- Added 0001-doc-enhance-description-of-tests-accepting-numeric-a.patch, #49667
    2019-10-19 berny Attached File- Added 0001-doc-enhance-description-of-tests-accepting-numeric-a.patch, #47718
        Severity3 - Normal 2 - Minor
        StatusNone Code Review
    2019-10-11 berny Assigned toNone berny
        Fixed Release4.6.0 None

    Back to the top

    Powered by Savane 3.13-4448.
    Corresponding source code