Bug 1227625

Summary: in %post (core dumped) ZYPP_READONLY_HACK=1 zypper refresh-services
Product: [openSUSE] openSUSE Distribution Reporter: Lubos Kocman <lubos.kocman>
Component: libzyppAssignee: E-mail List <zypp-maintainers>
Status: RESOLVED FIXED QA Contact: E-mail List <qa-bugs>
Severity: Normal    
Priority: P5 - None CC: bzeller, zypp-maintainers
Version: Leap 16.0   
Target Milestone: ---   
Hardware: Other   
OS: Other   
Whiteboard:
Found By: --- Services Priority:
Business Priority: Blocker: ---
Marketing QA Status: --- IT Deployment: ---
Attachments: zypper.log from leap16

Description Lubos Kocman 2024-07-10 12:06:47 UTC
Created attachment 875993 [details]
zypper.log from leap16

Using zypper refresh-services in %post crashes the post-script

See line 345 in https://build.opensuse.org/projects/Base:System/packages/openSUSE-repos/files/openSUSE-repos.spec?expand=1

Using the add-service with READONLY_HACK and is  working, however not regen of repos that most people complain about (missing after initial install etc).

%post /var/tmp/rpm-tmp.4eukQ3: line 25:  8351 Aborted                 (core dumped) ZYPP_READONLY_HACK=1 zypper refresh-services
Comment 1 Lubos Kocman 2024-07-10 12:07:52 UTC
Fix should be sent also to SLE/LeapMicro 6.X otherwise the automatic-updates would not work once we release openSUSE-repos package update (failure in post would report unsuccessful update).
Comment 2 Lubos Kocman 2024-07-10 12:11:38 UTC
lkocman@localhost:~/agama> ssh root@192.168.100.146
Last login: Wed Jul 10 14:06:16 CEST 2024 from 192.168.100.1 on ssh
Have a lot of fun...
leap16:~ # zypper refs
Refreshing service 'openSUSE'.
terminate called after throwing an instance of 'std::optional<zypp::repo::ServicePluginInformalException>'
Aborted (core dumped)
leap16:~ # rpm -ql openSUSE-repos-Leap
/etc/zypp/services.d/openSUSE.service
/etc/zypp/vars.d/DIST_ARCH
/usr/share/zypp/local
/usr/share/zypp/local/service
/usr/share/zypp/local/service/openSUSE
/usr/share/zypp/local/service/openSUSE/repo
/usr/share/zypp/local/service/openSUSE/repo/opensuse-leap-repoindex.xml
/usr/share/zypp/local/service/openSUSE/repo/repoindex.xml
leap16:~ # vim /usr/share/zypp/local/service/openSUSE/repo/opensuse-leap-repoindex.xml
leap16:~ # zypper refs
Refreshing service 'openSUSE'.
All services have been refreshed.


Issue was specifically in /usr/share/zypp/local/service/openSUSE/repo/opensuse-leap-repoindex.xml

where I missed the quote at the end of the line ...
<repo url="%{disturl}/repositories/openSUSE:/Leap:/16.0/standard/"
Comment 3 Lubos Kocman 2024-07-10 12:12:34 UTC
https://github.com/openSUSE/openSUSE-repos/pull/68
Comment 5 Lubos Kocman 2024-07-10 12:18:08 UTC
Do we want to have special handlding for invalid xml files, or shall we close this as resolved?
Comment 7 Michael Andres 2024-07-10 13:42:38 UTC
Let's keep it open for now and I'll close it later.

Regardless of the parse error, I see an 'Error: signal 6' in the log and this should not be there. We'll have to rewiew the error reporting and handling.
Comment 8 Benjamin Zeller 2024-07-10 14:01:13 UTC
The log indicates that a std::optional<zypp::repo::ServicePluginInformalException> has been thrown instead of the exception itself. This should not happen, since the calling code
can not correctly catch it, resulting in a std::terminate
Comment 9 Michael Andres 2024-07-10 14:21:03 UTC
> hobbes:~ (134)# zypper refresh-services 
> Refreshing service 'opensSUSE'.
> Problem retrieving the repository index file for service 'opensSUSE':
> [|] Parse error: repoindex.xml[21] Couldn't find end of Start Tag repo
> History:
>  - Parse error: repoindex.xml[21] Couldn't find end of Start Tag repo
>  - repoindex.xml[21] attributes construct error
>  - repoindex.xml[21] error parsing attribute name
> 
> Warning: Skipping service 'opensSUSE' because of the above error.
> All services have been refreshed.

That's how it will look like with libzypp-17.35.2