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

Alex Richardson arichardson at FreeBSD.org
Wed Aug 12 17:27:25 UTC 2020


Author: arichardson
Date: Wed Aug 12 17:27:24 2020
New Revision: 364174
URL: https://svnweb.freebsd.org/changeset/base/364174

Log:
  Use env pwd instead of pwd in crunchgen.c
  
  In r364166 I changed /bin/pwd to pwd, but pwd can be shell builtin that
  may not correctly return a real path. To ensure that all symlinks are
  resolved use `env pwd -P` instead (the -P flag is part of POSIX so
  should be supported everywhere).
  
  Reported By:	rgrimes
  Suggested By:	jrtc27

Modified:
  head/usr.sbin/crunch/crunchgen/crunchgen.c

Modified: head/usr.sbin/crunch/crunchgen/crunchgen.c
==============================================================================
--- head/usr.sbin/crunch/crunchgen/crunchgen.c	Wed Aug 12 17:16:26 2020	(r364173)
+++ head/usr.sbin/crunch/crunchgen/crunchgen.c	Wed Aug 12 17:27:24 2020	(r364174)
@@ -653,7 +653,7 @@ fillin_program(prog_t *p)
 
 	/* Determine the actual srcdir (maybe symlinked). */
 	if (p->srcdir) {
-		snprintf(line, MAXLINELEN, "cd %s && pwd", p->srcdir);
+		snprintf(line, MAXLINELEN, "cd %s && env pwd -P", p->srcdir);
 		f = popen(line,"r");
 		if (!f)
 			errx(1, "Can't execute: %s\n", line);


More information about the svn-src-head mailing list