83 Commits (c66bb0b1d06454cb73e6cd65b6be470417fae5ff)

Author SHA1 Message Date
Nils Adermann 6b2edeae56 Fix solver problem exceptions with unexpected contradictory "Conclusions"
This 5 character fix comes with a solver test as well as a functional
installer test essentially verifying the same thing. The solver test is
more useful when working on the solver. But the functional test is less
likely to be accidentally modified incorrectly during refactoring, as
every single package, version and link in the rather complex test
scenario is essential, and a modified version of the test may very well
still result in a successful installation but no longer verify the bug
described below.

Background:

In commit 451bab1c2c from May 19, 2012 I
refactored literals from complex objects into pure integers to reduce
memory consumption. The absolute value of an integer literal is the id
of the package it refers to in the package pool. The sign indicates
whether the package should be installed (positive) or removed (negative),

So a major part of the refactoring was swapping this call:

$literal->getPackageId()

For this:

abs($literal)

Unintentionally in line 554/523 I incorrectly applied this change to the
line:

$this->literalFromId(-$literal->getPackageId());

It was converted to:

-abs($literal);

The function literalFromId used to create a new literal object. By using
the abs() function this change essentially forces the resulting literal
to be negative, while the minus sign previously inverted the literal, so
positive into negative and vice versa.

This particular line is in a function meant to analyze a conflicting
decision during dependency resolution and to draw a conclusion from it,
then revert the state of the solver to an earlier position, and attempt
to solve the rest of the rules again with this new "learned" conclusion.

Because of this bug these conclusions could only ever occur in the
negative, e.g. "don't install package X". This is by far the most likely
scenario when the solver reaches this particular line, but there are
exceptions.

