Date: Thu, 28 Dec 2017 19:57:47 +0000 From: bugzilla-noreply@freebsd.org To: freebsd-bugs@FreeBSD.org Subject: [Bug 222698] find(1)'s -newer expression doesn't work with symbolic links if '-P' (the default) is requested. Message-ID: <bug-222698-8-9PJqE7Nlor@https.bugs.freebsd.org/bugzilla/> In-Reply-To: <bug-222698-8@https.bugs.freebsd.org/bugzilla/> References: <bug-222698-8@https.bugs.freebsd.org/bugzilla/>
next in thread | previous in thread | raw e-mail | index | archive | help
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D222698 --- Comment #4 from Conrad Meyer <cem@freebsd.org> --- This change ought to be sufficient to fix -newer: --- a/usr.bin/find/function.c +++ b/usr.bin/find/function.c @@ -1201,6 +1201,7 @@ c_newer(OPTION *option, char ***argvp) char *fn_or_tspec; PLAN *new; struct stat sb; + int error; fn_or_tspec =3D nextarg(option, argvp); ftsoptions &=3D ~FTS_NOSTAT; @@ -1214,7 +1215,11 @@ c_newer(OPTION *option, char ***argvp) /* Use the seconds only in the comparison. */ new->t_data.tv_nsec =3D 999999999; } else { - if (stat(fn_or_tspec, &sb)) + if (ftsoptions & FTS_PHYSICAL) + error =3D lstat(fn_or_tspec, &sb); + else + error =3D stat(fn_or_tspec, &sb); + if (error !=3D 0) err(1, "%s", fn_or_tspec); if (option->flags & F_TIME2_C) new->t_data =3D sb.st_ctim; However, -samefile is similarly broken. Here's a patch for that part: --- a/usr.bin/find/function.c +++ b/usr.bin/find/function.c @@ -1066,12 +1066,17 @@ c_samefile(OPTION *option, char ***argvp) char *fn; PLAN *new; struct stat sb; + int error; fn =3D nextarg(option, argvp); ftsoptions &=3D ~FTS_NOSTAT; new =3D palloc(option); - if (stat(fn, &sb)) + if (ftsoptions & FTS_PHYSICAL) + error =3D lstat(fn, &sb); + else + error =3D stat(fn, &sb); + if (error !=3D 0) err(1, "%s", fn); new->i_data =3D sb.st_ino; return new; --=20 You are receiving this mail because: You are the assignee for the bug.=
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-222698-8-9PJqE7Nlor>