Uploaded image for project: 'Funtoo Linux'
  1. Funtoo Linux
  2. FL-12283

Add cache consistency checking for the portage downloaded packages

    • Icon: Improvement Improvement
    • Resolution: Expected Behavior
    • Icon: Normal Normal
    • None
    • None
    • None

      I recently came across an issue where reinstalling a previously installed package with 'emerge @preserved-rebuild' resulted in some puzzling error. Specifically it went like this:

      $ sudo emerge -av @preserved-rebuild

      These are the packages that would be merged, in order:

      Calculating dependencies... done!
      [ebuild R ] app-text/ghostscript-gpl-9.53.3-r2::text-kit USE="X cups dbus gtk unicode -static-libs" L10N="-de -ja -ko -zh-CN -zh-TW" 0 KiB

      Total: 1 package (1 reinstall), Size of downloads: 0 KiB

      Would you like to merge these packages? [Yes/No] y

      > Verifying ebuild manifests
      >
      > >>> Emerging (1 of 1) app-text/ghostscript-gpl-9.53.3-r2::text-kit
      > Exception in callback _EbuildFetcherProcess.async_already_fetched.<locals>.uri_map_done(<Future finis....tar.xz',))])>) at /usr/lib/python3.9/site-packages/_emerge/EbuildFetcher.py:100
      > handle: <Handle _EbuildFetcherProcess.async_already_fetched.<locals>.uri_map_done(<Future finis....tar.xz',))])>) at /usr/lib/python3.9/site-packages/_emerge/EbuildFetcher.py:100>
      > Traceback (most recent call last):
      > File "/usr/lib/python3.9/asyncio/events.py", line 80, in _run
      > self._context.run(self._callback, *self._args)
      > File "/usr/lib/python3.9/site-packages/_emerge/EbuildFetcher.py", line 113, in uri_map_done
      > self._check_already_fetched(settings, uri_map))
      > File "/usr/lib/python3.9/site-packages/_emerge/EbuildFetcher.py", line 166, in _check_already_fetched
      > ok, st = _check_distfile(os.path.join(distdir, filename),
      > File "/usr/lib/python3.9/site-packages/portage/package/ebuild/fetch.py", line 324, in _check_distfile
      > if _check_digests(filename, digests, show_errors=show_errors):
      > File "/usr/lib/python3.9/site-packages/portage/package/ebuild/fetch.py", line 282, in _check_digests
      > verified_ok, reason = verify_all(filename, digests)
      > File "/usr/lib/python3.9/site-packages/portage/checksum.py", line 471, in verify_all
      > myhash = perform_checksum(filename, x, calc_prelink=calc_prelink)[0]
      > File "/usr/lib/python3.9/site-packages/portage/checksum.py", line 529, in perform_checksum
      > myhash, mysize = hashfunc_map[hashname].checksum_file(myfilename)
      > File "/usr/lib/python3.9/site-packages/portage/checksum.py", line 92, in checksum_file
      > data = f.read(blocksize)
      > OSError: [Errno 5] Input/output error
      > Terminated

      I couldn't make sense of it, however I noticed that the error popped up instantly when running the command with no latency. That made me suspect that the package cached by portage had become corrupted.
      To verify I deleted the cached package and re-ran emerge, and this time a fresh copy of the package was downloaded and installed without any problem.
      Also it appears that other people on discord have had similar issues (cuantar for instance)

      Perhaps it would not be a bad idea to implement some sort of cache consistency check in portage to avoid such head-scratching moments and trying to chase bugs that aren't there.

            Unassigned Unassigned
            stamasd stamasd
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: