Welcome to OCS Inventory NG community support, where you can ask questions and receive answers from other members of the community.

Please ask questions only in English or French.

Release 2.12.3 available

The official documentation can be found on https://wiki.ocsinventory-ng.org. Read it before asking your question.

Generic packaging deb with no size

Hello guys,

Context : ocsinventory-agent on a Debian system

What is wrong : installed packages with an unspecified size are not treated

File : lib/Ocsinventory/Agent/Backend/OS/Generic/Packaging/Deb.pm

Goal : the algorithm in this file lists all the packages to add them to the list of softwares. When a packages matches a defined pattern, then it is added to the software list. And if a package does not have a size, then 'Unknown size' is set for the size attribute.

Problem : when a package does not have a size, it does not match the pattern, so it is not added and the 'Unknown size' is never set.

Solution : fix the regex to match packages with no size

---if (/^(\S+)---(\S+)---(\S+)---(.*)/) {

+++if (/^(\S+)---(\S+)---(\S*)---(.*)/) {

 

in OCS Inventory NG agent for Unix by (120 points)

2 Answers

0 votes

Hi,

Please open an issue here => https://github.com/OCSInventory-NG/UnixAgent/issues/new

For your information : 

---if (/^(\S+)---(\S+)---(\S+)---(.*)/) { and +++if (/^(\S+)---(\S+)---(\S*)---(.*)/) { are the same

Regards

Frank

by (90.4k points)

OK, I just open an issue (https://github.com/OCSInventory-NG/UnixAgent/issues/10)

And for your information, + and * are not the same :

/^(\S+)---(\S+)---(\S+)---(.*)/

/^(\S+)---(\S+)---(\S*)---(.*)/

Lets take an example with (cron, sed, and mypackage). The script uses the following command to display the packages :

dpkg-query --show --showformat='\${Package}---\${Version}---\${Installed-Size}---\${Description}\n'

So we have the following lines displayed :

$cron---$3.0pl1-124---$300---$process scheduling daemon

$mypackage---$1.0.1-1---$---$my custom package

$sed---$4.2.1-10---$847---$The GNU sed stream editor

With the original and faulty regex /^(\S+)---(\S+)---(\S+)---(.*)/

Only cron and sed are added as softwares.

When I fix the original and faulty regex by /^(\S+)---(\S+)---(\S*)---(.*)/

Then all the packages are added as software. 

 

0 votes
Sorry, I've problems with my glasses ;p

Well done, thanks for the issue. This will be integrated.

Regards

Frank
by (90.4k points)

No problem.

I pushed a pull request with my fix in it (https://github.com/OCSInventory-NG/UnixAgent/pull/11).

If it is just a glasses problem, then sorry for the overkill explanation.

Thild42

 
Powered by Question2Answer
...