openSUSE / opi

OBS Package Installer (CLI)
GNU General Public License v3.0
244 stars 22 forks source link

Crashes adding devel repo #103

Closed bubbleguuum closed 2 years ago

bubbleguuum commented 2 years ago

Observed on latest openSUSE TW as of the date of this report.

Seems to be cause by the recent change: https://github.com/openSUSE/opi/commit/8e40ab14434d454f27c79a41ab061227d50aacab

Full session below to reprod:

$opi fixposix
1. libfixposix3
2. libfixposix-devel
3. libfixposix3-debuginfo
4. libfixposix-debugsource
Pick a number (0 to quit): 2
You have selected package name: libfixposix-devel
1. devel:libraries:c_c++ ?                   | 0.4.3                     | x86_64
2. home:bhwachter:desktop !                  | 0.4.3                     | x86_64
3. home:tecosaur !                           | 0.4.3                     | x86_64
4. home:twotaps:interwebs !                  | 0.4.3                     | x86_64
5. home:xorcue !                             | 0.4.3                     | x86_64
Pick a number (0 to quit): 1
You have selected binary package: devel:libraries:c_c++ ? | 0.4.3 | x86_64
Traceback (most recent call last):
  File "/usr/bin/opi", line 94, in <module>
    opi.install_binary(selected_binary)
  File "/usr/lib/python3.8/site-packages/opi/__init__.py", line 313, in install_binary
    existing_repo = get_enabled_repo_by_url(url)
  File "/usr/lib/python3.8/site-packages/opi/__init__.py", line 127, in get_enabled_repo_by_url
    for repo, repo_url in get_repos():
  File "/usr/lib/python3.8/site-packages/opi/__init__.py", line 121, in get_repos
    mainsec = cp.sections()[0]
IndexError: list index out of range
bubbleguuum commented 2 years ago

This issue was caused by the presence of folder /etc/zypp/repos.d/.previous, which was handled as a repo. Patch I mentionned above actually fixes such unusual situation, discarding non .repo files.