Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 25 Jan 2022 16:26:16 +0300 (MSK)
From:      Dmitry Morozovsky <woozle@woozle.net>
To:        Sysadmin Lists <sysadmin.lists@mailfence.com>
Cc:        freebsd-ports@FreeBSD.org
Subject:   Re: sed trouble when UNAME_* is set in jail (fwd)
Message-ID:  <alpine.BSF.2.00.2201251623510.65651@woozle.rinet.ru>
In-Reply-To: <765383430.947805.1643068188075@ichabod.co-bxl>
References:  <alpine.BSF.2.00.2201242244230.65651@woozle.rinet.ru> <765383430.947805.1643068188075@ichabod.co-bxl>

next in thread | previous in thread | raw e-mail | index | archive | help
Replying to myself,

On Tue, 25 Jan 2022, Sysadmin Lists wrote:

> > ----------------------------------------
> > 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 ***
---------------------------------------------------------------------------



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?alpine.BSF.2.00.2201251623510.65651>