OCSInventory-NG / OCSInventory-Server

Communication server of OCS Inventory
http://www.ocsinventory-ng.org/
GNU General Public License v2.0
344 stars 139 forks source link

ipdiscover-util.pl create craps in DB #326

Closed StCyr closed 3 years ago

StCyr commented 3 years ago

OCS Inventory informations

Ocs server version : 2.9

Problem's description

Here's the result of my netmap table after running ipdiscover-util.pl -d=10.50.0.0/16 -scantype=ping:

mysql> select IP from netmap where IP like '10.50%' limit 10;
+--------------+
| IP           |
+--------------+
| 10.50.1.104  |
| 10.50.1.137
 |
| 10.50.1.138
 |
| 10.50.1.139
 |
| 10.50.1.140
 |
| 10.50.1.141
 |
| 10.50.2.101  |
| 10.50.2.102  |
| 10.50.2.103  |
| 10.50.2.104  |
+--------------+
10 rows in set (0.00 sec)

IP addresses identified by ipdiscover-util.pl have trailing white spaces.

StCyr commented 3 years ago

Worse, they actualy have a trailing newline:

mysql> select TRIM('\n' from IP) from netmap where IP like '10.50%' limit 10;
+--------------------+
| TRIM('\n' from IP) |
+--------------------+
| 10.50.1.104        |
| 10.50.1.137        |
| 10.50.1.138        |
| 10.50.1.139        |
| 10.50.1.140        |
| 10.50.1.141        |
| 10.50.2.101        |
| 10.50.2.102        |
| 10.50.2.103        |
| 10.50.2.104        |
+--------------------+
10 rows in set (0.00 sec)

mysql>
gillesdubois commented 3 years ago

Hi @StCyr

It seems the issue has been fixed with the PR mentionned above.

Thanks for your report.

Regards, Gilles.