Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 28 Jul 2021 13:17:44 -0600
From:      Warner Losh <imp@bsdimp.com>
To:        Michael Butler <imb@protected-networks.net>
Cc:        freebsd-current <freebsd-current@freebsd.org>, Ed Maste <emaste@freebsd.org>
Subject:   Re: awk behaviour?
Message-ID:  <CANCZdfqJdDbPz2N2MRuTQRrdie=wKRx7EH7sF7VQHQ%2BBvqj_Dg@mail.gmail.com>
In-Reply-To: <04456969-bee0-8b22-4e81-a3201824d852@protected-networks.net>
References:  <8e1a8e3c-b062-7749-ceab-e500c1ab758e@protected-networks.net> <CANCZdfp1nTx0%2B4ZKWYOPN9WtBzDPHYRnzLL58=Ni7giwFQFmfw@mail.gmail.com> <04456969-bee0-8b22-4e81-a3201824d852@protected-networks.net>

next in thread | previous in thread | raw e-mail | index | archive | help
--000000000000eb3dee05c833d7dc
Content-Type: text/plain; charset="UTF-8"

On Wed, Jul 28, 2021 at 1:12 PM Michael Butler <imb@protected-networks.net>
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--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CANCZdfqJdDbPz2N2MRuTQRrdie=wKRx7EH7sF7VQHQ%2BBvqj_Dg>