Commit Graph

208 Commits

Author SHA1 Message Date
andvar 82bba4e936 fix various typos in comments. 2024-02-05 21:46:04 +00:00
mrg 81a719df6e avoid various use-after-free issues.
create a ptrdiff_t offset between the start of an allocation region and
some interesting pointer, so it can be adjusted with this offset after
realloc() returns.  for pdisk(), realloc() is a locally inlind malloc()
and free() pair.

for mail(1), this required a little bit more effort as the old pointer
was passed into another file for fix-ups there, and that code needed to
be adjusted for offset vs old pointer usage.

found by GCC 12.
2023-08-10 20:36:28 +00:00
rin 03675fcefd Revert CC_WNO_USE_AFTER_FREE from Makefile's (thanks uwe@) 2023-08-03 14:56:36 +00:00
rin 91f8ac6d30 Sprinkle CC_WNO_USE_AFTER_FREE for GCC 12
All of them are blamed for idiom equivalent to:
	newbuf = realloc(buf, size);
	p = newbuf + (p - buf);
2023-08-03 13:36:08 +00:00
christos 7f63469776 PR/57313: Timo Buhrmester: Don't bail if "." cannot be opened. From FreeBSD 2023-04-01 15:57:20 +00:00
christos 8ff73d8547 Use /dev/tty for SIGINFO
Fix some size_t<->int
2022-01-22 14:08:19 +00:00
andvar 6584ea569e fix various typos in compatibility, mainly in comments. 2021-08-09 20:49:08 +00:00
cheusov 93a814dc9d find: use POSIX strtoll(3) instead of legacy strtoq(3) 2021-03-18 18:24:14 +00:00
cheusov 4e50b167d1 find: use POSIX type uint32_t instead of u_int32_t 2021-03-18 18:21:18 +00:00
uwe dedde0dc29 Use \*q to refer to ascii quote to save fontlock from confusion. 2020-11-02 07:03:48 +00:00
kim ac0b9611e2 Bump date (for "-not") 2020-11-01 21:11:49 +00:00
wiz 878fe969c6 Properly quote '\;' in example. 2020-11-01 16:47:29 +00:00
kim c3c5cb3347 Document the -not operator 2020-11-01 16:34:02 +00:00
mrg 947dbbbacf add support for '-not': GNU and thus worldly scripts compatibility. 2020-11-01 05:38:29 +00:00
kre 2bdb5be389 Inspired by PR pkg/53543
When calculating the length of the args that can be
appended in a "find .... -exec something {} +"
usage, remember to allow for the arg pointers, which
form part of what is allowed in ARG_MAX.

From a fairly empty installation of HEAD on amd64
and with a "/tmp/args" command that simply prints
its arg count, and the length of the arg strings,
with this mod I see ..

netbsd# find / -exec /tmp/args {} +
Argc 5000 Arglen 107645
Argc 5000 Arglen 151324
Argc 5000 Arglen 187725
Argc 5000 Arglen 206591
Argc 5000 Arglen 172909
Argc 5000 Arglen 186264
Argc 5000 Arglen 167906
Argc 2881 Arglen 98260

The upper limit of 5000 args is in the code.

Using the biggest of those, 5000
args, plus 206591 bytes of strings
uses 246591 bytes total (this excludes
the command name, so add a few more).
That's fairly close to the ARG_MAX
of 262144.

On another system (with longer paths) I see:
(this is just a small part of the output, using a
different version of the dummy command, and a
slightly different invocation)

Args: 4546 Len 218030
Args: 4878 Len 217991
Args: 4813 Len 218028
Args: 4803 Len 218029

There, 4878*8 + 217991 == 257015 which is about
as close as we'd want to come to the arg limit.

XXX pullup -8
2018-09-04 15:16:15 +00:00
wiz 01869ca4d2 Remove workaround for ancient HTML generation code. 2017-07-03 21:28:48 +00:00
christos edba12e937 PR/52295: Anthony Mallet: find -delete: "relative path not safe" with absolute
paths ... Fix from OpenBSD
2017-06-13 13:10:32 +00:00
abhinav 12e252e9b3 Fix typo: s/compatability/compatibility/ 2017-06-04 08:48:05 +00:00
wiz 46dfe48d23 Remove trailing whitespace. Remove unnecessary quotes. 2016-06-13 06:17:19 +00:00
pgoyette fb5782856e Fix missing quote. Resolve automated test failure. 2016-06-13 02:06:44 +00:00
pgoyette cc610a3c94 Add new primaries -asince, -csince, and -since to compare file's
attributes against a user-specified timestamp (rather than the
attributes of a reference file).

Update the parse routines so they have access to the name of the
option being parsed.  This enables accurate error reporting for
"aliases" of primaries.

Now that aliases work, introduce some aliases for consistency with
Gnu findutils.
2016-06-13 00:04:40 +00:00
pgoyette d3e6512866 Use .Ic markup for consistency with the rest of the document 2016-06-12 22:25:13 +00:00
pgoyette 09ebf81448 Further clarification of the treatment of numeric user and group names. 2016-06-12 22:17:18 +00:00
dholland 9d2811fca4 Extend the numeric handling for uids with -user to gids with -group, and
document it. Leftover bit of PR 46158.
2016-06-12 20:50:10 +00:00
pgoyette 355a32cb7e Change -{min,max}depth argument name from n to depth so that the
earlier statement concerning n being prefaced by a plus or minus.
(These exceptions to the +/- rule noted by kre@)

While here, fix markup error.  .Em for emphasis (stress) rather
than .Ar  :)
2016-06-12 03:21:35 +00:00
snj f0a7346d21 src is too big these days to tolerate superfluous apostrophes. It's
"its", people!
2014-10-18 08:33:23 +00:00
apb ba94e92b25 Add an example with find ... -exec sh -c .... 2014-05-17 11:31:40 +00:00
uebayasi 1a3fcd0b6a find(1): Compare timestamp in nsec scale in -anewer/-cnewer/-newer. 2013-05-04 06:29:32 +00:00
wiz 6ba5c58891 Add serial commas.
From Bug Hunting.
2013-02-08 12:50:51 +00:00
christos 792c142038 use O_CLOEXEC, wrap long line. 2013-01-24 17:50:08 +00:00
njoly bee4003ac7 Remove a few unneeded Pp macros. 2012-10-13 14:18:16 +00:00
wiz 30cf30e561 Make order of words in comment consistent with that within other
comments (helps with search actions).

Patch from Bug Hunting.
2012-08-26 14:26:37 +00:00
wiz 87cd44cb03 - improve spelling;
- improve wording;
- complement list of primaries that prevent `-print' from being
  used implicitly;
- bump date.

Patch from Bug Hunting.
2012-08-26 14:26:07 +00:00
wiz fcb39fb954 Various improvements:
- remove redundant mentioning of option names within their description;
- improve (and make consistent) punctuation;
- add missing empty line;
- remove superfluous white space;
- extend `-iname' primary description (copying text from `-name');
- general wording improvements;
- improve macro usage;
- remove double spaces from examples (it's readable well without);
- reference re_format(7) in `SEE ALSO' (as it's mentioned in the
  text several times);
- bump date.

From Bug Hunting.
2012-08-16 13:34:10 +00:00
wiz 471b14b657 - Even if it may be obvious, actually explain what ``{}'' means
with ``-exec ... {} +'';
- make wording more consistent;
- bump date.

From Bug Hunting.
2012-07-07 20:45:09 +00:00
jdf 6e4b17c46b Small fix: Changed 'Nm .' to 'Nm' (introduced by me before). 2012-06-27 22:57:27 +00:00
jdf ebac77ef57 Various formatting changes:
* Remove superfluous Pp macro (fixes mandoc(1) warning)
 * use Xr macro instead of Nm where appropriate
 * escape punctuation (so Ic actually 'sees' it) (fixed mandoc(1) warning)
 * remove redundant argument to successive Nm macros
 * remove double spaces

Patch supplied by Bug Hunting.
2012-06-27 22:31:26 +00:00
wiz 28acebf1eb Improve wording and macro usage; bump date.
From Bug Hunting.
2012-06-20 17:55:06 +00:00
dholland 1d1104dd8c rest of previous.
BQS: 1. dholland: 0.
2012-05-05 21:16:16 +00:00
dholland f88a50da82 typo in comment 2012-05-05 20:48:51 +00:00
wiz 3957bea1ef Fix whitespace nits. Suggested by Bug Hunting. 2012-03-22 07:58:16 +00:00
matt d34c2845b8 Use C89 function definitions 2012-03-20 20:34:57 +00:00
dholland 83889b37fd Avoid testing a possibly uninitialized errno value when using -exit.
Closes PR 44973 (change is a somewhat more principled equivalent of
the patch suggested there) although I cannot replicate the reported
behavior unless I explicitly prepare errno with a nonzero value before
the fts_read loop.
2012-03-18 17:09:46 +00:00
apb aaffb7873e Updates to the find(1) man page, based on PR 45381 from Greg Woods,
with additional changes by myself.
2011-09-24 13:45:43 +00:00
christos 8624929e77 Fix unchecked malloc, check for overflow (Maksymilian Arciemowicz)
While here, remove unused casts, fix types.
2011-09-22 12:49:57 +00:00
joerg 6818646ac8 Use __dead 2011-09-16 15:39:25 +00:00
plunky 9f61b80465 NULL does not need a cast 2011-08-31 16:24:54 +00:00
jmcneill e816b5f7a6 Don't error out while searching for empty directories, from FreeBSD:
http://lists.freebsd.org/pipermail/svn-src-head/2010-December/022913.html
2011-02-24 02:55:18 +00:00
dholland f4f54a9c39 Fix "-exec blah blah {} +" so it only matches when the {} is last, as
per the standard. Per (brief) discussion on tech-userlevel.

There should really be a form where you can do the equivalent of
"-exec blah {} blah +", but I think we're going to need to call it
something other than -exec. As it is it's sort of surprising that the
standards people didn't add a different name -- note what happens if
you try to do something like "find ... -exec expr {} + 2 \;".
2011-01-06 08:18:42 +00:00
christos d6d145ee46 only setup siginfo handler if we have a tty. 2010-12-28 15:28:31 +00:00