View Issue Details

IDProjectCategoryView StatusLast Update
1139RackTablesdefaultpublic2019-01-08 11:48
Reporterzmartell Assigned Toandriyanov  
PriorityhighSeveritymajorReproducibilityalways
Status closedResolutionfixed 
Product Version0.20.6 
Target Version0.20.7Fixed in Version0.20.7 
Summary1139: Cannot search asset_tag if contains only numbers
DescriptionHi,

I found out that Asset Tag(asset_no in object) cannot be searched if using only numbers. If you simply add a simple letter to it, it will become searchable.

This prevents using internal asset tags that consist of only numbers, as you cannot then be able to search by them.
Steps To Reproduce1. Set object to have asset tag of only numbers
2. Do a search. It will not find it.
3. add a letter to the asset tag
4. Do a search. it will find it.
Additional InformationI thought perhaps it was because it was considering only numbers to be a integer, but i ran a gettype and saw that it was indeed a string.
TagsNo tags attached.

Activities

infrastation

infrastation

2014-01-19 15:57

administrator   ~0002087

Works perfectly fine for me. Does this bug reproduce on demo.racktables.org?
zmartell

zmartell

2014-01-20 07:58

reporter  

img1.PNG (23,513 bytes)   
img1.PNG (23,513 bytes)   
zmartell

zmartell

2014-01-20 07:59

reporter  

img2.PNG (16,140 bytes)   
img2.PNG (16,140 bytes)   
zmartell

zmartell

2014-01-20 08:02

reporter   ~0002089

It doesnt seem reproducible on demo.racktables.org but it is oddly in my installation.

I realize i am currently on 20.5 and the latest is 20.6 , but i cannot find if that matters. I have checked DB_version in Config in DB and it says its at 20.5 too.

I have done a diff -r between the installation package and whats currently installed on the server and the only difference is mine has a secret.php file, because we use LDAP auth.

I have attached images to this bug report above.

We havent modified RT in any way. If theres a letter in it, it works just fine and we been using this for years. We only recently had to change Asset tags to be numerical and now we appear with this issue somehow.

I dont know what else to check for.
infrastation

infrastation

2014-01-20 09:46

administrator   ~0002091

0.20.6 contains lots of bugfixes compared to 0.20.5. Please upgrade and tell if the bug reproduces in 0.20.6. Thank you.
zmartell

zmartell

2014-01-20 10:02

reporter   ~0002093

Hi,

We have updated to 0.20.6 and it still didnt help.

Nothing found for '3242342'

mysql> select * from RackObject where asset_no='3242342';
+------+--------+-------+------------+----------+--------------+-------------+
| id | name | label | objtype_id | asset_no | has_problems | comment |
+------+--------+-------+------------+----------+--------------+-------------+
| 2408 | CODE39 | NULL | 4 | 3242342 | no | Test

-Zak |
+------+--------+-------+------------+----------+--------------+-------------+
1 row in set (0.01 sec)

mysql>
infrastation

infrastation

2014-01-20 15:18

administrator   ~0002097

Anyone who wants to debug this should have access to this server.
adoom42

adoom42

2014-01-20 18:32

administrator   ~0002101

This is the query used:
SELECT id FROM RackObject WHERE asset_no LIKE '%3242342%' ORDER BY asset_no;

If that doesn't return the row, there is something wrong with your MySQL server.
zmartell

zmartell

2014-01-20 18:37

reporter   ~0002103

Last edited: 2014-01-20 18:38

adoom42,

It returns it right:

mysql> SELECT id FROM RackObject WHERE asset_no LIKE '%3242342%' ORDER BY asset_no;
+------+
| id |
+------+
| 2408 |
+------+
1 row in set (0.01 sec)

mysql>

Also:

root@x# mysql -V
mysql Ver 14.12 Distrib 5.0.51a, for debian-linux-gnu (x86_64) using readline 5.2
root@x#

adoom42

adoom42

2014-01-20 19:54

administrator   ~0002105

Ok, so the query works when run manually but not when run from RackTables. You could enable MySQL query logging, perform the search from RT, then examine the log to see if the query has been altered in some way.

my.cnf:
general_log = 1
general_log_file = /var/log/mysql/mysqld.log
zmartell

zmartell

2014-01-22 04:52

reporter   ~0002113

Last edited: 2014-01-22 05:28

Hi adoom42,

I have done this and i found the below in the query log.

