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

next in thread | previous in thread | raw e-mail | index | archive | help
> ----------------------------------------
> 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
> 
> 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

-- 
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?765383430.947805.1643068188075>