Re: svn commit: r366466 - head/usr.sbin/crunch/crunchgen
On Mon, Oct 5, 2020 at 4:39 PM Alexey Dokuchaev wrote: > > On Mon, Oct 05, 2020 at 08:57:44PM +, 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? :-/ > Excellent question. :-) CC'ing Alex, because he might have looked at this more in-depth. I don't see any real reason for the status quo vs. realpath(3) off the top of my head, but I'm not familiar with the history and don't quite have the time to track down the ramifications of the change. Thanks, Kyle Evans ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
Re: svn commit: r366466 - head/usr.sbin/crunch/crunchgen
On Mon, Oct 05, 2020 at 08:57:44PM +, 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 ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r366466 - head/usr.sbin/crunch/crunchgen
Author: kevans Date: Mon Oct 5 20:57:44 2020 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. Harry Schmalzbauer bissected the resulting build failure he experienced (stable/12 host, -HEAD build) down to r365887. This change is mostly unrelated, except it switches the build to bootstrapped crunchgen - clue! I then bissected recent crunchgen changes going back a bit since we wouldn't observe the failure immediately with -CURRENT in most configurations, which landed me on r364166. After many intense head-scratching minutes and printf debugging, I realized that the newline was the difference. This is where our tale ends. Reported by: Harry Schmalzbauer, O. Hartmann, Mike Tancsa, kevans MFC after:3 days Modified: head/usr.sbin/crunch/crunchgen/crunchgen.c Modified: head/usr.sbin/crunch/crunchgen/crunchgen.c == --- head/usr.sbin/crunch/crunchgen/crunchgen.c Mon Oct 5 20:13:22 2020 (r366465) +++ head/usr.sbin/crunch/crunchgen/crunchgen.c Mon Oct 5 20:57:44 2020 (r366466) @@ -666,6 +666,8 @@ fillin_program(prog_t *p) if (!*path) errx(1, "Can't perform pwd on: %s\n", p->srcdir); + /* Chop off trailing newline. */ + path[strlen(path) - 1] = '\0'; p->realsrcdir = strdup(path); } ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"