getsolus / eopkg

eopkg - Solus package manager implemented in python3
8 stars 9 forks source link

eopkg exits with error on upgrade when directory gets replaced with file #98

Open Staudey opened 5 days ago

Staudey commented 5 days ago

eopkg can't handle the case when some path in that package that previously referred to a directory refers to a file of the same name in the updated package. On upgrade the following error occurs:

System error. Program terminated.
[Errno 21] Is a directory: <path>

For example: https://github.com/getsolus/packages/issues/2545

Test case:

  1. Create test package release 1 with this recipe and install it:
    name       : test-upgrade
    version    : 1
    release    : 1
    source     :
    - https://sources.getsol.us/README.Solus : 65dcffb5d782abf60609195cc3e00eb55a9f02cb200441f498e4e30c11d1009e
    homepage   : PLEASE FILL ME IN
    extract    : no
    license    : GPL-2.0-or-later # CHECK ME
    component  : PLEASE FILL ME IN
    summary    : PLEASE FILL ME IN
    description: |
    PLEASE FILL ME IN
    install    : |
    install -dm00644 $installdir/test
  2. Create test package release 2 with this recipe and (try to) install it:
    name       : test-upgrade
    version    : 1
    release    : 2
    source     :
    - https://sources.getsol.us/README.Solus : 65dcffb5d782abf60609195cc3e00eb55a9f02cb200441f498e4e30c11d1009e
    homepage   : PLEASE FILL ME IN
    extract    : no
    license    : GPL-2.0-or-later # CHECK ME
    component  : PLEASE FILL ME IN
    summary    : PLEASE FILL ME IN
    description: |
    PLEASE FILL ME IN
    install    : |
    cp $sources/README.Solus ./test
    install -Dm00755 test $installdir/test

    (3. Uninstall the package so you don't have any leftover files)

ermo commented 5 days ago

@Staudey would you mind running this with debug info turned on, so it shows the backtrace for future reference...?

Staudey commented 5 days ago
λ sudo eopkg it -d test-upgrade-1-2-1-x86_64.eopkg 
DEBUG: InstallDB initialized in 0.00701999664307.
DEBUG: PackageDB initialized in 0.0597290992737.
DEBUG: RepoDB initialized in 0.000324964523315.
DEBUG: HistoryDB initialized in 0.120959043503.
DEBUG: A = ['test-upgrade-1-2-1-x86_64.eopkg']
digraph G {
test_upgrade[ label = "test-upgrade(1,2)" ];

}
Installation order: test-upgrade 
Installing test-upgrade, version 1, release 2
DEBUG: FilesDB /var/lib/eopkg/info/files.db check result:
DEBUG: > file_exists = True
DEBUG: > can_write = True
DEBUG: > db_type = gdbm
DEBUG: > flag = w
DEBUG: > valid_shelve = True
DEBUG: > version = 3
DEBUG: => force_rebuild = False
DEBUG: => needs_rebuild = False
DEBUG: => please_rebuild_manually = None
DEBUG: FilesDB initialized in 0.00040602684021.
DEBUG: InstallDB initialized in 0.00590801239014.
Upgrading to new distribution release
Extracting the files of test-upgrade
 [✓] Syncing filesystems                                                success
System error. Program terminated.
<type 'exceptions.IOError'>: [Errno 21] Is a directory: 'test'
Please use 'eopkg help' for general help.

Traceback:
  File "/usr/bin/eopkg", line 78, in <module>
    cli.run_command()
  File "/usr/lib/python2.7/site-packages/pisi/cli/pisicli.py", line 138, in run_command
    self.command.run()
  File "/usr/lib/python2.7/site-packages/pisi/cli/install.py", line 109, in run
    pisi.api.install(packages, ctx.get_option('reinstall') or reinstall)
  File "/usr/lib/python2.7/site-packages/pisi/api.py", line 65, in wrapper
    ret = func(*__args,**__kw)
  File "/usr/lib/python2.7/site-packages/pisi/api.py", line 450, in install
    return pisi.operations.install.install_pkg_files(packages, reinstall)
  File "/usr/lib/python2.7/site-packages/pisi/operations/install.py", line 280, in install_pkg_files
    raise e