From nobody Wed Jul 28 19:12:22 2021 X-Original-To: freebsd-current@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id B9F5812A8C9F for ; Wed, 28 Jul 2021 19:12:26 +0000 (UTC) (envelope-from imb@protected-networks.net) Received: from mail.protected-networks.net (mail.protected-networks.net [IPv6:2001:470:8d59:1::8]) (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 (2048 bits) client-digest SHA256) (Client CN "mail.protected-networks.net", Issuer "R3" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GZjwB4JChz3CjP for ; Wed, 28 Jul 2021 19:12:26 +0000 (UTC) (envelope-from imb@protected-networks.net) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d= protected-networks.net; h=content-transfer-encoding :content-language:content-type:content-type:in-reply-to :mime-version:user-agent:date:date:message-id:from:from :references:subject:subject; s=201508; t=1627499543; bh=8a6VMTbj F8QL4q1ZS2QSwd5v8HdgOOCGTzHS52ZfMAw=; b=nS7byAalrpzQC6g6w2XX++No JqN7KDYSx6S3Z9UIQrvBCu7RrJwhnrp/MVv52ZpS1tqeSi7oRAbi/WEgkzn5oAXU LSrUt2eUokT9YuW6J5GSRSrfjqg96IzJwM0801mTCcN2fN2pbzeko3h3KYwDQMqv wZ9PSSj+FxqpbPAi8+w= Received: from toshi.auburn.protected-networks.net (toshi.auburn.protected-networks.net [192.168.1.10]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (Client did not present a certificate) (Authenticated sender: imb@mail.protected-networks.net) by mail.protected-networks.net (Postfix) with ESMTPSA id 32808279A; Wed, 28 Jul 2021 15:12:23 -0400 (EDT) Subject: Re: awk behaviour? To: Warner Losh Cc: freebsd-current References: <8e1a8e3c-b062-7749-ceab-e500c1ab758e@protected-networks.net> Message-ID: <04456969-bee0-8b22-4e81-a3201824d852@protected-networks.net> Date: Wed, 28 Jul 2021 15:12:22 -0400 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:78.0) Gecko/20100101 Thunderbird/78.12.0 List-Id: Discussions about the use of FreeBSD-current List-Archive: https://lists.freebsd.org/archives/freebsd-current List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-current@freebsd.org MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=windows-1252; format=flowed Content-Language: en-NZ Content-Transfer-Encoding: 7bit X-Rspamd-Queue-Id: 4GZjwB4JChz3CjP X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] Reply-To: imb@protected-networks.net From: Michael Butler via freebsd-current X-Original-From: Michael Butler X-ThisMailContainsUnwantedMimeParts: N On 7/28/21 1:36 PM, Warner Losh wrote: > On Wed, Jul 28, 2021 at 11:31 AM Michael Butler via freebsd-current < > freebsd-current@freebsd.org> wrote: > >> I tripped over this while trying to build a local release .. >> >> imb@toshi:/home/imb> pkg --version | awk -F. '{print $$1 * 10000 + $$2 * >> 100 + $$3}' >> 10001 >> >> imb@toshi:/home/imb> pkg --version >> 1.17.1 >> >> Is this expected? >> > > Why $$ instead of $? $ isn't expanded in '' expressions, so doubling isn't > necessary > unlike in make... With single quotes it works for me: > > % pkg --version | awk -F. '{print $1 * 10000 + $2 * 100 + $3}' > 11603 > % pkg --version > 1.16.3 > > In awk $$n is $($n), so $$ in this context would evaluate $1 to 1 and then > $1 to be 1. And then $2 to be 16 > and then $17 to be 0 and then $3 to be 1 and then $1 to be 1 which leads to > 10001. What prompted the question was my (obviously poor) attempt to debug and resolve this failure when attempting to build a release for i386 on an amd64 .. make -C /usr/src/release obj make -C /usr/src/release ftp cdrom memstick.img mini-memstick.img mkdir -p dist cd /usr/src/release/.. && make TARGET_ARCH=i386 TARGET=i386 distributeworld DISTDIR=/usr/obj/usr/src/i386.i386/release/dist make[3]: "/usr/obj/usr/src/i386.i386/toolchain-metadata.mk" line 1: Using cached toolchain metadata from build at vm01.auburn.protected-networks.net on Wed Jul 28 18:01:01 UTC 2021 make[3]: "/usr/src/Makefile.inc1" line 1864: String comparison operator must be either == or != make[3]: "/usr/src/Makefile.inc1" line 2073: String comparison operator must be either == or != make[3]: Fatal errors encountered -- cannot continue make[3]: stopped in /usr/src *** Error code 1 Stop. imb