Bug 1222744 - Zypper segmentation fault from SIGINT at get_prompt_reply
Summary: Zypper segmentation fault from SIGINT at get_prompt_reply
Status: NEW
Alias: None
Product: openSUSE Tumbleweed
Classification: openSUSE
Component: libzypp (show other bugs)
Version: Current
Hardware: x86-64 openSUSE Tumbleweed
: P5 - None : Normal (vote)
Target Milestone: ---
Assignee: E-mail List
QA Contact: E-mail List
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2024-04-13 09:27 UTC by Simon Westersund
Modified: 2024-04-13 09:27 UTC (History)
0 users

See Also:
Found By: ---
Services Priority:
Business Priority:
Blocker: ---
Marketing QA Status: ---
IT Deployment: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Simon Westersund 2024-04-13 09:27:15 UTC
Zypper crashes with a segmentation fault when interrupted with a SIGINT while it waits for a "[yes/no]" prompt asking whether to trust an unknown GPG key for a new repository.

GDB backtrace from the interactive prompt where the crash will happen if the user presses Ctrl+C (to send the SIGINT):

(gdb) bt
#0  0x00007f04bf30578f in poll () from /lib64/libc.so.6
#1  0x0000563bf94743ff in get_prompt_reply(Zypper&, PromptId, ztui::PromptOptions const&) ()
#2  0x0000563bf9475790 in read_bool_answer(PromptId, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, bool) ()
#3  0x0000563bf93a9329 in ?? ()
#4  0x00007f04c001f058 in ?? () from /lib64/libzypp.so.1732
#5  0x00007f04bfdfe893 in ?? () from /lib64/libzypp.so.1732
#6  0x00007f04c0016779 in ?? () from /lib64/libzypp.so.1732
#7  0x00007f04c0019be7 in ?? () from /lib64/libzypp.so.1732
#8  0x00007f04bfe06952 in ?? () from /lib64/libzypp.so.1732
#9  0x00007f04bfdfb85a in ?? () from /lib64/libzypp.so.1732
#10 0x00007f04c003976f in ?? () from /lib64/libzypp.so.1732
#11 0x0000563bf93e132d in refresh_raw_metadata(Zypper&, zypp::RepoInfo const&, bool) ()
#12 0x0000563bf941ea77 in RefreshRepoCmd::refreshRepository(Zypper&, zypp::RepoInfo const&, zypp::base::Flags<RefreshRepoCmd::RefreshFlagsBits>) ()
#13 0x0000563bf9428a56 in RefreshRepoCmd::refreshRepositories(Zypper&, zypp::base::Flags<RefreshRepoCmd::RefreshFlagsBits>, std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > >) ()
#14 0x0000563bf9425f4b in RefreshRepoCmd::execute(Zypper&, std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > const&) ()
#15 0x0000563bf93ff954 in ZypperBaseCommand::run(Zypper&) ()
#16 0x0000563bf93bef93 in Zypper::doCommand(int, char**, int) ()
#17 0x0000563bf9394cda in Zypper::main(int, char**) ()
#18 0x0000563bf939381e in main ()


# How to reproduce:

- Add a new repo file in /etc/zypp/repos.d/newrepo.repo, which signs using a currently untrusted GPG key
- Run `sudo zypper ref`
- Zypper will ask: "File 'repomd.xml' from repository 'REPONAME' is signed with an unknown key 'FINGERPRINT_HERE'. Continue? [yes/no] (no):"
- Press Ctrl+C to send a SIGINT

# What happens:

Zypper crashes with a segmentation fault:

```
Trying to exit gracefully...
Segmentation fault
```

# What should happen:

Zypper should be able to exit gracefully without crashing.


# Additional notes

I assume that this would happen for other repos, but if it is relevant, I was following the AMD ROCm6.0.2 installation guide and adding the repository mentioned in this guide:
https://rocm.docs.amd.com/projects/install-on-linux/en/latest/how-to/native-install/sles.html#register-rocm-packages