Skip to content
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

libpriv/kargs: Copy libostree patch to support KEYWORD kargs #1796

Closed
wants to merge 6 commits into from

Conversation

jlebon
Copy link
Member

@jlebon jlebon commented Mar 21, 2019

This is essentially a copy of
ostreedev/ostree#1785 to our private copy of the
kargs API. Should really dedupe those...

The really confusing part though was that that patch was intended to fix
the rpm-ostree kargs --append EMPTYKEY= case (#1706), yet the
rpmostree kargs --append KEYWORD case (#1779) wasn't also fixed, even
though that same ostree patch clearly fixes and tests for that too.

To make a long story short, we were passing buggy kargs to ostree, which
before that patch, had itself buggy kargs parsing which conveniently
fixed back the kargs we passed for the KEYWORD case.

Closes: #1779

This is essentially a copy of
ostreedev/ostree#1785 to our private copy of the
kargs API. Should really dedupe those...

The really confusing part though was that that patch was intended to fix
the `rpm-ostree kargs --append EMPTYKEY=` case (coreos#1706), yet the
`rpmostree kargs --append KEYWORD` case (coreos#1779) wasn't also fixed, even
though that same ostree patch clearly fixes and tests for that too.

To make a long story short, we were passing buggy kargs to ostree, which
before that patch, had itself buggy kargs parsing which conveniently
fixed back the kargs we passed for the `KEYWORD` case.

Closes: coreos#1779
@jlebon
Copy link
Member Author

jlebon commented Mar 21, 2019

ostreedev/ostree#1833

@jlebon
Copy link
Member Author

jlebon commented Mar 21, 2019

Hmm OK, this is failing tests (I should probably have added some for this anyway). Will check tomorrow.

@lucab
Copy link
Contributor

lucab commented Mar 22, 2019

My bad for not realizing rpm-ostree has an internal copy of kargs.c. It looks this direct cherry-pick failed with a segfault.

That's the latest available in (f28, el8). Prep for using some new APIs
without tripping compiler warnings.
We don't need to modify the key we're passed, so just use `const`.
When we expect a test to not fail, let's `g_assert_no_error` first so
that if it fails, we get an exact printout of what error we encountered
when we expected none.
Note this patch only touches the *new* APIs that aren't part of
libostree.

Now that we can use `g_ptr_array_find_with_equal_func`, we can drop our
custom `_ostree_ptr_array_find`.

Also strengthen our handling of values everywhere to handle the `NULL`
case and properly support `KEYWORD` args. I ended up getting rid of
`_ostree_kernel_arg_query_status` in the process since it made that
assumption a lot and overall added more complexity than necessary.
@jlebon
Copy link
Member Author

jlebon commented Mar 22, 2019

My bad for not realizing rpm-ostree has an internal copy of kargs.c. It looks this direct cherry-pick failed with a segfault.

No worries! Honestly, I had forgotten myself when I started looking into #1779.

Anyway, the segfault was a symptom of the new APIs we have here that weren't ready to handle NULL in a bunch of places. I ended up reworking that a bit.

I started on ostreedev/ostree#1833 and upstreaming the new APIs here but don't have the cycles right now to add docstrings to every new API. Might get back to that later (though it'd be a good issue for someone who wanted to get familiar with the ostree <--> rpm-ostree interface!).

@cgwalters
Copy link
Member

@rh-atomic-bot r+ 71b976f

@rh-atomic-bot
Copy link

⌛ Testing commit 71b976f with merge 02b25c6...

rh-atomic-bot pushed a commit that referenced this pull request Mar 23, 2019
That's the latest available in (f28, el8). Prep for using some new APIs
without tripping compiler warnings.

Closes: #1796
Approved by: cgwalters
rh-atomic-bot pushed a commit that referenced this pull request Mar 23, 2019
We don't need to modify the key we're passed, so just use `const`.

Closes: #1796
Approved by: cgwalters
rh-atomic-bot pushed a commit that referenced this pull request Mar 23, 2019
When we expect a test to not fail, let's `g_assert_no_error` first so
that if it fails, we get an exact printout of what error we encountered
when we expected none.

Closes: #1796
Approved by: cgwalters
rh-atomic-bot pushed a commit that referenced this pull request Mar 23, 2019
Note this patch only touches the *new* APIs that aren't part of
libostree.

Now that we can use `g_ptr_array_find_with_equal_func`, we can drop our
custom `_ostree_ptr_array_find`.

Also strengthen our handling of values everywhere to handle the `NULL`
case and properly support `KEYWORD` args. I ended up getting rid of
`_ostree_kernel_arg_query_status` in the process since it made that
assumption a lot and overall added more complexity than necessary.

Closes: #1796
Approved by: cgwalters
@rh-atomic-bot
Copy link

☀️ Test successful - status-atomicjenkins
Approved by: cgwalters
Pushing 02b25c6 to master...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Kernel args without "=" getting "=" appended after using kargs
4 participants