From nobody Tue Jan 25 13:26:16 2022 X-Original-To: freebsd-ports@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 F137B197C762 for ; Tue, 25 Jan 2022 13:26:21 +0000 (UTC) (envelope-from woozle@woozle.net) Received: from woozle.rinet.ru (woozle.rinet.ru [195.54.192.68]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4JjngJ6GFnz4TpF for ; Tue, 25 Jan 2022 13:26:20 +0000 (UTC) (envelope-from woozle@woozle.net) Received: from localhost (localhost [127.0.0.1]) by woozle.rinet.ru (8.14.5/8.14.5) with ESMTP id 20PDQGfd096445; Tue, 25 Jan 2022 16:26:16 +0300 (MSK) (envelope-from woozle@woozle.net) Date: Tue, 25 Jan 2022 16:26:16 +0300 (MSK) From: Dmitry Morozovsky X-X-Sender: marck@woozle.rinet.ru To: Sysadmin Lists cc: freebsd-ports@FreeBSD.org Subject: Re: sed trouble when UNAME_* is set in jail (fwd) In-Reply-To: <765383430.947805.1643068188075@ichabod.co-bxl> Message-ID: References: <765383430.947805.1643068188075@ichabod.co-bxl> User-Agent: Alpine 2.00 (BSF 1167 2008-08-23) X-NCC-RegID: ru.rinet X-OpenPGP-Key-ID: 6B691B03 List-Id: Porting software to FreeBSD List-Archive: https://lists.freebsd.org/archives/freebsd-ports List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-ports@freebsd.org X-BeenThere: freebsd-ports@freebsd.org MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.4.3 (woozle.rinet.ru [0.0.0.0]); Tue, 25 Jan 2022 16:26:16 +0300 (MSK) X-Rspamd-Queue-Id: 4JjngJ6GFnz4TpF X-Spamd-Bar: - Authentication-Results: mx1.freebsd.org; dkim=none; dmarc=none; spf=pass (mx1.freebsd.org: domain of woozle@woozle.net designates 195.54.192.68 as permitted sender) smtp.mailfrom=woozle@woozle.net X-Spamd-Result: default: False [-1.30 / 15.00]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-1.000]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; R_SPF_ALLOW(-0.20)[+ip4:195.54.192.68:c]; NEURAL_HAM_LONG(-1.00)[-1.000]; MIME_GOOD(-0.10)[text/plain]; RCVD_TLS_LAST(0.00)[]; DMARC_NA(0.00)[woozle.net]; NEURAL_SPAM_SHORT(1.00)[1.000]; TO_MATCH_ENVRCPT_SOME(0.00)[]; RCPT_COUNT_TWO(0.00)[2]; MLMMJ_DEST(0.00)[freebsd-ports]; FROM_EQ_ENVFROM(0.00)[]; R_DKIM_NA(0.00)[]; MIME_TRACE(0.00)[0:+]; ASN(0.00)[asn:8331, ipnet:195.54.192.0/19, country:RU]; RCVD_COUNT_TWO(0.00)[2] X-ThisMailContainsUnwantedMimeParts: N Replying to myself, On Tue, 25 Jan 2022, Sysadmin Lists wrote: > > ---------------------------------------- > > From: Dmitry Morozovsky > > Sent: Mon Jan 24 20:45:11 CET 2022 > > To: > > Subject: sed trouble when UNAME_* is set in jail (fwd) > > > > I have a jail on my build system, nested-built on a previous major; on the > > case, it's stable/10; for a poudriere, it is defined as null-mounted from the > > build jail: > > > > 10-amd64 stable/10 amd64 null 2022-01-20 13:10:41 /X/j10a ^^^^^^^^^ here is the problem, it should be version, not branch, "10.4-STABLE" (10-STABLE is not enough as OSVERSION check will fail) > > > > for some other reasons, there're definition in login.conf like > > > > :setenv=MAIL=/var/mail/$,BLOCKSIZE=K,UNAME_r=10.4-STABLE,UNAME_v=FreeBSD 10.4-STABLE #0:\ > > > > however, bulk.sh/common.sh are unhappy with this breaking with > > > > sed: 1: "s/,UNAME_r.*:/:/ ; s/:\ ...": bad flag in substitute command: ',' > > > > I tracked this down to update_version_env() in common.sh, but then stuck > > did I miss something trivial? > > `sed' is complaining about a bad substitution flag. Here's the expected behavior: > > $ awk '/sed/ && /UNAME/ {print NR ": " $0}' /usr/local/share/poudriere/common.sh > 2860: sed -i "" -e "s/,UNAME_r.*:/:/ ; s/:\(setenv.*\):/:\1${login_env}:/" \ > > $ cat testfile > :setenv=MAIL=/var/mail/$,BLOCKSIZE=K,UNAME_r=10.4-STABLE,UNAME_v=FreeBSD 10.4-STABLE #0:\ > > $ sed -e "s/,UNAME_r.*:/:/ ; s/:\(setenv.*\):/:\1${login_env}:/" testfile > :setenv=MAIL=/var/mail/$,BLOCKSIZE=K:\ > > Try running the sed command by hand one piece at a time to troubleshoot what's breaking. > > $ sed "s//,UNAME_r.*:/:/" ${mnt}/etc/login.conf > $ sed "s/:\(setenv.*\):/:\1${login_env}:/" ${mnt}/etc/login.conf > $ echo $login_env > > -- Sincerely, D.Marck [DM5020, MCK-RIPE, DM3-RIPN] [ FreeBSD committer: marck@FreeBSD.org ] --------------------------------------------------------------------------- *** Dmitry Morozovsky --- D.Marck --- Wild Woozle --- woozle@woozle.net *** ---------------------------------------------------------------------------