-
Notifications
You must be signed in to change notification settings - Fork 266
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update all calls to add/replace_grub_cmdline_settings #8727
Update all calls to add/replace_grub_cmdline_settings #8727
Conversation
@wjn740 thanks, acked. But, can you, please, do one verify run? (it's obviously ok, but we've done some breaks in the past :)). |
@@ -50,7 +50,7 @@ sub run { | |||
assert_script_run "setfattr -x security.ima $sample_app"; | |||
validate_script_output "getfattr -m security.evm -d $sample_app", sub { m/^$/ }; | |||
|
|||
replace_grub_cmdline_settings('evm=fix ima_appraise=fix', '', 1); | |||
replace_grub_cmdline_settings('evm=fix ima_appraise=fix', '', update_grub => 1); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
BTW I wonder if it work as
replace_grub_cmdline_settings('evm=fix ima_appraise=fix', update_grub => 1);
i.e. having $new
as undef
. It'd probably introduce a warning, there would need to be added support for it in change_grub_config()
. And explicitly set new as ''
is more readable.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sorry, the first two parameters are fixed, you should pass them. can not ignore. user need to make sure $old, $new is not undef, I think.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
1029 sub change_grub_config {
1030 die((caller(0))[3] . ' expects from 3 to 5 arguments') unless (@_ >= 3 && @_ <= 5);
1031 my ($old, $new, $search, $modifiers, $update_grub) = @_;
1032 $modifiers //= '';
1033 $update_grub //= 0;
+ 1034 $new //= '';
1035 $search = "/$search/" if defined $search;
1036
1037 assert_script_run("sed -ie '${search}s/${old}/${new}/${modifiers}' " . GRUB_DEFAULT_FILE);
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, that's exactly what I meant (+ mention it in perldoc and commit message).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
http://10.67.134.217/tests/5372#step/sestatus/37
@jouyingbin Please take a look about the grub operation.
Huh? Why would I say that? |
OK. |
You: Not worth of arguing (long time ago, maybe I didn't understand you at the time), I just stop adding |
ok, that wasnt' meant as a general rule though. |
OK, thanks for explanation :) |
3dce103
to
7c2b01b
Compare
lib/bootloader_setup.pm
Outdated
@@ -1022,6 +1022,7 @@ sub grep_grub_cmdline_settings { | |||
change_grub_config($old, $new [, $search ] [, $modifiers ], [, $update_grub ]); | |||
|
|||
Replace C<$old> with C<$new> in /etc/default/grub, using sed. | |||
C<$new> will be keep '' null string when it is undef. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd define it as: C<$new>, default empty string
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
@@ -50,7 +50,7 @@ sub run { | |||
assert_script_run "setfattr -x security.ima $sample_app"; | |||
validate_script_output "getfattr -m security.evm -d $sample_app", sub { m/^$/ }; | |||
|
|||
replace_grub_cmdline_settings('evm=fix ima_appraise=fix', '', 1); | |||
replace_grub_cmdline_settings('evm=fix ima_appraise=fix', '', update_grub => 1); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd remove '',
as it's now not needed :).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
copy that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@pevik Hi sir, why this ''
, is not needed,
1087 sub replace_grub_cmdline_settings {
1088 my $old = shift;
1089 my $new = shift;
1090 my %args = testapi::compat_args(
1091 {
1092 old => $old,
1093 new => $new,
1094 update_grub => 0,
1095 search => get_cmdline_var(),
1096 }, ['old', 'new', 'update_grub', 'search'], @_);
1097 change_grub_config($old, $new, $args{search}, "g", $args{update_grub});
1098 }
if remove it, line 1089, what will do ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sorry, Just a little bit confuse this in my brain, ...
Hi James, BTW, it is close to sle12sp5 GMC hope this PR can be resolved asap. |
|
I would like to give you changes an "approval". |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I only checked the "security test cases" related changes and the changes lgtm.
f437874
to
e07379c
Compare
@wjn740 |
Sorry for my English. I have updated the code, now. |
There are more verifications: |
@wjn740 |
@lilyeyes it haven't been merged yet, so nothing to be reverted yet :). |
She means revert 5362a6a commit 5362a6a (origin/jnwang/add_gurb_xen_support, jnwang/add_gurb_xen_support)
|
e07379c
to
0b49752
Compare
Thanks for the replying I do not mean |
There is another verification: |
I just check the verification run looks good to me, |
I modified all add/replace_grub_cmdline_settings function prototype. It blocked some testings like 'security'. I update all 'calls' where that want update config in time.
0b49752
to
f3c5958
Compare
I don't know them before @lilyeyes told me. ;-) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. Thanks for the changes. :-)
I modified all add/replace_grub_cmdline_settings function prototype.
It blocked some testings like 'security'. I update all 'calls' where that want to update
config in time.
@pevik @asmorodskyi @jouyingbin
Signed-off-by: James Wang jnwang@suse.com