Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 589444 - [TRACKER] Packages assuming REPLACING_VERSIONS is singular
Summary: [TRACKER] Packages assuming REPLACING_VERSIONS is singular
Status: RESOLVED FIXED
Alias: None
Product: Quality Assurance
Classification: Unclassified
Component: Trackers (show other bugs)
Hardware: All Linux
: Normal QA
Assignee: Gentoo Quality Assurance Team
URL:
Whiteboard:
Keywords: Tracker
Depends on: 589446 589448 589450 589452 589454 589456 589458 589460 589462 589464 589466 589468 589470 589472 589474 589476 589478 589480 589482 589484 589486 589488 589490 589492 589494 589496 589498 589500 589502 589504 589506 589508 589512 589514 589516 589518 589520 589522 589524 589526 589528 589530 589532 589534 589536 589538 589540
Blocks:
  Show dependency tree
 
Reported: 2016-07-23 12:01 UTC by Michał Górny
Modified: 2022-02-07 02:27 UTC (History)
1 user (show)

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2016-07-23 12:01:19 UTC
Per PMS [1]:

| REPLACING_VERSIONS is a list, not a single optional value, to handle
| pathological cases such as installing foo-2:2 to replace foo-2:1 and foo-3:2.

It should be noted that as the author [2] explains this is just an example of pathological case and not the only possibility.

In any case, PMS explicitly requires ebuilds to account for possible multiple values. The overhead of such a check is really minimal, and therefore is not a valid excuse not to follow the spec.

An example of correct REPLACING_VERSIONS check:

  pkg_postinst() {
    local v
    for v in ${REPLACING_VERSIONS}; do
      if ! version_is_at_least ... ${v}; then
        ...
        # if the thingie should be done at most once:
        break
      fi
    done
  }

[1]:https://projects.gentoo.org/pms/6/pms.html#x1-12000011.1.2
[2]:https://archives.gentoo.org/gentoo-dev/message/dc975c9e64011a34dd98d0ffa5b23ee6
Comment 1 Ian Stakenvicius (RETIRED) gentoo-dev 2016-07-25 16:34:39 UTC
(In reply to Michał Górny from comment #0)
> Per PMS [1]:
> 
> | REPLACING_VERSIONS is a list, not a single optional value, to handle
> | pathological cases such as installing foo-2:2 to replace foo-2:1 and
> foo-3:2.
> 
> It should be noted that as the author [2] explains this is just an example
> of pathological case and not the only possibility.
> 


More specifically -- the case for a single-slot-only package where ${REPLACING_VERSIONS} might have more than one value is (apparently) when a previous emerge of an upgrade or downgrade fails to complete during the merge process.  As such, when coding the list-capable version it is good to keep in mind that if there are two versions in the list then one (or both) of them might be an incomplete merge, and also that there's no way to know which one is which.

This doesn't much matter when ${REPLACING_VERSIONS} is conditionally displaying elog messages, but it could matter a lot when wrapping calls to tools, doing configuration updates, etc.