svn commit: r366466 - head/usr.sbin/crunch/crunchgen

Alexey Dokuchaev danfe at freebsd.org
Mon Oct 5 21:39:14 UTC 2020


On Mon, Oct 05, 2020 at 08:57:44PM +0000, Kyle Evans wrote:
> New Revision: 366466
> URL: https://svnweb.freebsd.org/changeset/base/366466
> 
> Log:
>   crunchgen: fix MK_AUTO_OBJ logic after r364166
>   
>   r364166 converted echo -n `/bin/pwd` to a raw pwd invocation, leaving a
>   trailing newline at the end of path.  This caused a later stat() of it to
>   erroneously fail and the fallback to MK_AUTO_OBJ=no logic proceeded as
>   unexpected.

[...]
@@ -648,8 +653,7 @@
 
        /* Determine the actual srcdir (maybe symlinked). */
        if (p->srcdir) {
-               snprintf(line, MAXLINELEN, "cd %s && echo -n `/bin/pwd`",
-                   p->srcdir);
+               snprintf(line, MAXLINELEN, "cd %s && pwd", p->srcdir);
                f = popen(line,"r");

Calling popen("cd somedir && pwd") in a C program to resolve symlinks,
seriously?  Why not simply call realpath(3) instead? :-/

./danfe


More information about the svn-src-head mailing list