Bug 31590

Summary: apt-shell aborts if apt-get update was called in the meantime
Product: Sisyphus Reporter: Ivan Zakharyaschev <imz>
Component: aptAssignee: Ivan Zakharyaschev <imz>
Status: NEW --- QA Contact: qa-sisyphus
Severity: minor    
Priority: P3 CC: boyarsh, glebfm, imz, ldv, placeholder
Version: unstable   
Hardware: all   
OS: Linux   

Description Ivan Zakharyaschev 2015-12-03 21:29:51 MSK
apt-0.5.15lorg2-alt52

How to reproduce -- with an uninstalled package which changed between the apt-get-updates:

apt-get remove tmux
apt-repo rm sisyphus && apt-repo add p6 && apt-get update

Start apt-shell (in another terminal) and don't close it.

apt-repo add sisyphus && apt-repo rm p6 && apt-get update

In apt-shell, do:

install tmux
commit

It aborts like this:

apt> install tmux
apt> commit
The following NEW packages will be installed:
  tmux
0 upgraded, 1 newly installed, 0 removed and 4 not upgraded.
apt-shell: rpm/rpmhandler.cc:119: virtual std::__cxx11::string RPMFileHandler::Directory(): Assertion `HeaderP != __null' failed.
Aborted


A solution would be either for apt-shell to lock APT's data preventing any other instances re-writing it (but not reading it), or for apt-shell to re-read the data if it has changed.

Another case -- out of curiosity -- if the package list hasn't changed at all between the apt-get-updates:

Start apt-shell (and leave it running).

[root@ovicaa apt]# rm /var/cache/apt/*.bin /var/lib/apt/lists/*ftp.alt*  -vi
rm: remove regular file ‘/var/cache/apt/pkgcache.bin’? y
removed ‘/var/cache/apt/pkgcache.bin’
rm: remove regular file ‘/var/cache/apt/srcpkgcache.bin’? y
removed ‘/var/cache/apt/srcpkgcache.bin’
rm: remove regular file ‘/var/lib/apt/lists/ftp.altlinux.org_pub_distributions_ALTLinux_Sisyphus_noarch_base_pkglist.classic’? y
removed ‘/var/lib/apt/lists/ftp.altlinux.org_pub_distributions_ALTLinux_Sisyphus_noarch_base_pkglist.classic’
rm: remove regular file ‘/var/lib/apt/lists/ftp.altlinux.org_pub_distributions_ALTLinux_Sisyphus_noarch_base_release’? y
removed ‘/var/lib/apt/lists/ftp.altlinux.org_pub_distributions_ALTLinux_Sisyphus_noarch_base_release’
rm: remove regular file ‘/var/lib/apt/lists/ftp.altlinux.org_pub_distributions_ALTLinux_Sisyphus_noarch_base_release.classic’? y
removed ‘/var/lib/apt/lists/ftp.altlinux.org_pub_distributions_ALTLinux_Sisyphus_noarch_base_release.classic’
rm: remove regular file ‘/var/lib/apt/lists/ftp.altlinux.org_pub_distributions_ALTLinux_Sisyphus_x86%5f64_base_pkglist.classic’? y
removed ‘/var/lib/apt/lists/ftp.altlinux.org_pub_distributions_ALTLinux_Sisyphus_x86%5f64_base_pkglist.classic’
rm: remove regular file ‘/var/lib/apt/lists/ftp.altlinux.org_pub_distributions_ALTLinux_Sisyphus_x86%5f64_base_release’? y
removed ‘/var/lib/apt/lists/ftp.altlinux.org_pub_distributions_ALTLinux_Sisyphus_x86%5f64_base_release’
rm: remove regular file ‘/var/lib/apt/lists/ftp.altlinux.org_pub_distributions_ALTLinux_Sisyphus_x86%5f64_base_release.classic’? y
removed ‘/var/lib/apt/lists/ftp.altlinux.org_pub_distributions_ALTLinux_Sisyphus_x86%5f64_base_release.classic’
rm: remove regular file ‘/var/lib/apt/lists/ftp.altlinux.org_pub_distributions_ALTLinux_Sisyphus_x86%5f64-i586_base_pkglist.classic’? y
removed ‘/var/lib/apt/lists/ftp.altlinux.org_pub_distributions_ALTLinux_Sisyphus_x86%5f64-i586_base_pkglist.classic’
rm: remove regular file ‘/var/lib/apt/lists/ftp.altlinux.org_pub_distributions_ALTLinux_Sisyphus_x86%5f64-i586_base_release’? y
removed ‘/var/lib/apt/lists/ftp.altlinux.org_pub_distributions_ALTLinux_Sisyphus_x86%5f64-i586_base_release’
rm: remove regular file ‘/var/lib/apt/lists/ftp.altlinux.org_pub_distributions_ALTLinux_Sisyphus_x86%5f64-i586_base_release.classic’? y
removed ‘/var/lib/apt/lists/ftp.altlinux.org_pub_distributions_ALTLinux_Sisyphus_x86%5f64-i586_base_release.classic’
[root@ovicaa apt]# apt-get update

In apt-shell, do:

apt> install tmux
apt> commit 
The following NEW packages will be installed:
  tmux
0 upgraded, 1 newly installed, 0 removed and 1602 not upgraded.
Need to get 0B/232kB of archives.
After unpacking 608kB of additional disk space will be used.
Do you want to continue? [Y/n] n
E: Operation cancelled.
apt> 

It doesn't abort.

Another case is a curious one, too -- what if the lists change, but the wanted package doesn't:

apt-repo rm sisyphus && apt-repo add p7 && apt-get update

Start apt-shell.

apt-repo rm p7 && apt-repo add t7 && apt-get update

In apt-shell, do:

apt> install tmux
apt> commit 
The following NEW packages will be installed:
  tmux
0 upgraded, 1 newly installed, 0 removed and 173 not upgraded.
apt-shell: rpm/rpmhandler.cc:119: virtual std::__cxx11::string RPMFileHandler::Directory(): Assertion `HeaderP != __null' failed.
Aborted


So, the change of the package is not essential. (http://packages.altlinux.org/en/Sisyphus/srpms/tmux tells us that tmux is the same in p7 and t7.)