Replying to myself,

On Tue, 25 Jan 2022, Sysadmin Lists wrote:

> > ----------------------------------------
> > From: Dmitry Morozovsky <[email protected]>
> > Sent: Mon Jan 24 20:45:11 CET 2022
> > To: <[email protected]>
> > 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:                                    [email protected] ]
---------------------------------------------------------------------------
*** Dmitry Morozovsky --- D.Marck --- Wild Woozle --- [email protected] ***
---------------------------------------------------------------------------

Reply via email to