|
2017-11-14
| ||
| 17:38 | • Ticket [5d6de65036] package require misses stable options with stable preferen... artifact: eabe8b3ef4 user: aku | |
| 17:24 | • Closed ticket [5d6de65036]. artifact: 9481b83da9 user: dgp | |
| 17:24 | [5d6de65036] [package require] with [package prefer stable] was not choosing available stable packag... check-in: 42eaa6f3d1 user: dgp tags: trunk | |
| 14:48 | [5d6de65036] [package require] with [package prefer stable] was not choosing available stable packag... check-in: dc94155e2d user: dgp tags: core-8-branch | |
| 14:17 | [5d6de65036] [package require] with [package prefer stable] was not choosing available stable packag... check-in: c83ea0961d user: dgp tags: core-8-6-branch | |
| 14:02 | [5d6de65036] [package require] with [package prefer stable] was not choosing available stable packag... closed check-in: d8e0b9ef6c user: dgp tags: mistake | |
| 13:43 | • Ticket [5d6de65036] package require misses stable options with stable preferen... artifact: 8b355d1941 user: dgp | |
| 13:37 | • Ticket [5d6de65036]: 3 changes artifact: f2ed3b3225 user: dgp | |
| 13:36 | [5d6de65036] [package require] with [package prefer stable] was not choosing available stable packag... check-in: c9b0215acb user: dgp tags: core-8-5-branch | |
| 08:44 | • Ticket [5d6de65036] package require misses stable options with stable preferen... artifact: 251b9f1be8 user: jan.nijtmans | |
|
2017-11-13
| ||
| 19:06 | • Ticket [5d6de65036]: 3 changes artifact: 2ae7091c8e user: aku | |
| 19:06 | • Ticket [5d6de65036]: 3 changes artifact: a5ae87c0fa user: aku | |
|
2017-11-06
| ||
| 00:11 | • Ticket [5d6de65036]: 3 changes artifact: bfeaa76cfc user: dgp | |
| 00:07 | • Ticket [5d6de65036]: 4 changes artifact: 7ac72e6564 user: dgp | |
|
2017-11-03
| ||
| 16:11 | • New ticket [5d6de65036]. artifact: 37a862a79d user: dgp | |
[package require] misses stable options with stable preference
First posted in a stackoverflow question:
https://stackoverflow.com/questions/47099580/tcl-package-require-loads-the-wrong-package-version
% package prefer
stable
% package ifneeded p 1.4a1 {package provide p 1.4a1}
% package ifneeded p 1.1 {package provide p 1.1}
% package require p 1.1
1.4a1
The search loop in PkgRequireCore() is simply wrong.
42eaa6f3d1[5d6de65036] [package require] with [package prefer stable] was not choosing available stable package. check-in2017-11-14 17:24:00dc94155e2d[5d6de65036] [package require] with [package prefer stable] was not choosing available stable package. check-in2017-11-14 14:48:21c83ea0961d[5d6de65036] [package require] with [package prefer stable] was not choosing available stable package. check-in2017-11-14 14:17:57d8e0b9ef6c[5d6de65036] [package require] with [package prefer stable] was not choosing available stable package. Hiding this in a mistake branch. Somehow huge diffs in unix/configure got included. Want a clean checkin. check-in2017-11-14 14:02:21c9b0215acb[5d6de65036] [package require] with [package prefer stable] was not choosing available stable package. check-in2017-11-14 13:36:59
aku, maybe you should take the first try at this, because looking over the code is filling me with the impulse for a substantial rewrite. (Available version lists kept sorted). If you can devise a less radical fix that may be more appropriate on the 8.5 branch.
Branch bug-5d6de65036 contains a test case demonstrating the bug to be fixed.
See commit [12e286e121] for my fix. No radical change. Kept a single search loop with choice after its completion. Simply made sure that a failure in the first comparison of each iteration does not prevent the comparison for stable to be run. Moved the requirements check before both.
Passes the extended testsuite.
If acceptable, please merge.
A more radical approach would be to move the search loop into a separate function, add flag to distinguish search for stable vs search for any. Then run search for any if stable is not requested, or search for stable failed to find anything.
Comment indicated that the list of available versions is sorted ? Ascending or descending ? If descending we can take first element matching our criteria and then stop. For ascending I see no way to an early stop.
I think this looks good for 8.5. So her's my +1 to merge (FWIW).
Thank you for the fix. I am merging it forward.
We have to prioritize correctness over other things. Clarity is usually the right second place. Performance after those. The prior implementation, I believe, was complicated out of an optimization attempt to minimize calls to SomeRequirementSatisfied(). Too bad that complicated often leads to wrong. It will be interesting to see if this change leads to fresh complaints about [package require] getting slower. There is ample room here for a refactoring that can improve both clarity and performance I think. Hopefully someone can find time to pursue that in the 8.7+ branches. Finally, I think there's still arguably a selection bug, though the spec is vague enough that I'm not certain. I will post that in a fresh ticket.
Merge completed.
> We have to prioritize correctness over other things. Yes, of course. Apologies if anything I said came across as not advocating that. That was definitely not my intention. > Clarity is usually the right second place. > Performance after those. True as well. > The prior implementation, I believe, was complicated > out of an optimization attempt to minimize calls to > SomeRequirementSatisfied(). I honestly do not remember anymore. > There is ample room here for a refactoring that can > improve both clarity and performance I think. Yes. The text starting from `A more radical approach ...` were my notes and thoughts on that matter so far. > Finally, I think there's still arguably a selection bug, > though the spec is vague enough that I'm not certain. I > will post that in a fresh ticket. Ok. Keeping my eyes open for it.