Date: Tue, 25 Jan 2022 21:04:07 +0100 (CET) From: Sysadmin Lists <sysadmin.lists@mailfence.com> To: Dmitry Morozovsky <woozle@woozle.net> Cc: freebsd-ports@FreeBSD.org Subject: Re: sed trouble when UNAME_* is set in jail (fwd) Message-ID: <847219065.1111600.1643141047574@ichabod.co-bxl> In-Reply-To: <alpine.BSF.2.00.2201251623510.65651@woozle.rinet.ru> References: <alpine.BSF.2.00.2201242244230.65651@woozle.rinet.ru> <765383430.947805.1643068188075@ichabod.co-bxl> <alpine.BSF.2.00.2201251623510.65651@woozle.rinet.ru>
next in thread | previous in thread | raw e-mail | index | archive | help
You should learn basic troubleshooting steps for shell scripts: Enable debugging by adding 'set -x' around a block of code, and disable it with 'set +x'. > > > ---------------------------------------- > > > From: Dmitry Morozovsky <woozle@woozle.net> > > > Sent: Mon Jan 24 20:45:11 CET 2022 > > > To: <freebsd-ports@FreeBSD.org> > > > 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 *** > --------------------------------------------------------------------------- -- Sent with https://mailfence.com Secure and private email
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?847219065.1111600.1643141047574>