If you experienced a solver problem description that contained a
statement like "Conclusion: don't install vendor/package 1.2.3" which
directly contradicted other statements listed as part of the problem,
this could likely have been the cause.
5 years ago
Gabriel Caruso 2a13bb2649 Fixes from PHPStan (#7687)
* fix docblocks

* remove redundant conditional

* fix wrong variable name

* fix wrong namespaces

* add missing private members

* remove unused/redundant arguments

* move testcase class

* exclude TestCase.php

* Tweak RuleWatchGraph type hints

* Tweak doc comment
6 years ago
Gabriel Caruso a4b220273e Refactoring Tests (#6849) 7 years ago
Nils Adermann 7dffe79a0f Update tests of solver problem message to match new message 7 years ago
Jordi Boggiano 122e422682 CS fixes 7 years ago
Niels Keurentjes 8e78ce9a43 Add extra logging before and after SAT solving 8 years ago
Jefferson Carpenter b7845bb6c0 Update SolverTest.php 9 years ago
Rob Bast b523fc0b7b ran fixers 9 years ago
Jordi Boggiano ce08582671 Fix CS 9 years ago
Rob Bast a1427d7fd6 replace all occurences in code and comments 9 years ago
Possum 2e99b9fdf5 Use https where possible 9 years ago
Jordi Boggiano 94926218e8 CS fixes 10 years ago
Nils Adermann 5b80144ad0 Resolve job packages after whitelist generation 11 years ago
Nils Adermann 3148ffd355 Whitelist packages with names matching those specified before generating rules
Addresses #2690 doesn't do any performance optimisations yet which we
could do now
11 years ago
Jordi Boggiano 38917c2047 Add parallel build to travis script 11 years ago
Jordi Boggiano 051d219438 Fix whatProvides returning too many results when no constraint is given 11 years ago
Jordi Boggiano cc9dac8fe2 Fix tests and convert all package lists to Name[Versions] format 11 years ago
Robert Gruendler 5160dd2f5e Return different error code for SolverProblemsException
To make it easier for external tools to detect SolverProblems and react
to them accordingly,
this PR introduces a new exit code.
11 years ago
Jordi Boggiano 1c39ad779b Fix wording 12 years ago
Jordi Boggiano 5d78fa6ce6 Report typos in package name if no version matches 12 years ago
Jordi Boggiano beb9a5bd72 Code optimizations: avoid loops in match() 12 years ago
Jordi Boggiano fb4183d5ad Fix tests 12 years ago
Jordi Boggiano d4aab7d5b6 Fix solver test 12 years ago
Jordi Boggiano 6573fd3f77 Add hint in solver exceptions as to what may be wrong 12 years ago
Jordi Boggiano 175d1939b5 Fix tests 12 years ago
Jordi Boggiano 4fcc114f97 Merge pull request #808 from palex-fpt/not-equal-operator
Add '<>' operator to Version Parser
12 years ago
Nils Adermann cc7632489d Make problem report messages more readable
Added pretty strings to constraints
12 years ago
Alexey Prilipko e130386612 Add '<>' operator for Version Parser 12 years ago
Grégoire Pineau f4e9dd4fb8 Fixed PSR rules 12 years ago
Nils Adermann a08c2a0b9f Corrected altered error message in test 12 years ago
Nils Adermann 67fde90666 Correctly sort operations within transactions using DFS
Fixes #655
12 years ago
Nils Adermann a7f1605cdf Add test for correct sorting when force installing deps 12 years ago
Nils Adermann 26e051cb76 Decisions are now encapsulated in a separate object 12 years ago
Nils Adermann 0c1944a9d0 Let the solver handle aliases instead of the installer 12 years ago
Nils Adermann c37e126e14 Installed packages are now always removed unless otherwise requested
This means that an update request must always be accompanied by an install
request, otherwise the package might be removed rather than updated.
12 years ago
Jordi Boggiano f7440076fa Revert "Merge remote-tracking branch 'naderman/remove-packages-by-default'"
This reverts commit 2988152602, reversing
changes made to adb4188e12.
12 years ago
Nils Adermann 2cb2cde096 Installed packages are now always removed unless otherwise requested
This means that an update request must always be accompanied by an install
request, otherwise the package might be removed rather than updated.
12 years ago
Nils Adermann a16aa68c1d Rule literals are sorted, so first literal added is not first retrieved
Fixes #477
12 years ago
Nils Adermann 2c87fe5a22 Collect solver problems in Problem objects with human readable output. 12 years ago
Martin Hasoň 2b08df5192 Changed repository priority in the pool 13 years ago
Nils Adermann f3ff53b17c Create problems directly, rather than generating impossible rules 13 years ago
Nils Adermann dd443cd570 Complete circular dependency with alternatives through virtual packages test 13 years ago
Nils Adermann 3e1749fbad Readd update-all jobs and make them available through the request 13 years ago
Nils Adermann 9b8e62396c Merge pull request #324 from edorian/installNonExistingPackage
Create an 'impossible rule' when installing non existent packages
13 years ago
Nils Adermann 3b06a22e69 Add getVersionConstraint test case to avoid version normalization issues 13 years ago
Volker Dusch f304a0f129 Clean up the incomplete marker like suggested in https://github.com/composer/composer/pull/324#r465391 13 years ago
Nils Adermann 1ee5d99405 When changing watched literals of a rule, update the parent's next pointer
The previous rule was not previously updated to point to the next rule when
removing a middle rule from the watch tree for a literal. This resulted in
jumping from one literal's watch tree to another's, which could then jump
back to the original and cause infinite loop in a case like #265.

Fixes #265
13 years ago
Volker Dusch e20a79ac61 Fix TODO tags to confirm with the projects standard 13 years ago
Volker Dusch eafe13d5a5 Create an impossible rule when trying to install something that doesn't exist.
The rule isn't acted upon yet (hence the incomplete test) but it is there as a reminder that this case needs to be handled.
13 years ago
Nils Adermann e6143d1584 Add todos to explain why try/catch is inside the test 13 years ago