# grep 3242342 /var/log/mysql.log
            750 Query select * from IPv4Network where '3242342' & (4294967295 >> (32 - mask)) << (32 - mask) = ip and mask < '32' order by mask desc limit 1

If i search the host name/common name it gives a bunch different amount of queries. Its quite large so i pastebin'd it.

http://pastebin.com/raw.php?i=ZN1azeav

It seems to try and search as if its a network IP? The diff between between official installation folder and our installation yields no difference other than secret.php .

adoom42

adoom42

2014-01-22 19:09

administrator   ~0002119

Alexey, please look into this.
zmartell

zmartell

2014-01-22 19:12

reporter   ~0002121

I would be willing to show anything i can of course. The data as well as the server belongs internally to company so i can't allow remote access, but I'm open to doing anything else.

I feel its perhaps odd how the demo works, but it doesn't in our installation. I can't find any difference though when running diffs and I'm unsure what else to check.
andriyanov

andriyanov

2014-01-22 21:40

reporter   ~0002123

Please execute this PHP script in CLI (change the hardcoded path):

<?php
$script_mode = TRUE;
require '/path/to/racktables/wwwroot/inc/init.php';
$buggy = '3242342';
printf ("is_inet_avail: %d\n", is_inet_avail());
printf ("ip4_checkparse ($buggy): %s\n", var_export (ip4_checkparse ($buggy), TRUE));
if (is_inet_avail())
  printf ("inet_pton ($buggy): %s\n", var_export (inet_pton ($buggy), TRUE));
printf ("ip2long ($buggy): %s\n", var_export (ip2long ($buggy), TRUE));


Post its output into the ticket
zmartell

zmartell

2014-01-26 04:27

reporter   ~0002133

Last edited: 2014-01-26 04:30

is_inet_avail: 0
ip4_checkparse (3242342): '' . "\0" . '1yf'
ip2long (3242342): 3242342

---

It happens if its all numbers of any length, not just this particular one.

andriyanov

andriyanov

2014-01-27 05:52

reporter   ~0002135

It seems that your version of ip2long() PHP call contains a bug described here:
http://www.php.net/manual/en/function.ip2long.php

5.2.10 Prior to this version, ip2long() would sometimes return a valid number even if passed an value which was not an (IPv4) Internet Protocol dotted address.

Please try to upgrade PHP to the version 5.2.10 or above.
andriyanov

andriyanov

2014-02-02 07:40

reporter   ~0002169

The commit 9e9a53 is a workaround for this issue

Issue History

Date Modified Username Field Change
2014-01-19 07:04 zmartell New Issue
2014-01-19 15:57 infrastation Note Added: 0002087
2014-01-20 07:58 zmartell File Added: img1.PNG
2014-01-20 07:58 zmartell File Added: img2.PNG
2014-01-20 07:58 zmartell File Deleted: img2.PNG
2014-01-20 07:59 zmartell File Added: img2.PNG
2014-01-20 08:02 zmartell Note Added: 0002089
2014-01-20 09:46 infrastation Note Added: 0002091
2014-01-20 10:02 zmartell Note Added: 0002093
2014-01-20 15:18 infrastation Note Added: 0002097
2014-01-20 18:32 adoom42 Note Added: 0002101
2014-01-20 18:37 zmartell Note Added: 0002103
2014-01-20 18:38 zmartell Note Edited: 0002103
2014-01-20 19:54 adoom42 Note Added: 0002105
2014-01-22 04:52 zmartell Note Added: 0002113
2014-01-22 05:28 zmartell Note Edited: 0002113
2014-01-22 19:09 adoom42 Note Added: 0002119
2014-01-22 19:09 adoom42 Assigned To => andriyanov
2014-01-22 19:09 adoom42 Status new => assigned
2014-01-22 19:09 adoom42 Target Version => 0.20.7
2014-01-22 19:12 zmartell Note Added: 0002121
2014-01-22 21:40 andriyanov Note Added: 0002123
2014-01-26 04:27 zmartell Note Added: 0002133
2014-01-26 04:30 zmartell Note Edited: 0002133
2014-01-27 05:52 andriyanov Note Added: 0002135
2014-02-02 07:40 andriyanov Note Added: 0002169
2014-02-02 07:40 andriyanov Status assigned => closed
2014-02-02 07:40 andriyanov Resolution open => fixed
2014-02-02 07:40 andriyanov Fixed in Version => 0.20.7
2019-01-08 11:48 infrastation Source_changeset_attached => RackTables master 79d8b05e