[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: apt debug



On 2025-10-13 at 10:34, fxkl47BF@protonmail.com wrote:

> On Mon, 13 Oct 2025, Greg Wooledge wrote:
> 
>> On Mon, Oct 13, 2025 at 13:07:37 +0000, fxkl47BF@protonmail.com wrote:

>>> i've read that several times
>>> i don't see anything that tells me the details of how apt is performing the search
>>
>> I don't understand what you're asking.
>>
>> ~e means the rest of it is a regex (regular expression) which is matched
>> against the source package name.  (It would be nice if it specified
>> which flavor of regex it's using, because there are many.)
>>
>> ^science is a regex that matches any string/line beginning with the
>> substring "science".  (At least in BRE, ERE and PCRE flavors.)
>>
>> So, putting it together, it should match all packages whose source package
>> name begins with "science".
>>
>> When I run it on my system, I get the following result:
>>
>> hobbit:~$ apt list '~e^science'
>> ESC[32mlibjs-sciencejsESC[0m/stable,stable 1.9.3+dfsg-4 all
>>
>> This package is not installed, so it seems it's looking at available
>> packages.  This is the package it's referring to:
>>
>> hobbit:~$ apt-cache show libjs-sciencejs
>> Package: libjs-sciencejs
>> Source: science.js
>> Version: 1.9.3+dfsg-4
>> [...]
>>
>> As you can see, its source package name is "science.js" which does in
>> fact begin with "science".  So, it looks like it's working as documented.
> 
> apt list ~e^science is an example
> not what i'm interested in
> i'm interested in the details of how apt go about doing whatever it's doing

Well, what details are you interested in getting?

Do you want to know what files, or other data sources, it looks at? What
parts of those files it matches against? What methods it uses to search
through them? How it determines what does and does not count as a match?
Something else? (Multiple somethings else?)

For some of those, the answers can be found within the information
you've already been given; for example, the "how it determines what does
and does not count as a match" is answered by "regex", which is to say
"regular expression". Regular expressions are a topic all on their own,
which is amply documented in many places, one of which you've been
pointed to elsewhere in this thread.

For most of the rest of the things I suggested as ideas of what might be
the details you're interested in getting, the only way you're going to
find the answers is to look at the source code of apt. apt itself does
not appear (at least not at a simple skim) to include debug or verbose
output options, certainly not ones so extensive as to let you follow
along step-by-step with what it's doing.

In theory you could alternately (or also) run the program under strace
or possibly a debugger, and use that to look at what functions it's
calling and with what arguments and so forth, and use that to help
inform your understanding of what's being done when the program runs.
But there is only so much utility to be found in doing that without also
referencing the source code, so you'd probably be better off going
straight for that option instead.

The source code for apt can be obtained by, among other methods, running
'apt source apt'; this is documented in the man page for apt-get, which
is pointed to by the man page for apt. That works the same way with any
package name; you can e.g. run 'apt source dpkg' or 'apt source
xserver-xorg-core' or 'apt source xorg-server', and each of those will
download and set up a source-package directory for the specified package.

(The latter two, if I'm not mistaken, will in fact fetch and set up the
exact same source-package directory; the first of them specifies the
name of a binary package, and the latter the name of the source package
from which that binary package was built.)

If none of that helps you find out how to find out what you're wanting
to know, then I'm afraid you're going to have to figure out some way to
be more clear about exactly what it is that you're wanting to know,
because the way you've been explaining it so far isn't conveying enough
information for us to be able to figure out what sort of answer would
satisfy your interest.

-- 
   The Wanderer

The reasonable man adapts himself to the world; the unreasonable one
persists in trying to adapt the world to himself. Therefore all
progress depends on the unreasonable man.         -- George Bernard Shaw

Attachment: signature.asc
Description: OpenPGP digital signature


Reply to: