Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Broken device.family results since 2.1.4 #63

Open
ghost opened this issue Feb 5, 2015 · 2 comments
Open

Broken device.family results since 2.1.4 #63

ghost opened this issue Feb 5, 2015 · 2 comments

Comments

@ghost
Copy link

ghost commented Feb 5, 2015

I have two versions of my production server. Most are still on version 2.1.3, but one I built recently has 2.1.4. On this 2.1.4 server, there are some weird device.family results appearing in my logs. For example:

Samsung $2
ZiiLABS $2
Prestigio PMP3970B $2
Lenovo IdeaTab $2
Samsung undefined$2
Samsung SAMSUNG $2
LG-$2
HTC One $2 $3 $4
HTC Desire $2 $3 $4
Nokia$2$3
Yifang GE$2$3
HTC WildfireS $2 $3 $4

Picking the top one as an example, the user agent is

Mozilla/5.0 (Linux; Android 4.4.2; en-gb; SAMSUNG SM-T230 Build/KOT49H) AppleWebKit/537.36 (KHTML, like Gecko) Version/1.5 Chrome/28.0.1500.94 Safari/537.36

Using 2.1.3, device.family is correct: Samsung SM-T230
Using 2.1.4, device.family is incorrect: Samsung $2

90% of devices are OK. These broken ones represent around 10% of the different devices in my logs. I have not noticed any similar issues with browser or operating system. It just looks like device that's a bit broken.

I'm going to force 2.1.3 for the moment on my servers, but hopefully this can be fixed going forward :-)

@ghost
Copy link
Author

ghost commented Feb 5, 2015

Here's a test program which (on my linux 2.1.4 server) goes wrong every time:

var useragent = require('useragent');

function testArray(agents) {
    // test an array of user agent strings
    var i,
        parsed,
        okcount = 0,
        errcount = 0;

    console.log('testing %d unique user agent strings', agents.length);

    for (i = 0; i < agents.length; i += 1) {
        parsed = useragent.parse(agents[i]);

        if (parsed.device.family.indexOf('$') !== -1 || parsed.device.family.indexOf('undefined') !== -1) {
            console.log('User agent: %s', agents[i]);
            console.log('device.family: %s', parsed.device.family);
            errcount += 1;
        } else {
            okcount += 1;
        }

    }

    console.log('success: %d', okcount);
    console.log('failure: %d', errcount);
}

var agents = [];

agents.push('Mozilla/5.0 (Linux; Android 4.4.2; en-gb; SAMSUNG GT-I9500 Build/KOT49H) AppleWebKit/537.36 (KHTML, like Gecko) Version/1.5 Chrome/28.0.1500.94 Mobile Safari/537.36');
agents.push('Mozilla/5.0 (Linux; U; Android 2.2.1; ZiiLABS ZiiO7  Build/v2.02.04) AppleWebKit/528.18 (KHTML, like Gecko) Version/4.0 Mobile Safari/528.16');
agents.push('Mozilla/5.0 (Linux; Android 4.4.2; en-gb; SAMSUNG SM-T230 Build/KOT49H) AppleWebKit/537.36 (KHTML, like Gecko) Version/1.5 Chrome/28.0.1500.94 Safari/537.36');
agents.push('Mozilla/5.0 (Linux; U; Android 2.2.1; ZiiLABS ZiiO7  Build/v2.00.13-FROYO) AppleWebKit/528.18 (KHTML, like Gecko) Version/4.0 Mobile Safari/528.16');
agents.push('Mozilla/5.0 (Linux; Android 4.4.2; en-us; SAMSUNG GT-I9295 Build/KOT49H) AppleWebKit/537.36 (KHTML, like Gecko) Version/1.5 Chrome/28.0.1500.94 Mobile Safari/537.36');
agents.push('Mozilla/5.0 (Linux; U; Android 4.1.1; en-gb; PMP3970B Build/JRO03C) AppleWebKit/534.30 (KHTML, like Gecko) Version/4.0 Safari/534.30');
agents.push('Mozilla/5.0 (Linux; U; Android 4.1.1; en-us; PMP3970B Build/JRO03C) AppleWebKit/534.30 (KHTML, like Gecko) Version/4.0 Safari/534.30');
agents.push('Mozilla/5.0 (Linux; U; Android 4.4.2; en-gb; LG-D802 Build/KOT49I.D80220d) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/30.0.1599.103 Mobile Safari/537.36');
agents.push('Mozilla/5.0 (Linux; Android 4.4.2; en-gb; SAMSUNG SM-G900F Build/KOT49H) AppleWebKit/537.36 (KHTML, like Gecko) Version/1.6 Chrome/28.0.1500.94 Mobile Safari/537.36');
agents.push('Mozilla/5.0 (Linux; Android 4.4.2; en-us; SAMSUNG SM-G900FD Build/KOT49H) AppleWebKit/537.36 (KHTML, like Gecko) Version/1.6 Chrome/28.0.1500.94 Mobile Safari/537.36');
agents.push('Mozilla/5.0 (Linux; Android 4.4.2; en-gb; SAMSUNG GT-I9505/I9505XXUGNJ5 Build/KOT49H) AppleWebKit/537.36 (KHTML, like Gecko) Version/1.5 Chrome/28.0.1500.94 Mobile Safari/537.36');
agents.push('Mozilla/5.0 (Linux; Android 4.4.2; ar-ae; SAMSUNG SM-N9005 Build/KOT49H) AppleWebKit/537.36 (KHTML, like Gecko) Version/1.5 Chrome/28.0.1500.94 Mobile Safari/537.36');
agents.push('Mozilla/5.0 (Linux; Android 4.4.4; en-gb; SAMSUNG SM-G901F Build/KTU84P) AppleWebKit/537.36 (KHTML, like Gecko) Version/1.6 Chrome/28.0.1500.94 Mobile Safari/537.36');
agents.push('Mozilla/5.0 (Linux; Android 4.4.4; en-us; SAMSUNG SM-N910C Build/KTU84P) AppleWebKit/537.36 (KHTML, like Gecko) Version/2.0 Chrome/34.0.1847.76 Mobile Safari/537.36');
agents.push('Mozilla/5.0 (Linux; Android 4.2.2; IdeaTab A3000-F Build/JDQ39) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/40.0.2214.89 Safari/537.36');
agents.push('Mozilla/5.0 (Linux; Android 4.4.2; en-gb; SAMSUNG SM-G900FD Build/KOT49H) AppleWebKit/537.36 (KHTML, like Gecko) Version/1.6 Chrome/28.0.1500.94 Mobile Safari/537.36');
agents.push('Mozilla/5.0 (Linux; Android 5.0.1; HTC One_M8 Build/LRX22C) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/40.0.2214.89 Mobile Safari/537.36');
agents.push('Mozilla/5.0 (Linux; Android 4.4.4; HTC_One_M8 Build/KTU84P) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/33.0.0.0 Mobile Safari/537.36');
agents.push('Mozilla/5.0 (Linux; Android 4.4.4; HTC One_M8 Build/KTU84P) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/33.0.0.0 Mobile Safari/537.36');
agents.push('Mozilla/5.0 (Linux; Android 4.4.2; en-us; SAMSUNG GT-I9505 Build/KOT49H) AppleWebKit/537.36 (KHTML, like Gecko) Version/1.5 Chrome/28.0.1500.94 Mobile Safari/537.36');
agents.push('Mozilla/5.0 (Linux; Android 4.4.2; en-gb; SAMSUNG SM-T520 Build/KOT49H) AppleWebKit/537.36 (KHTML, like Gecko) Version/1.5 Chrome/28.0.1500.94 Safari/537.36');
agents.push('Mozilla/5.0 (Linux; U; Android 4.4.2; en-gb; HTC_One_E8 Build/KOT49H) AppleWebKit/534.30 (KHTML, like Gecko) Version/4.0 Mobile Safari/534.30');
agents.push('Mozilla/5.0 (Linux; U; Android 4.4.2; en-us; LG-D802 Build/KOT49I.D80220c) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/30.0.1599.103 Mobile Safari/537.36');
agents.push('Mozilla/5.0 (Linux; Android 4.4.2; LG-D802 Build/KOT49I.D80220c) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/30.0.1599.103 Mobile Safari/537.36');
agents.push('Mozilla/5.0 (Linux; Android 4.4.2; ar-ae; SAMSUNG SM-G900FD Build/KOT49H) AppleWebKit/537.36 (KHTML, like Gecko) Version/1.6 Chrome/28.0.1500.94 Mobile Safari/537.36');
agents.push('Mozilla/5.0 (Linux; Android 4.4.2; en-us; SAMSUNG SM-N9005 Build/KOT49H) AppleWebKit/537.36 (KHTML, like Gecko) Version/1.5 Chrome/28.0.1500.94 Mobile Safari/537.36');
agents.push('Mozilla/5.0 (Linux; U; Android 4.1; en-gb; GT-N7100 Build/JRO03C) AppleWebKit/534.30 (KHTML, like Gecko) Version/4.0 Mobile Safari/534.30@-@524254924');

