[Aptitude-devel] Bug#963667: Bug#963667: aptitude: Aptitude segmentation fault

Axel Beckert abe at debian.org
Fri Oct 16 20:45:51 BST 2020

Control: tag -1 + confirmed
Control: retitle -1 aptitude: segmentation fault if a file under /etc/apt/preferences.d is not readable for the user running aptitude


Bardot Jerome wrote:
>      As user i did :
>      aptitude search nouveau

This is not really much information and looking through the backtrace
is a bit like searching for a needle in the haystack.

Nevertheless, thanks to the hint by Gert, it helped to also pinpoint
the issue in your case (see below), so thanks for including it!

Gert Robben wrote:
> I have the same outcome, but I don't know if it's the same cause.
> Anyway, I found aptitude segfaults, when the active uid cannot read some
> file.

Thanks for that hint! That seems to be the cause of Jerome's segfault,
too, namely the file /etc/apt/preferences.d/99my-custom-repository:

stat("/etc/apt/preferences.d/99my-custom-repository", {st_mode=S_IFREG|0640, st_size=317, ...}) = 0
openat(AT_FDCWD, "/etc/apt/preferences.d/99my-custom-repository", O_RDONLY|O_NOCTTY|O_CLOEXEC) = -1 EACCES (Permission non accordée)

> $ su -c 'touch /etc/apt/preferences.d/test'
> $ aptitude search nouveau
> (works fine)
> $ su -c 'chmod -r /etc/apt/preferences.d/test'

I assume there is a "600" or "640" missing in that last line.

> Maybe you have the same problem?

It is.

> But I use stable, not testing.

Chances are high that this issue is in there for quite a while,
probably related to some API extensions of libapt* to expose better
error handling.

Anyway, I can now reproduce this here:

$ aptitude search nouveau
[1]    16941 segmentation fault (core dumped)  aptitude search nouveau

apt itself seems to catch this case and throws a warning:

$ apt search nouveau
Sorting... Done
Full Text Search... Done
bumblebee/unstable,testing 3.2.1-26 amd64
  NVIDIA Optimus support for Linux


W: Unable to read /etc/apt/preferences.d/foobar - open (13: Permission denied)

		Regards, Axel
 ,''`.  |  Axel Beckert <abe at debian.org>, https://people.debian.org/~abe/
: :' :  |  Debian Developer, ftp.ch.debian.org Admin
`. `'   |  4096R: 2517 B724 C5F6 CA99 5329  6E61 2FF9 CD59 6126 16B5
  `-    |  1024D: F067 EA27 26B9 C3FC 1486  202E C09E 1D89 9593 0EDE

More information about the Aptitude-devel mailing list