get_option_value() is used to get the value of $1 configured in /etc/kdump.conf. But when we use "get_option_value ssh", it can get the value of "sshkey" instead of "ssh".
Fix it by adding "-w" option to grep to get the match for the exact word.
Signed-off-by: WANG Chao chaowang@redhat.com --- kdump-lib.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/kdump-lib.sh b/kdump-lib.sh index a20c6e8..df080e5 100755 --- a/kdump-lib.sh +++ b/kdump-lib.sh @@ -109,7 +109,7 @@ get_mntpoint_from_target() # get_option_value <option_name> # retrieves value of option defined in kdump.conf get_option_value() { - echo $(strip_comments `grep ^$1 /etc/kdump.conf | tail -1 | cut -d\ -f2-`) + echo $(strip_comments `grep -w ^$1 /etc/kdump.conf | tail -1 | cut -d\ -f2-`) }
#This function compose a absolute path with the mount
On 10/20/14 at 12:56pm, WANG Chao wrote:
get_option_value() is used to get the value of $1 configured in /etc/kdump.conf. But when we use "get_option_value ssh", it can get the value of "sshkey" instead of "ssh".
Fix it by adding "-w" option to grep to get the match for the exact word.
Seems it will print the line with '-', who knows if we will add option with such character or not in the future...
bash-4.2$ cat kdump.conf ssh-key bash-4.2$ grep -w ^ssh kdump.conf ssh-key
Signed-off-by: WANG Chao chaowang@redhat.com
kdump-lib.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/kdump-lib.sh b/kdump-lib.sh index a20c6e8..df080e5 100755 --- a/kdump-lib.sh +++ b/kdump-lib.sh @@ -109,7 +109,7 @@ get_mntpoint_from_target() # get_option_value <option_name> # retrieves value of option defined in kdump.conf get_option_value() {
- echo $(strip_comments `grep ^$1 /etc/kdump.conf | tail -1 | cut -d\ -f2-`)
- echo $(strip_comments `grep -w ^$1 /etc/kdump.conf | tail -1 | cut -d\ -f2-`)
}
#This function compose a absolute path with the mount
1.9.3
kexec mailing list kexec@lists.fedoraproject.org https://lists.fedoraproject.org/mailman/listinfo/kexec
On 10/23/14 at 01:51pm, Dave Young wrote:
On 10/20/14 at 12:56pm, WANG Chao wrote:
get_option_value() is used to get the value of $1 configured in /etc/kdump.conf. But when we use "get_option_value ssh", it can get the value of "sshkey" instead of "ssh".
Fix it by adding "-w" option to grep to get the match for the exact word.
Seems it will print the line with '-', who knows if we will add option with such character or not in the future...
bash-4.2$ cat kdump.conf ssh-key bash-4.2$ grep -w ^ssh kdump.conf ssh-key
Maybe we can specify the ssh filter following to avoid conflict.
get_option_value "ssh[[:blank:]].*@"
We can make more exactly filter to correct the result in the future.
Signed-off-by: WANG Chao chaowang@redhat.com
kdump-lib.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/kdump-lib.sh b/kdump-lib.sh index a20c6e8..df080e5 100755 --- a/kdump-lib.sh +++ b/kdump-lib.sh @@ -109,7 +109,7 @@ get_mntpoint_from_target() # get_option_value <option_name> # retrieves value of option defined in kdump.conf get_option_value() {
- echo $(strip_comments `grep ^$1 /etc/kdump.conf | tail -1 | cut -d\ -f2-`)
- echo $(strip_comments `grep -w ^$1 /etc/kdump.conf | tail -1 | cut -d\ -f2-`)
}
#This function compose a absolute path with the mount
1.9.3
kexec mailing list kexec@lists.fedoraproject.org https://lists.fedoraproject.org/mailman/listinfo/kexec
kexec mailing list kexec@lists.fedoraproject.org https://lists.fedoraproject.org/mailman/listinfo/kexec
On 10/23/14 at 02:22pm, Minfei Huang wrote:
On 10/23/14 at 01:51pm, Dave Young wrote:
On 10/20/14 at 12:56pm, WANG Chao wrote:
get_option_value() is used to get the value of $1 configured in /etc/kdump.conf. But when we use "get_option_value ssh", it can get the value of "sshkey" instead of "ssh".
Fix it by adding "-w" option to grep to get the match for the exact word.
Seems it will print the line with '-', who knows if we will add option with such character or not in the future...
bash-4.2$ cat kdump.conf ssh-key bash-4.2$ grep -w ^ssh kdump.conf ssh-key
Maybe we can specify the ssh filter following to avoid conflict.
get_option_value "ssh[[:blank:]].*@"
Wrong. get_option_value() should be a simple interface to use:
get_option_value ssh -> ssh host dump target get_option_value sshkey -> ssh key
Thanks WANG Chao
On 10/23/14 at 01:51pm, Dave Young wrote:
On 10/20/14 at 12:56pm, WANG Chao wrote:
get_option_value() is used to get the value of $1 configured in /etc/kdump.conf. But when we use "get_option_value ssh", it can get the value of "sshkey" instead of "ssh".
Fix it by adding "-w" option to grep to get the match for the exact word.
Seems it will print the line with '-', who knows if we will add option with such character or not in the future...
bash-4.2$ cat kdump.conf ssh-key bash-4.2$ grep -w ^ssh kdump.conf ssh-key
Then we should probably add something like "foo-bar". Given the fact that we use "dracut_args" not "dracut-args", I'd prefer not use "foo-bar" format at all.
Say some one wants to add "foo-bar", he should fix get_option_value() to adapt to his change.
Thanks WANG Chao
Signed-off-by: WANG Chao chaowang@redhat.com
kdump-lib.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/kdump-lib.sh b/kdump-lib.sh index a20c6e8..df080e5 100755 --- a/kdump-lib.sh +++ b/kdump-lib.sh @@ -109,7 +109,7 @@ get_mntpoint_from_target() # get_option_value <option_name> # retrieves value of option defined in kdump.conf get_option_value() {
- echo $(strip_comments `grep ^$1 /etc/kdump.conf | tail -1 | cut -d\ -f2-`)
- echo $(strip_comments `grep -w ^$1 /etc/kdump.conf | tail -1 | cut -d\ -f2-`)
}
#This function compose a absolute path with the mount
1.9.3
kexec mailing list kexec@lists.fedoraproject.org https://lists.fedoraproject.org/mailman/listinfo/kexec
Hi,
Since we are fixing it, I would say let's match it exactly, '-w' is not proper way IMHO. Suppose user specify 'ssh-' as a typo...
[I can not find your message in mutt, thus reply with webmail :(]
----- Original Message ----- From: "WANG Chao" chaowang@redhat.com To: "Dave Young" dyoung@redhat.com Cc: kexec@lists.fedoraproject.org Sent: Friday, October 24, 2014 11:11:05 AM Subject: Re: [PATCH] kdump-lib: fix get_option_value()
On 10/23/14 at 01:51pm, Dave Young wrote:
On 10/20/14 at 12:56pm, WANG Chao wrote:
get_option_value() is used to get the value of $1 configured in /etc/kdump.conf. But when we use "get_option_value ssh", it can get the value of "sshkey" instead of "ssh".
Fix it by adding "-w" option to grep to get the match for the exact word.
Seems it will print the line with '-', who knows if we will add option with such character or not in the future...
bash-4.2$ cat kdump.conf ssh-key bash-4.2$ grep -w ^ssh kdump.conf ssh-key
Then we should probably add something like "foo-bar". Given the fact that we use "dracut_args" not "dracut-args", I'd prefer not use "foo-bar" format at all.
Say some one wants to add "foo-bar", he should fix get_option_value() to adapt to his change.
Thanks WANG Chao
Signed-off-by: WANG Chao chaowang@redhat.com
kdump-lib.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/kdump-lib.sh b/kdump-lib.sh index a20c6e8..df080e5 100755 --- a/kdump-lib.sh +++ b/kdump-lib.sh @@ -109,7 +109,7 @@ get_mntpoint_from_target() # get_option_value <option_name> # retrieves value of option defined in kdump.conf get_option_value() {
- echo $(strip_comments `grep ^$1 /etc/kdump.conf | tail -1 | cut -d\ -f2-`)
- echo $(strip_comments `grep -w ^$1 /etc/kdump.conf | tail -1 | cut -d\ -f2-`)
}
#This function compose a absolute path with the mount
1.9.3
kexec mailing list kexec@lists.fedoraproject.org https://lists.fedoraproject.org/mailman/listinfo/kexec
_______________________________________________ kexec mailing list kexec@lists.fedoraproject.org https://lists.fedoraproject.org/mailman/listinfo/kexec
On 10/24/14 at 03:12am, Dave Young wrote:
Hi,
Since we are fixing it, I would say let's match it exactly, '-w' is not proper way IMHO. Suppose user specify 'ssh-' as a typo...
The thing is -w exactly matches the currently kdump.conf.
We've already have some santiy check for valid options in /usr/bin/kdumpctl. We've already assumed that all the options in /etc/kdump.conf is at least correctly formed in mkdumprd and dracut-module-setup.sh.
[I can not find your message in mutt, thus reply with webmail :(]
----- Original Message ----- From: "WANG Chao" chaowang@redhat.com To: "Dave Young" dyoung@redhat.com Cc: kexec@lists.fedoraproject.org Sent: Friday, October 24, 2014 11:11:05 AM Subject: Re: [PATCH] kdump-lib: fix get_option_value()
On 10/23/14 at 01:51pm, Dave Young wrote:
On 10/20/14 at 12:56pm, WANG Chao wrote:
get_option_value() is used to get the value of $1 configured in /etc/kdump.conf. But when we use "get_option_value ssh", it can get the value of "sshkey" instead of "ssh".
Fix it by adding "-w" option to grep to get the match for the exact word.
Seems it will print the line with '-', who knows if we will add option with such character or not in the future...
bash-4.2$ cat kdump.conf ssh-key bash-4.2$ grep -w ^ssh kdump.conf ssh-key
Then we should probably add something like "foo-bar". Given the fact that we use "dracut_args" not "dracut-args", I'd prefer not use "foo-bar" format at all.
Say some one wants to add "foo-bar", he should fix get_option_value() to adapt to his change.
Thanks WANG Chao
Signed-off-by: WANG Chao chaowang@redhat.com
kdump-lib.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/kdump-lib.sh b/kdump-lib.sh index a20c6e8..df080e5 100755 --- a/kdump-lib.sh +++ b/kdump-lib.sh @@ -109,7 +109,7 @@ get_mntpoint_from_target() # get_option_value <option_name> # retrieves value of option defined in kdump.conf get_option_value() {
- echo $(strip_comments `grep ^$1 /etc/kdump.conf | tail -1 | cut -d\ -f2-`)
- echo $(strip_comments `grep -w ^$1 /etc/kdump.conf | tail -1 | cut -d\ -f2-`)
}
#This function compose a absolute path with the mount
1.9.3
kexec mailing list kexec@lists.fedoraproject.org https://lists.fedoraproject.org/mailman/listinfo/kexec
kexec mailing list kexec@lists.fedoraproject.org https://lists.fedoraproject.org/mailman/listinfo/kexec
Sorry, it does not convince me, it does not matches the string we put in argument, also from unit test point of view we should do it better consider it's not hard to do it better...
----- Original Message ----- From: "WANG Chao" chaowang@redhat.com To: "Dave Young" dyoung@redhat.com Cc: kexec@lists.fedoraproject.org Sent: Friday, October 24, 2014 3:35:09 PM Subject: Re: [PATCH] kdump-lib: fix get_option_value()
On 10/24/14 at 03:12am, Dave Young wrote:
Hi,
Since we are fixing it, I would say let's match it exactly, '-w' is not proper way IMHO. Suppose user specify 'ssh-' as a typo...
The thing is -w exactly matches the currently kdump.conf.
We've already have some santiy check for valid options in /usr/bin/kdumpctl. We've already assumed that all the options in /etc/kdump.conf is at least correctly formed in mkdumprd and dracut-module-setup.sh.
[I can not find your message in mutt, thus reply with webmail :(]
----- Original Message ----- From: "WANG Chao" chaowang@redhat.com To: "Dave Young" dyoung@redhat.com Cc: kexec@lists.fedoraproject.org Sent: Friday, October 24, 2014 11:11:05 AM Subject: Re: [PATCH] kdump-lib: fix get_option_value()
On 10/23/14 at 01:51pm, Dave Young wrote:
On 10/20/14 at 12:56pm, WANG Chao wrote:
get_option_value() is used to get the value of $1 configured in /etc/kdump.conf. But when we use "get_option_value ssh", it can get the value of "sshkey" instead of "ssh".
Fix it by adding "-w" option to grep to get the match for the exact word.
Seems it will print the line with '-', who knows if we will add option with such character or not in the future...
bash-4.2$ cat kdump.conf ssh-key bash-4.2$ grep -w ^ssh kdump.conf ssh-key
Then we should probably add something like "foo-bar". Given the fact that we use "dracut_args" not "dracut-args", I'd prefer not use "foo-bar" format at all.
Say some one wants to add "foo-bar", he should fix get_option_value() to adapt to his change.
Thanks WANG Chao
Signed-off-by: WANG Chao chaowang@redhat.com
kdump-lib.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/kdump-lib.sh b/kdump-lib.sh index a20c6e8..df080e5 100755 --- a/kdump-lib.sh +++ b/kdump-lib.sh @@ -109,7 +109,7 @@ get_mntpoint_from_target() # get_option_value <option_name> # retrieves value of option defined in kdump.conf get_option_value() {
- echo $(strip_comments `grep ^$1 /etc/kdump.conf | tail -1 | cut -d\ -f2-`)
- echo $(strip_comments `grep -w ^$1 /etc/kdump.conf | tail -1 | cut -d\ -f2-`)
}
#This function compose a absolute path with the mount
1.9.3
kexec mailing list kexec@lists.fedoraproject.org https://lists.fedoraproject.org/mailman/listinfo/kexec
kexec mailing list kexec@lists.fedoraproject.org https://lists.fedoraproject.org/mailman/listinfo/kexec
_______________________________________________ kexec mailing list kexec@lists.fedoraproject.org https://lists.fedoraproject.org/mailman/listinfo/kexec
Hi Chao,
I like the idea of matching it exactly. So why do we need a new option. Why not change the default behavoior of get_option_value() to always return value only if it matches exact word.
Thanks Vivek
On Fri, Oct 24, 2014 at 03:12:02AM -0400, Dave Young wrote:
Hi,
Since we are fixing it, I would say let's match it exactly, '-w' is not proper way IMHO. Suppose user specify 'ssh-' as a typo...
[I can not find your message in mutt, thus reply with webmail :(]
----- Original Message ----- From: "WANG Chao" chaowang@redhat.com To: "Dave Young" dyoung@redhat.com Cc: kexec@lists.fedoraproject.org Sent: Friday, October 24, 2014 11:11:05 AM Subject: Re: [PATCH] kdump-lib: fix get_option_value()
On 10/23/14 at 01:51pm, Dave Young wrote:
On 10/20/14 at 12:56pm, WANG Chao wrote:
get_option_value() is used to get the value of $1 configured in /etc/kdump.conf. But when we use "get_option_value ssh", it can get the value of "sshkey" instead of "ssh".
Fix it by adding "-w" option to grep to get the match for the exact word.
Seems it will print the line with '-', who knows if we will add option with such character or not in the future...
bash-4.2$ cat kdump.conf ssh-key bash-4.2$ grep -w ^ssh kdump.conf ssh-key
Then we should probably add something like "foo-bar". Given the fact that we use "dracut_args" not "dracut-args", I'd prefer not use "foo-bar" format at all.
Say some one wants to add "foo-bar", he should fix get_option_value() to adapt to his change.
Thanks WANG Chao
Signed-off-by: WANG Chao chaowang@redhat.com
kdump-lib.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/kdump-lib.sh b/kdump-lib.sh index a20c6e8..df080e5 100755 --- a/kdump-lib.sh +++ b/kdump-lib.sh @@ -109,7 +109,7 @@ get_mntpoint_from_target() # get_option_value <option_name> # retrieves value of option defined in kdump.conf get_option_value() {
- echo $(strip_comments `grep ^$1 /etc/kdump.conf | tail -1 | cut -d\ -f2-`)
- echo $(strip_comments `grep -w ^$1 /etc/kdump.conf | tail -1 | cut -d\ -f2-`)
}
#This function compose a absolute path with the mount
1.9.3
kexec mailing list kexec@lists.fedoraproject.org https://lists.fedoraproject.org/mailman/listinfo/kexec
kexec mailing list kexec@lists.fedoraproject.org https://lists.fedoraproject.org/mailman/listinfo/kexec
kexec mailing list kexec@lists.fedoraproject.org https://lists.fedoraproject.org/mailman/listinfo/kexec