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

core: Strengthen how we enforce lockfiles #1849

Closed
wants to merge 4 commits into from

Conversation

jlebon
Copy link
Member

@jlebon jlebon commented Jun 5, 2019

One problem with how we use lockfiles right now is that we don't enforce
them for dependencies. That is, if foo requires bar, but only foo
is in the manifest, then while foo will be locked, bar will never
be checked against the lockfile because it was never explicitly
requested.

Higher-level though, I don't like how indirect the locking here feels.
See some comments about that in:

#1745 (comment)
#1745 (comment)

Essentially, the manifest is an input file of patterns, and all we
really know from the lockfile output is that the set of packages in
there satisfies this input in some way. But:

  1. there are multiple ways to satisfy the same input (hence why hints
    like SOLVER_FAVOR exist)
  2. the solution is dependent on how the solver is implemented (i.e.
    different libsolv versions might yield different solutions)
  3. the solution is dependent on flags fed to the solver (i.e. different
    libdnf versions might yield different solutions)

So any attempt at cross-checking between the input file and the lockfile
is going to be very hard. Using a stricter mode as I suggested in #1745
of only allowing pure pkgnames or NEVRAs would help, but it wouldn't
address the dependency issue. (Though I'm still thinking about possibly
doing this anyway.)

The solution I propose here is instead to take the nuclear approach: we
completely exclude from the sack all packages of the same name as
packages in our lockfiles, but which do not match the NEVRA. Therefore,
any possible solution has to also satisfy our lockfile (or error out).

jlebon added 3 commits June 5, 2019 14:59
It's nicer to read/less verbose.
We no longer tell libdnf to add the pkg to the goal until later (because
of rpm-software-management/libdnf#700). Just
tweak those comments to be more explicit about that.
One problem with how we use lockfiles right now is that we don't enforce
them for dependencies. That is, if `foo` requires `bar`, but only `foo`
is in the manifest, then while `foo` will be locked, `bar` will never
be checked against the lockfile because it was never explicitly
requested.

Higher-level though, I don't like how indirect the locking here feels.
See some comments about that in:

coreos#1745 (comment)
coreos#1745 (comment)

Essentially, the manifest is an input file of patterns, and all we
really know from the lockfile output is that the set of packages in
there satisfies this input in some way. But:

1. there are multiple ways to satisfy the same input (hence why hints
   like `SOLVER_FAVOR` exist)
2. the solution is dependent on how the solver is implemented (i.e.
   different libsolv versions might yield different solutions)
3. the solution is dependent on flags fed to the solver (i.e. different
   libdnf versions might yield different solutions)

So any attempt at cross-checking between the input file and the lockfile
is going to be very hard. Using a stricter mode as I suggested in coreos#1745
of only allowing pure pkgnames or NEVRAs would help, but it wouldn't
address the dependency issue. (Though I'm still thinking about possibly
doing this anyway.)

The solution I propose here is instead to take the nuclear approach: we
completely exclude from the sack all packages of the same name as
packages in our lockfiles, but which do not match the NEVRA. Therefore,
any possible solution has to also satisfy our lockfile (or error out).
Copy link
Member

@cgwalters cgwalters left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CRITICAL BUGS FOUND ABORT ABORT

(OK more seriously looks great 😉 Just mostly proving I read the code 😄 )

src/libpriv/rpmostree-core.c Outdated Show resolved Hide resolved
src/libpriv/rpmostree-core.c Outdated Show resolved Hide resolved
src/libpriv/rpmostree-core.c Show resolved Hide resolved
@jlebon
Copy link
Member Author

jlebon commented Jun 6, 2019

Bugs fixed; maintain course! 🚀

@cgwalters
Copy link
Member

@rh-atomic-bot r+ bc35651

@cgwalters cgwalters closed this Jun 6, 2019
@cgwalters cgwalters reopened this Jun 6, 2019
rh-atomic-bot pushed a commit that referenced this pull request Jun 6, 2019
It's nicer to read/less verbose.

Closes: #1849
Approved by: cgwalters
rh-atomic-bot pushed a commit that referenced this pull request Jun 6, 2019
We no longer tell libdnf to add the pkg to the goal until later (because
of rpm-software-management/libdnf#700). Just
tweak those comments to be more explicit about that.

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

⌛ Testing commit bc35651 with merge 24b6916...

rh-atomic-bot pushed a commit that referenced this pull request Jun 6, 2019
One problem with how we use lockfiles right now is that we don't enforce
them for dependencies. That is, if `foo` requires `bar`, but only `foo`
is in the manifest, then while `foo` will be locked, `bar` will never
be checked against the lockfile because it was never explicitly
requested.

Higher-level though, I don't like how indirect the locking here feels.
See some comments about that in:

#1745 (comment)
#1745 (comment)

Essentially, the manifest is an input file of patterns, and all we
really know from the lockfile output is that the set of packages in
there satisfies this input in some way. But:

1. there are multiple ways to satisfy the same input (hence why hints
   like `SOLVER_FAVOR` exist)
2. the solution is dependent on how the solver is implemented (i.e.
   different libsolv versions might yield different solutions)
3. the solution is dependent on flags fed to the solver (i.e. different
   libdnf versions might yield different solutions)

So any attempt at cross-checking between the input file and the lockfile
is going to be very hard. Using a stricter mode as I suggested in #1745
of only allowing pure pkgnames or NEVRAs would help, but it wouldn't
address the dependency issue. (Though I'm still thinking about possibly
doing this anyway.)

The solution I propose here is instead to take the nuclear approach: we
completely exclude from the sack all packages of the same name as
packages in our lockfiles, but which do not match the NEVRA. Therefore,
any possible solution has to also satisfy our lockfile (or error out).

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

⌛ Testing commit bc35651 with merge 744be60...

rh-atomic-bot pushed a commit that referenced this pull request Jun 6, 2019
It's nicer to read/less verbose.

Closes: #1849
Approved by: cgwalters
rh-atomic-bot pushed a commit that referenced this pull request Jun 6, 2019
We no longer tell libdnf to add the pkg to the goal until later (because
of rpm-software-management/libdnf#700). Just
tweak those comments to be more explicit about that.

Closes: #1849
Approved by: cgwalters
rh-atomic-bot pushed a commit that referenced this pull request Jun 6, 2019
One problem with how we use lockfiles right now is that we don't enforce
them for dependencies. That is, if `foo` requires `bar`, but only `foo`
is in the manifest, then while `foo` will be locked, `bar` will never
be checked against the lockfile because it was never explicitly
requested.

Higher-level though, I don't like how indirect the locking here feels.
See some comments about that in:

#1745 (comment)
#1745 (comment)

Essentially, the manifest is an input file of patterns, and all we
really know from the lockfile output is that the set of packages in
there satisfies this input in some way. But:

1. there are multiple ways to satisfy the same input (hence why hints
   like `SOLVER_FAVOR` exist)
2. the solution is dependent on how the solver is implemented (i.e.
   different libsolv versions might yield different solutions)
3. the solution is dependent on flags fed to the solver (i.e. different
   libdnf versions might yield different solutions)

So any attempt at cross-checking between the input file and the lockfile
is going to be very hard. Using a stricter mode as I suggested in #1745
of only allowing pure pkgnames or NEVRAs would help, but it wouldn't
address the dependency issue. (Though I'm still thinking about possibly
doing this anyway.)

The solution I propose here is instead to take the nuclear approach: we
completely exclude from the sack all packages of the same name as
packages in our lockfiles, but which do not match the NEVRA. Therefore,
any possible solution has to also satisfy our lockfile (or error out).

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

💔 Test failed - status-atomicjenkins

@jlebon
Copy link
Member Author

jlebon commented Jun 6, 2019

@rh-atomic-bot retry

rh-atomic-bot pushed a commit that referenced this pull request Jun 6, 2019
We no longer tell libdnf to add the pkg to the goal until later (because
of rpm-software-management/libdnf#700). Just
tweak those comments to be more explicit about that.

Closes: #1849
Approved by: cgwalters
rh-atomic-bot pushed a commit that referenced this pull request Jun 6, 2019
One problem with how we use lockfiles right now is that we don't enforce
them for dependencies. That is, if `foo` requires `bar`, but only `foo`
is in the manifest, then while `foo` will be locked, `bar` will never
be checked against the lockfile because it was never explicitly
requested.

Higher-level though, I don't like how indirect the locking here feels.
See some comments about that in:

#1745 (comment)
#1745 (comment)

Essentially, the manifest is an input file of patterns, and all we
really know from the lockfile output is that the set of packages in
there satisfies this input in some way. But:

1. there are multiple ways to satisfy the same input (hence why hints
   like `SOLVER_FAVOR` exist)
2. the solution is dependent on how the solver is implemented (i.e.
   different libsolv versions might yield different solutions)
3. the solution is dependent on flags fed to the solver (i.e. different
   libdnf versions might yield different solutions)

So any attempt at cross-checking between the input file and the lockfile
is going to be very hard. Using a stricter mode as I suggested in #1745
of only allowing pure pkgnames or NEVRAs would help, but it wouldn't
address the dependency issue. (Though I'm still thinking about possibly
doing this anyway.)

The solution I propose here is instead to take the nuclear approach: we
completely exclude from the sack all packages of the same name as
packages in our lockfiles, but which do not match the NEVRA. Therefore,
any possible solution has to also satisfy our lockfile (or error out).

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

⌛ Testing commit bc35651 with merge c1cc082...

@rh-atomic-bot
Copy link

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

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

Successfully merging this pull request may close these issues.

3 participants