lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1b824b27-aa2d-91ca-5540-15695994ef9a@infradead.org>
Date:   Fri, 10 Apr 2020 10:36:27 -0700
From:   Randy Dunlap <rdunlap@...radead.org>
To:     "Jeremie Francois (on alpha)" <jeremie.francois@...il.com>,
        LKML <linux-kernel@...r.kernel.org>
Cc:     linux-kbuild <linux-kbuild@...r.kernel.org>,
        Masahiro Yamada <yamada.masahiro@...ionext.com>
Subject: Re: [PATCH] scripts/config: allow colons in option strings for sed

[adding Cc's]

On 4/10/20 9:57 AM, Jeremie Francois (on alpha) wrote:
> Sed broke on some strings as it used colon as a separator.
> I made it more robust by using \001, which is legit POSIX AFAIK.
> 
> E.g. ./config --set-str CONFIG_USBNET_DEVADDR "de:ad:be:ef:00:01"
> failed with: sed: -e expression #1, char 55: unknown option to `s'
> 
> Signed-off-by: Jeremie Francois (on alpha) <jeremie.francois@...il.com>
> ---
>  scripts/config | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/scripts/config b/scripts/config
> index e0e39826dae9..d365081b60b2 100755
> --- a/scripts/config
> +++ b/scripts/config
> @@ -7,6 +7,9 @@ myname=${0##*/}
>  # If no prefix forced, use the default CONFIG_
>  CONFIG_="${CONFIG_-CONFIG_}"
>  
> +# We use an uncommon delimiter for sed substitutions
> +SED_DELIM=$(echo -en "\001")
> +
>  usage() {
>  	cat >&2 <<EOL
>  Manipulate options in a .config file from the command line.
> @@ -83,7 +86,7 @@ txt_subst() {
>  	local infile="$3"
>  	local tmpfile="$infile.swp"
>  
> -	sed -e "s:$before:$after:" "$infile" >"$tmpfile"
> +	sed -e "s$SED_DELIM$before$SED_DELIM$after$SED_DELIM" "$infile" >"$tmpfile"
>  	# replace original file with the edited one
>  	mv "$tmpfile" "$infile"
>  }
> 


-- 
~Randy

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