testArray(agents);

Sample output:

testing 27 unique user agent strings
User agent: Mozilla/5.0 (Linux; Android 4.4.2; en-gb; SAMSUNG GT-I9500 Build/KOT49H) AppleWebKit/537.36 (KHTML, like Gecko) Version/1.5 Chrome/28.0.1500.94 Mobile Safari/537.36
device.family: Samsung $2
User agent: Mozilla/5.0 (Linux; U; Android 2.2.1; ZiiLABS ZiiO7  Build/v2.02.04) AppleWebKit/528.18 (KHTML, like Gecko) Version/4.0 Mobile Safari/528.16
device.family: ZiiLABS $2
User agent: Mozilla/5.0 (Linux; Android 4.4.2; en-gb; SAMSUNG SM-T230 Build/KOT49H) AppleWebKit/537.36 (KHTML, like Gecko) Version/1.5 Chrome/28.0.1500.94 Safari/537.36
device.family: Samsung $2
User agent: Mozilla/5.0 (Linux; U; Android 2.2.1; ZiiLABS ZiiO7  Build/v2.00.13-FROYO) AppleWebKit/528.18 (KHTML, like Gecko) Version/4.0 Mobile Safari/528.16
device.family: ZiiLABS $2
User agent: Mozilla/5.0 (Linux; Android 4.4.2; en-us; SAMSUNG GT-I9295 Build/KOT49H) AppleWebKit/537.36 (KHTML, like Gecko) Version/1.5 Chrome/28.0.1500.94 Mobile Safari/537.36
device.family: Samsung $2
User agent: Mozilla/5.0 (Linux; U; Android 4.1.1; en-gb; PMP3970B Build/JRO03C) AppleWebKit/534.30 (KHTML, like Gecko) Version/4.0 Safari/534.30
device.family: Prestigio PMP3970B $2
User agent: Mozilla/5.0 (Linux; U; Android 4.1.1; en-us; PMP3970B Build/JRO03C) AppleWebKit/534.30 (KHTML, like Gecko) Version/4.0 Safari/534.30
device.family: Prestigio PMP3970B $2
User agent: Mozilla/5.0 (Linux; U; Android 4.4.2; en-gb; LG-D802 Build/KOT49I.D80220d) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/30.0.1599.103 Mobile Safari/537.36
device.family: LG-$2
User agent: Mozilla/5.0 (Linux; Android 4.4.2; en-gb; SAMSUNG SM-G900F Build/KOT49H) AppleWebKit/537.36 (KHTML, like Gecko) Version/1.6 Chrome/28.0.1500.94 Mobile Safari/537.36
device.family: Samsung $2
User agent: Mozilla/5.0 (Linux; Android 4.4.2; en-us; SAMSUNG SM-G900FD Build/KOT49H) AppleWebKit/537.36 (KHTML, like Gecko) Version/1.6 Chrome/28.0.1500.94 Mobile Safari/537.36
device.family: Samsung $2
User agent: Mozilla/5.0 (Linux; Android 4.4.2; en-gb; SAMSUNG GT-I9505/I9505XXUGNJ5 Build/KOT49H) AppleWebKit/537.36 (KHTML, like Gecko) Version/1.5 Chrome/28.0.1500.94 Mobile Safari/537.36
device.family: Samsung $2
User agent: Mozilla/5.0 (Linux; Android 4.4.2; ar-ae; SAMSUNG SM-N9005 Build/KOT49H) AppleWebKit/537.36 (KHTML, like Gecko) Version/1.5 Chrome/28.0.1500.94 Mobile Safari/537.36
device.family: Samsung SAMSUNG $2
User agent: Mozilla/5.0 (Linux; Android 4.4.4; en-gb; SAMSUNG SM-G901F Build/KTU84P) AppleWebKit/537.36 (KHTML, like Gecko) Version/1.6 Chrome/28.0.1500.94 Mobile Safari/537.36
device.family: Samsung $2
User agent: Mozilla/5.0 (Linux; Android 4.4.4; en-us; SAMSUNG SM-N910C Build/KTU84P) AppleWebKit/537.36 (KHTML, like Gecko) Version/2.0 Chrome/34.0.1847.76 Mobile Safari/537.36
device.family: Samsung $2
User agent: Mozilla/5.0 (Linux; Android 4.2.2; IdeaTab A3000-F Build/JDQ39) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/40.0.2214.89 Safari/537.36
device.family: Lenovo IdeaTab $2
User agent: Mozilla/5.0 (Linux; Android 4.4.2; en-gb; SAMSUNG SM-G900FD Build/KOT49H) AppleWebKit/537.36 (KHTML, like Gecko) Version/1.6 Chrome/28.0.1500.94 Mobile Safari/537.36
device.family: Samsung $2
User agent: Mozilla/5.0 (Linux; Android 5.0.1; HTC One_M8 Build/LRX22C) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/40.0.2214.89 Mobile Safari/537.36
device.family: HTC One $2 $3 $4
User agent: Mozilla/5.0 (Linux; Android 4.4.4; HTC_One_M8 Build/KTU84P) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/33.0.0.0 Mobile Safari/537.36
device.family: HTC One $2 $3 $4
User agent: Mozilla/5.0 (Linux; Android 4.4.4; HTC One_M8 Build/KTU84P) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/33.0.0.0 Mobile Safari/537.36
device.family: HTC One $2 $3 $4
User agent: Mozilla/5.0 (Linux; Android 4.4.2; en-us; SAMSUNG GT-I9505 Build/KOT49H) AppleWebKit/537.36 (KHTML, like Gecko) Version/1.5 Chrome/28.0.1500.94 Mobile Safari/537.36
device.family: Samsung $2
User agent: Mozilla/5.0 (Linux; Android 4.4.2; en-gb; SAMSUNG SM-T520 Build/KOT49H) AppleWebKit/537.36 (KHTML, like Gecko) Version/1.5 Chrome/28.0.1500.94 Safari/537.36
device.family: Samsung $2
User agent: Mozilla/5.0 (Linux; U; Android 4.4.2; en-gb; HTC_One_E8 Build/KOT49H) AppleWebKit/534.30 (KHTML, like Gecko) Version/4.0 Mobile Safari/534.30
device.family: HTC One $2 $3 $4
User agent: Mozilla/5.0 (Linux; U; Android 4.4.2; en-us; LG-D802 Build/KOT49I.D80220c) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/30.0.1599.103 Mobile Safari/537.36
device.family: LG-$2
User agent: Mozilla/5.0 (Linux; Android 4.4.2; LG-D802 Build/KOT49I.D80220c) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/30.0.1599.103 Mobile Safari/537.36
device.family: LG-$2
User agent: Mozilla/5.0 (Linux; Android 4.4.2; ar-ae; SAMSUNG SM-G900FD Build/KOT49H) AppleWebKit/537.36 (KHTML, like Gecko) Version/1.6 Chrome/28.0.1500.94 Mobile Safari/537.36
device.family: Samsung $2
User agent: Mozilla/5.0 (Linux; Android 4.4.2; en-us; SAMSUNG SM-N9005 Build/KOT49H) AppleWebKit/537.36 (KHTML, like Gecko) Version/1.5 Chrome/28.0.1500.94 Mobile Safari/537.36
device.family: Samsung SAMSUNG $2
User agent: Mozilla/5.0 (Linux; U; Android 4.1; en-gb; GT-N7100 Build/JRO03C) AppleWebKit/534.30 (KHTML, like Gecko) Version/4.0 Mobile Safari/534.30@-@524254924
device.family: Samsung undefined$2
success: 0
failure: 27

Output on 2.1.3:

testing 27 unique user agent strings
success: 27
failure: 0

Hope that helps.

@3rd-Eden
Copy link
Owner

3rd-Eden commented Feb 5, 2015

I'm assuming that the regexp.yml source file that I used changed format causing these kind of build failures. I'll look in to it tonight if can find some spare cycles. Thanks for your detailed report and testcase!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant