fix the mistake of swapping function parameters of read_proc_environ_var
_is_osbuild fails because it expects the 1st and 2nd function parameter
to be the environment variable and environ file path respectively. Fix
it by swapping the parameters in read_proc_environ_var.
Note the osbuild environ file path is defined in _OSBUILD_ENVIRON_PATH
so _is_osbuild can be unit-tested by overwriting _OSBUILD_ENVIRON_PATH.
Fixes: 6a3ce83
("fix the error of parsing the container environ variable for osbuild")
Signed-off-by: Coiby Xu <coxu@redhat.com>
Reviewed-by: Pingfan Liu <piliu@redhat.com>
This commit is contained in:
parent
d6298a1dec
commit
5111c01334
8
kdumpctl
8
kdumpctl
@ -1580,15 +1580,19 @@ reset_crashkernel_after_update()
|
||||
#
|
||||
# The environment variable entries in /proc/[pid]/environ are separated
|
||||
# by null bytes instead of by spaces.
|
||||
#
|
||||
# $1: environment variable
|
||||
# $2: environ file path
|
||||
read_proc_environ_var()
|
||||
{
|
||||
local _environ_path=$1 _var=$2
|
||||
local _var=$1 _environ_path=$2
|
||||
sed -n -E "s/.*(^|\x00)${_var}=([^\x00]*).*/\2/p" < "$_environ_path"
|
||||
}
|
||||
|
||||
_OSBUILD_ENVIRON_PATH='/proc/1/environ'
|
||||
_is_osbuild()
|
||||
{
|
||||
[[ $(read_proc_environ_var container /proc/1/environ) == bwrap-osbuild ]]
|
||||
[[ $(read_proc_environ_var container "$_OSBUILD_ENVIRON_PATH") == bwrap-osbuild ]]
|
||||
}
|
||||
|
||||
reset_crashkernel_for_installed_kernel()
|
||||
|
Loading…
Reference in New Issue
Block a user