Giter Site home page Giter Site logo

Comments (7)

stephane-chazelas avatar stephane-chazelas commented on August 14, 2024

There's a similar problem with the -Xtime [-+]<n> predicates, there the <n> is not treated as an integer number of days and more like the -Xtime [-+]<n>d of FreeBSD.

For instance -mtime 0 is meant to reports files last modified in the last 24 hours, while toybox find only reports the ones last modified exactly now.

from toybox.

landley avatar landley commented on August 14, 2024

Busybox having behaved this way 2007 and nobody noticed seem that strong an argument. Do you have a use case that broke because of this?

512 seems irrelevant (minimum block size of ext2 was 1024 back in the 1990s, even fat32 defaults to at least 4k these days). If we gave m units presumably it should round to the megabyte?

from toybox.

landley avatar landley commented on August 14, 2024

Sharp edge here is that -size has any supplied units override the default (including c=bytes), but -time and -min don't (1kd days is 1000 days).

from toybox.

landley avatar landley commented on August 14, 2024

Debian's find -size also implicitly selects -type f.

from toybox.

stephane-chazelas avatar stephane-chazelas commented on August 14, 2024

Debian's find -size also implicitly selects -type f.

Why would it do that?

$ find . -size 5542c -prune -ls
      258      0 drwxr-xr-x   1 chazelas chazelas     5542 Apr 25 19:29 .
$ find /etc/mtab -size 19c -prune -ls
   187446      4 lrwxrwxrwx   1 root     root           19 Jun 27  2021 /etc/mtab -> ../proc/self/mounts
$ find --version
find (GNU findutils) 4.9.0
Copyright (C) 2022 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <https://gnu.org/licenses/gpl.html>.
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

Written by Eric B. Decker, James Youngman, and Kevin Dalley.
Features enabled: D_TYPE O_NOFOLLOW(enabled) LEAF_OPTIMISATION FTS(FTS_CWDFD) CBO(level=2)
$ lsb_release -a
No LSB modules are available.
Distributor ID: Debian
Description:    Debian GNU/Linux trixie/sid
Release:        n/a
Codename:       trixie

from toybox.

stephane-chazelas avatar stephane-chazelas commented on August 14, 2024

Busybox having behaved this way 2007 and nobody noticed seem that strong an argument. Do you have a use case that broke because of this?

512 seems irrelevant (minimum block size of ext2 was 1024 back in the 1990s, even fat32 defaults to at least 4k these days). If we gave m units presumably it should round to the megabyte?

It's quite well known busybox is not standard compliant and that one needs to adapt their script when porting to busybox.

Common denominator for block device block size is still 512 bytes.

But that's hardly relevant (and not the point of this question).

Find's -size <number-without-suffix> is a well known almost 50 years old API which checks the size based on number of 512 byte units. If you want your tool to use different unit, don't call it find or use a separate API that doesn't break backward compatibility like the find -size 12k of FreeBSD or GNU (incompatible between themselves), or introduce a new one and convince other implementations to adopt it so it can be suggested as a standard to POSIX and used portably in a few decades.

from toybox.

terefang avatar terefang commented on August 14, 2024

But that's hardly relevant (and not the point of this question).

Find's -size <number-without-suffix> is a well known almost 50 years old API which checks the size based on number of 512 byte units. If you want your tool to use different unit, don't call it find or use a separate API that doesn't break backward compatibility like the find -size 12k of FreeBSD or GNU (incompatible between themselves), or introduce a new one and convince other implementations to adopt it so it can be suggested as a standard to POSIX and used portably in a few decades.

@stephane-chazelas while you have a point that there is deviation from the POSIX standard here, toybox is only claiming reasonably standards-compliant and possible more inclined to follow busybox compatiblity here.

also the POSIX standard is imprecise, vague or outright lacking in many places, having been the playground of many corporate interests in the past decades.

if you have an interesting solution to that problem, you can always submit a patch or pull request for review.

from toybox.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.