From owner-svn-src-head@freebsd.org Tue Oct 6 01:33:57 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 5884D436084; Tue, 6 Oct 2020 01:33:57 +0000 (UTC) (envelope-from kevans@freebsd.org) Received: from smtp.freebsd.org (smtp.freebsd.org [96.47.72.83]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "smtp.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4C50P11hQdz3VZF; Tue, 6 Oct 2020 01:33:57 +0000 (UTC) (envelope-from kevans@freebsd.org) Received: from mail-qt1-f175.google.com (mail-qt1-f175.google.com [209.85.160.175]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) (Authenticated sender: kevans) by smtp.freebsd.org (Postfix) with ESMTPSA id 1940325F08; Tue, 6 Oct 2020 01:33:57 +0000 (UTC) (envelope-from kevans@freebsd.org) Received: by mail-qt1-f175.google.com with SMTP id r8so11627865qtp.13; Mon, 05 Oct 2020 18:33:57 -0700 (PDT) X-Gm-Message-State: AOAM530uEBjYUF3S0fkE9yPdaKB6EDFYW3kvDtsg5SvaunaFfoWQgPEm F4SpMNeYZ1usK+s/zdK1/HSpZY5DqMEZZg/6ECY= X-Google-Smtp-Source: ABdhPJxw5blr3hrnRTjn4glTwiDzAZGPQ3rmdm+zhA2+XK8CqLAfwCtBWzbWUnnI2I8I9mD2xy35rpeyOyK0THbdvzI= X-Received: by 2002:ac8:a0e:: with SMTP id b14mr307900qti.242.1601948036524; Mon, 05 Oct 2020 18:33:56 -0700 (PDT) MIME-Version: 1.0 References: <202010052057.095Kvi7e098469@repo.freebsd.org> <20201005213914.GA28182@FreeBSD.org> In-Reply-To: <20201005213914.GA28182@FreeBSD.org> From: Kyle Evans Date: Mon, 5 Oct 2020 20:33:45 -0500 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: svn commit: r366466 - head/usr.sbin/crunch/crunchgen To: Alexey Dokuchaev Cc: src-committers , svn-src-all , svn-src-head , Alex Richardson Content-Type: text/plain; charset="UTF-8" X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 06 Oct 2020 01:33:57 -0000 On Mon, Oct 5, 2020 at 4:39 PM Alexey Dokuchaev wrote: > > 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? :-/ > 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