From owner-svn-src-head@freebsd.org Thu Aug 13 15:37:50 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 DB1AD37CDAC for ; Thu, 13 Aug 2020 15:37:50 +0000 (UTC) (envelope-from jrtc27@jrtc27.com) Received: from mail-wr1-f66.google.com (mail-wr1-f66.google.com [209.85.221.66]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BS9gd58wkz4R6p for ; Thu, 13 Aug 2020 15:37:49 +0000 (UTC) (envelope-from jrtc27@jrtc27.com) Received: by mail-wr1-f66.google.com with SMTP id l2so5689063wrc.7 for ; Thu, 13 Aug 2020 08:37:49 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=qXnz4UyDCK7WBByqbh4flcZfZJw8RdMJJtU3n5KFBOQ=; b=V6myGnUzKZmFBMBhCmTzQxFqrYcwxG70gZD2U7kA5srKLvHUbvXJe+pwKTpACKAibT +3DCgGo4e0kMmk4iXc1+QIlBzWNQ4lZHSNjBAL5sNaKp1zrERkspIEo0yJLB5MzKli3q gNu6hf3YmebJbbBbRSLoVp43yiMJjEXZ+Bh3KIHQRbZovDhnm8TTwm5h2dgrDcI3Reut 2FZ6oDQt4NHkdtFYEKGAQB+UCCAloVzuV//Y66GTC2Ctx4Uf9GGEHWfj1gFhUhXtg5fZ eAzAnz3lBdOIejdlqwrT/akxo3+11cCyuuXA7V9VBk1IVhg8y8t0x6u2H3OLulDij+qq oFwQ== X-Gm-Message-State: AOAM532d4MI+nyhJ9YRvYT380Bnw/cXY3DdXObEI884apsPxn46p16fb Ul+22zcj1CFRbftITvZIbYKzLSUFMDE= X-Google-Smtp-Source: ABdhPJxZYjYdnp9YGrAnZqkTZZFPzGn/gbXKNL52teJ1RWFDvF0QdeYg414jcvxZVm2wjzHUN3N70g== X-Received: by 2002:adf:ba83:: with SMTP id p3mr4758227wrg.246.1597333068043; Thu, 13 Aug 2020 08:37:48 -0700 (PDT) Received: from [192.168.149.251] (trinity-students-nat.trin.cam.ac.uk. [131.111.193.104]) by smtp.gmail.com with ESMTPSA id 33sm11256770wri.16.2020.08.13.08.37.47 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Thu, 13 Aug 2020 08:37:47 -0700 (PDT) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 13.4 \(3608.120.23.2.1\)) Subject: Re: svn commit: r364166 - head/usr.sbin/crunch/crunchgen From: Jessica Clarke In-Reply-To: <1f724b1b9e0c230f793a49c948c778d3def045b9.camel@freebsd.org> Date: Thu, 13 Aug 2020 16:37:46 +0100 Cc: rgrimes@freebsd.org, Alex Richardson , src-committers , svn-src-all , svn-src-head@freebsd.org Content-Transfer-Encoding: 7bit Message-Id: <7DF33D5E-A867-4C33-957D-74A6B8D72ED2@freebsd.org> References: <202008121624.07CGOTnt038878@gndrsh.dnsmgr.net> <1f724b1b9e0c230f793a49c948c778d3def045b9.camel@freebsd.org> To: Ian Lepore X-Mailer: Apple Mail (2.3608.120.23.2.1) X-Rspamd-Queue-Id: 4BS9gd58wkz4R6p X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org; dkim=none; dmarc=none; spf=pass (mx1.freebsd.org: domain of jrtc27@jrtc27.com designates 209.85.221.66 as permitted sender) smtp.mailfrom=jrtc27@jrtc27.com X-Spamd-Result: default: False [-2.07 / 15.00]; ARC_NA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; MID_RHS_MATCH_FROM(0.00)[]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; R_SPF_ALLOW(-0.20)[+ip4:209.85.128.0/17:c]; MV_CASE(0.50)[]; MIME_GOOD(-0.10)[text/plain]; PREVIOUSLY_DELIVERED(0.00)[svn-src-head@freebsd.org]; DMARC_NA(0.00)[freebsd.org]; RCPT_COUNT_FIVE(0.00)[6]; NEURAL_HAM_LONG(-1.02)[-1.021]; RCVD_COUNT_THREE(0.00)[3]; TO_MATCH_ENVRCPT_SOME(0.00)[]; NEURAL_HAM_SHORT(-0.57)[-0.566]; RCVD_IN_DNSWL_NONE(0.00)[209.85.221.66:from]; NEURAL_HAM_MEDIUM(-0.99)[-0.987]; FORGED_SENDER(0.30)[jrtc27@freebsd.org,jrtc27@jrtc27.com]; RWL_MAILSPIKE_POSSIBLE(0.00)[209.85.221.66:from]; R_DKIM_NA(0.00)[]; MIME_TRACE(0.00)[0:+]; ASN(0.00)[asn:15169, ipnet:209.85.128.0/17, country:US]; FROM_NEQ_ENVFROM(0.00)[jrtc27@freebsd.org,jrtc27@jrtc27.com]; RCVD_TLS_ALL(0.00)[] 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: Thu, 13 Aug 2020 15:37:50 -0000 On 13 Aug 2020, at 16:33, Ian Lepore wrote: > On Wed, 2020-08-12 at 09:24 -0700, Rodney W. Grimes wrote: >>> On 12 Aug 2020, at 17:10, Rodney W. Grimes < >>> freebsd@gndrsh.dnsmgr.net> wrote: >>>> >>>>> Author: arichardson >>>>> Date: Wed Aug 12 15:49:06 2020 >>>>> New Revision: 364166 >>>>> URL: https://svnweb.freebsd.org/changeset/base/364166 >>>>> >>>>> Log: >>>>> Fix crunchgen usage of mkstemp() >>>>> >>>>> On Glibc systems mkstemp can only be used once with the same >>>>> template >>>>> string since it will be modified in-place and no longer >>>>> contain any 'X' chars. >>>>> It is fine to reuse the same file here but we need to be >>>>> explicit and use >>>>> open() instead of mkstemp() on the second use. >>>>> >>>>> While touching this file also avoid a hardcoded /bin/pwd since >>>>> that may not >>>>> work when building on non-FreeBSD systems. >>>> >>>> This may cause some grief, as now pwd may use a shell builtin >>>> and often shell builtin's return a cwd that is not a true >>>> full path, ie it may contain symlink compontents in the >>>> path. >>>> >>>> /bin/sh: >>>> >>>> # cd /tmp/b >>>> # /bin/pwd >>>> /tmp/a >>>> # pwd >>>> /tmp/b >>>> # ls -lag /tmp/? >>>> lrwxr-xr-x 1 root wheel 1 Aug 12 16:06 /tmp/b -> a >>>> >>>> /tmp/a: >>>> total 17 >>>> drwxr-xr-x 2 root wheel 2 Aug 12 16:06 . >>>> drwxrwxrwt 18 root wheel 248 Aug 12 16:06 .. >>> >>> There's the question of whether that really matters; both values >>> are in >>> some sense correct. But if you want to restore the old behaviour, I >>> believe `env pwd` is the portable way to do so? >> >> You have cut the context, but the code has a comment that >> states it is doing this to remove symbolic links, so this >> change infact undoes something that was being done intentionally. >> >> I do believe also that a "env pwd" would do the right thing >> as well. >> > > Or just use "pwd -P" and avoid invoking multiple programs when the > shell can do all the work. Indeed, my suggestion was solving the wrong problem. r364174 added the -P but also needlessly added env too; -P is part of POSIX so any conforming pwd will support it, builtin or not. Jess