From nobody Wed Jul 28 19:17:44 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 A222012AB917 for ; Wed, 28 Jul 2021 19:18:01 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: from mail-qt1-x835.google.com (mail-qt1-x835.google.com [IPv6:2607:f8b0:4864:20::835]) (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 4GZk2d434fz3G44 for ; Wed, 28 Jul 2021 19:18:01 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: by mail-qt1-x835.google.com with SMTP id a12so2165626qtb.2 for ; Wed, 28 Jul 2021 12:18:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bsdimp-com.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=QAIEYOR6pBHf/Js5XsFmkqiTU/8RV0D0JuwMqu8MOgA=; b=g9gyyJ5MskiYAbjBo/sjJXusqMbuy6t2ro2G9sOqpEBBFTOiMFs/roqk6ofa/J6l85 nvS4ZQIVhAAJyJnMU4Ou0TzdUu03rx/7XCPYPhQgqE+BQmVAN1UxJbXHHM0d21QexQu0 KzS8w+om41SykGZNi+aBk4IB6BM1XLGPiA2rn7n1NxOekxALW2bRrKYXeITjdKYqr7IB Mltqj6SKTryo/R3HWsCZJTJtr/ROk6RTsLXRtrqo3P35nRXm/AFxShZ3pamAipIObS4D lC4cSyJLEb1fmxbo581CFE+v+PmQdRNWGG6QrzZY8OqOmNwLdkE/9saS18CnUR+adguy PJPg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=QAIEYOR6pBHf/Js5XsFmkqiTU/8RV0D0JuwMqu8MOgA=; b=M2jWM/U/3VAlckXA7te/GaFV3sLkJW8BLON1k7sALcwJMIieHoA9wcEpF3tr8xI75Y p4z/RcGkRIY8bzKJkiQAIcu83F/5E0rpUbGN6xeEtcaxlEWBXqvGSqbfqyoJ5F13mR7U wxc2t4I+iTfjV4M/sky1NbBbnSmXjixMhqCdSxv3fQ1yt0sfvOEmDc0uY9NbE9mzawiF TMkRC8phQ6eb1Mt7zwBiZSkPO7WC5peLs0Qeu84vQAoT7um6a0iV7TL7B48+onIjvsbY cr/3e7RoniDjI6a4APez/A58Z5f/F6l0lWD5k8xUjTxYX5EP7lr7iTrb4BKUnBt8RuF6 GG/A== X-Gm-Message-State: AOAM53260dyVMxl64P1w5OH1qXZ1s22Tjs+bHcRPbgwCrxleK9ZRgjSR Q2d0RSN0dNDcGTypU7AidYgtqjW4FChsRPG9J3t/1Q== X-Google-Smtp-Source: ABdhPJyjrbHXAafO6dLhVA8wak4lCw26JjPjNPvq+6Hunse/fu6yaarOCXnL+z0P5UtTVjJJkLgcRgLAr6txNB6/mpE= X-Received: by 2002:ac8:6759:: with SMTP id n25mr1012893qtp.49.1627499874952; Wed, 28 Jul 2021 12:17:54 -0700 (PDT) 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 References: <8e1a8e3c-b062-7749-ceab-e500c1ab758e@protected-networks.net> <04456969-bee0-8b22-4e81-a3201824d852@protected-networks.net> In-Reply-To: <04456969-bee0-8b22-4e81-a3201824d852@protected-networks.net> From: Warner Losh Date: Wed, 28 Jul 2021 13:17:44 -0600 Message-ID: Subject: Re: awk behaviour? To: Michael Butler Cc: freebsd-current , Ed Maste Content-Type: multipart/alternative; boundary="000000000000eb3dee05c833d7dc" X-Rspamd-Queue-Id: 4GZk2d434fz3G44 X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-ThisMailContainsUnwantedMimeParts: Y --000000000000eb3dee05c833d7dc Content-Type: text/plain; charset="UTF-8" On Wed, Jul 28, 2021 at 1:12 PM Michael Butler wrote: > 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 > I've cc'd emaste to see if this is related to his recent changes. Warner --000000000000eb3dee05c833d7dc--