diff options
| author | Bernhard Voelker <mail@bernhard-voelker.de> | 2017-06-29 18:31:07 +0200 |
|---|---|---|
| committer | Bernhard Voelker <mail@bernhard-voelker.de> | 2017-06-29 18:31:07 +0200 |
| commit | 79bc9191c75087abc85c2c49827c34023890aa7d (patch) | |
| tree | 9f0dbba8fe0f1f075d40bc7345bc71124041286f | |
| parent | 3e4bb112ae70b5e1e08379f43d910803bcef8db0 (diff) | |
| download | findutils-79bc9191c750.tar.gz | |
doc: use correct IEC unit prefixes in the documentation of 'find -size'
find(1) uses binary-based units for the suffixes 'k', 'M', and 'G' of
the argument of the '-size' option: 1024, 1024*1024 and 1024^3.
Therefore, the documentation should use the correct IEC prefixes
kibibyte, mebibyte and gibibyte respectively (or their abbreviations
'KiB', 'MiB' and 'GiB').
* doc/find.texi (node Overview): Change 'Kilobytes' to the shorter
but correct 'KiB'.
(node Size): Use the above mentioned, correct IEC prefixes.
While at it, move the 'w' suffix up to match the man page.
* find/find.1 (-size): Likewise.
* find/parser.c (parse_size): Also change to IEX prefixes in some
comments for consistency.
* NEWS (Bug fixes): Mention the fix.
See also:
https://en.wikipedia.org/wiki/Binary_prefix
Reported by Andreas Metzler in
https://savannah.gnu.org/bugs/?51304
| -rw-r--r-- | NEWS | 7 | ||||
| -rw-r--r-- | doc/find.texi | 10 | ||||
| -rw-r--r-- | find/find.1 | 8 | ||||
| -rw-r--r-- | find/parser.c | 6 |
4 files changed, 19 insertions, 12 deletions
@@ -45,6 +45,13 @@ Some minor documentation improvements are listed in "Bug Fixes" below. ** Bug Fixes +#51304: doc: use correct IEC unit prefixes in the documentation of 'find -size'. + find(1) uses binary-based units for the suffixes 'k', 'M', and 'G' of + the argument of the '-size' option: 1024, 1024*1024 and 1024^3. + Therefore, the documentation should use the correct IEC prefixes + kibibyte, mebibyte and gibibyte respectively (or their abbreviations + 'KiB', 'MiB' and 'GiB'). + #50758: doc: fix the description of the -perm examples matching the permission mode "022" in find's texinfo manual: the match is for the file's group and 'other' mode bits instead of for user and group. diff --git a/doc/find.texi b/doc/find.texi index 8d2f35c..c1b602c 100644 --- a/doc/find.texi +++ b/doc/find.texi @@ -240,7 +240,7 @@ find @r{[}@var{file}@dots{}@r{]} @r{[}@var{expression}@r{]} @noindent Here is a typical use of @code{find}. This example prints the names of all files in the directory tree rooted in @file{/usr/src} whose -name ends with @samp{.c} and that are larger than 100 Kilobytes. +name ends with @samp{.c} and that are larger than 100 KiB. @example find /usr/src -name '*.c' -size +100k -print @end example @@ -1014,14 +1014,14 @@ one-character suffix to @var{n}: 512-byte blocks (never 1024) @item c bytes -@item k -kilobytes (1024 bytes) @item w 2-byte words +@item k +Kibibytes (KiB, units of 1024 bytes) @item M -Megabytes (units of 1048576 bytes) +Mebibytes (MiB, units of 1024 * 1024 = 1048576 bytes) @item G -Gigabytes (units of 1073741824 bytes) +Gibibytes (GiB, units of 1024 * 1024 * 1024 = 1073741824 bytes) @end table The `b' suffix always considers blocks to be 512 bytes. This is not diff --git a/find/find.1 b/find/find.1 index 9b194a8..c7b2543 100644 --- a/find/find.1 +++ b/find/find.1 @@ -900,11 +900,11 @@ for bytes .IP `w' for two-byte words .IP `k' -for Kilobytes (units of 1024 bytes) +for Kibibytes (KiB, units of 1024 bytes) .IP `M' -for Megabytes (units of 1048576 bytes) +for Mebibytes (MiB, units of 1024 * 1024 = 1048576 bytes) .IP `G' -for Gigabytes (units of 1073741824 bytes) +for Gibibytes (GiB, units of 1024 * 1024 * 1024 = 1073741824 bytes) .RE .IP The size does not count indirect blocks, but it does count blocks in @@ -913,7 +913,7 @@ sparse files that are not actually allocated. Bear in mind that the .B \-printf handle sparse files differently. The `b' suffix always denotes 512-byte blocks and never -1 Kilobyte blocks, which is different to the behaviour of +1024-byte blocks, which is different to the behaviour of .BR \-ls . .IP The + and - prefixes signify greater than and less than, as usual. diff --git a/find/parser.c b/find/parser.c index 0fc94d0..855ed1f 100644 --- a/find/parser.c +++ b/find/parser.c @@ -2117,12 +2117,12 @@ parse_size (const struct parser_table* entry, char **argv, int *arg_ptr) arg[len - 1] = '\0'; break; - case 'M': /* Megabytes */ + case 'M': /* Mebibytes */ blksize = 1024*1024; arg[len - 1] = '\0'; break; - case 'G': /* Gigabytes */ + case 'G': /* Gibibytes */ blksize = 1024*1024*1024; arg[len - 1] = '\0'; break; @@ -2149,7 +2149,7 @@ parse_size (const struct parser_table* entry, char **argv, int *arg_ptr) error (EXIT_FAILURE, 0, _("invalid -size type `%c'"), argv[*arg_ptr][len - 1]); } - /* TODO: accept fractional megabytes etc. ? */ + /* TODO: accept fractional mebibytes etc. ? */ if (!get_num (arg, &num, &c_type)) { char tail[2]; |
