On 03/31/17 at 12:01pm, Xunlei Pang wrote:
On 03/31/2017 at 11:51 AM, Dave Young wrote:
> On 03/31/17 at 11:44am, Xunlei Pang wrote:
>> On 03/31/2017 at 11:25 AM, Dave Young wrote:
>>> On 03/30/17 at 04:10pm, Xunlei Pang wrote:
>>>> For the following scripts:
>>>> cmdline="root=/dev/mapper/fedora-root rd.lvm.lv=fedora/root
rw"
>>>> remove_cmdline_param $cmdline "root"
>>>>
>>>> cmdline="root=nfs4:192.168.122.9:/ ip=ens3:dhcp rw"
>>>> remove_cmdline_param $cmdline "root"
>>>>
>>>> The current implementation will get the wrong results:
>>>> "rd.lvm.lv=fedora/ rw"
>>>> ":/ ip=ens3:dhcp rw"
>>>>
>>>> After this patch we can get the correct results:
>>>> "rd.lvm.lv=fedora/root rw"
>>>> "ip=ens3:dhcp rw"
>>>>
>>>> Signed-off-by: Xunlei Pang <xlpang(a)redhat.com>
>>>> ---
>>>> kdumpctl | 5 +++--
>>>> 1 file changed, 3 insertions(+), 2 deletions(-)
>>>>
>>>> diff --git a/kdumpctl b/kdumpctl
>>>> index 4d68be0..01a2ad8 100755
>>>> --- a/kdumpctl
>>>> +++ b/kdumpctl
>>>> @@ -68,8 +68,9 @@ remove_cmdline_param()
>>>>
>>>> for arg in $@; do
>>>> cmdline=`echo $cmdline | \
>>>> - sed -e "s/\b$arg=[^ ]*\b//g" \
>>>> - -e "s/\b$arg\b//g" \
>>>> + sed -e "s/\b$arg=[^ ]*//g" \
>>>> + -e "s/^$arg\b//g" \
>>>> + -e "s/[[:space:]]$arg\b//g" \
>>>> -e "s/\s\+/ /g"`
>>>> done
>>>> echo $cmdline
>>> Seems I got below:
>>> root=/dev/mapper/fedora-root rd.lvm.lv=fedora/root rw
>>> root rd.lvm.lv rw
>>> root=nfs4:192.168.122.9:/ ip=ens3:dhcp rw
>>> root:/ ip rw
>>>
>>>
>>> The test script like below:
>> I guess you missed arg="root"
> Oops, yes, I did not add arg= this time.. But even add it it is
> still below result about the nfs cmdline case:
> [arg=root]
> root=nfs4:192.168.122.9:/ ip=ens3:dhcp rw
> :/ ip=ens3:dhcp rw
>
> [arg=root=]
I think we only support passing "root" not "root=".
So from your test results, they are obviously wrong, that's why I modified it to be:
sed -e "s/\b$arg=[^ ]*//g" \
-e "s/^$arg\b//g" \
-e "s/[[:space:]]$arg\b//g" \
-e "s/\s\+/ /g"`
This version works, I tested wrong version :(
For the arg=root=, it is also clear per discussion in irc..
Thanks
Dave