This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 257499 - breakpoint_set Problem for Turkish Locale
Summary: breakpoint_set Problem for Turkish Locale
Status: RESOLVED FIXED
Alias: None
Product: php
Classification: Unclassified
Component: Debugger (show other bugs)
Version: 8.2
Hardware: PC Windows 10 x64
: P2 normal (vote)
Assignee: Tomas Mysik
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-01-10 12:15 UTC by threedot
Modified: 2016-05-27 12:30 UTC (History)
3 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
toLowerCase Locale Correction (692 bytes, patch)
2016-01-28 16:23 UTC, threedot
Details | Diff
toLowerCase locale correction 2 (5.55 KB, patch)
2016-02-02 15:14 UTC, threedot
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description threedot 2016-01-10 12:15:53 UTC
My OS is configured to TR_tr locale and default character set is iso-8859-9 for ANSI encoding.

I put some breakpoints to PHP files on my remote development machine (Debian GNU/Linux 7.6) but breakpoints are not hit.

I looked up to xdebug.log on my remote machine and i saw following character set problem.

<- breakpoint_set -i 11 -t lýne -s enabled -f file:///srv/www/dev.tr/sakila/public/error.php -n 35
-> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" command="breakpoint_set" transaction_id="11" status="break" reason="ok"><error code="3"><message><![CDATA[invalid or missing options]]></message></error></response>

lýne should be line. I discovered the issue that combine of problems.

In turkish locale, I to lower case ı and İ to lower case i.
Bytecode of ı character in iso-8859-9 is represents to ý in iso-8859-1.

I wrote a PoC for this issue: https://gist.github.com/tugrul/9ba8b4a5ee2e4c86261f
Comment 1 Tomas Mysik 2016-01-27 09:08:09 UTC
I am not sure but I think that these lines are written by Xdebug itself and not
NetBeans. But I am not sure, I need to verify it first. Feel free to do it, if
you would like to help us :)

Thanks for reporting.
Comment 2 threedot 2016-01-28 16:23:20 UTC
Created attachment 158273 [details]
toLowerCase Locale Correction
Comment 3 threedot 2016-01-28 16:25:38 UTC
@Tomas I added a patch file to resolve this issue. This solution should apply to all of the enum types like that pattern.
Comment 4 Tomas Mysik 2016-01-29 06:58:42 UTC
(In reply to threedot from comment #3)
> @Tomas I added a patch file to resolve this issue. This solution should
> apply to all of the enum types like that pattern.

Perfect! Thanks a lot for your time and your patch! I will apply it soon.

Thanks.
Comment 5 Tomas Mysik 2016-01-29 07:28:17 UTC
Patch applied, feel free to verify it (wait for a message that will appear here automatically saying in which dev build of NetBeans this change will be present).

Thanks.

http://hg.netbeans.org/web-main/rev/00a16c36d179
Comment 6 threedot 2016-01-29 14:03:46 UTC
(In reply to Tomas Mysik from comment #5)
> Patch applied, feel free to verify it (wait for a message that will appear
> here automatically saying in which dev build of NetBeans this change will be
> present).
> 
> Thanks.
> 
> http://hg.netbeans.org/web-main/rev/00a16c36d179

Thank you. It looks like OK but if there are some convention in other classes like "public enum Type" and "toString().toLowerCase()" should replace like this solution. 

I can't discover because project cloning is too hard using mercurial is too slow. I waited to clone for minutes and I couldn't have it.


Finally i fetched single file (BrkpntSetCommand.java) from repo and edit it manually.
Comment 7 Quality Engineering 2016-01-30 03:31:35 UTC
Integrated into 'main-silver', will be available in build *201601300002* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)

Changeset: http://hg.netbeans.org/main-silver/rev/00a16c36d179
User: Tomas Mysik <tmysik@netbeans.org>
Log: #257499 - breakpoint_set Problem for Turkish Locale

Patch contributed by threedot@netbeans.org.
Comment 8 Tomas Mysik 2016-02-01 09:06:01 UTC
There is no other LINE constant in any other enum so your use case may be fixed. If you confirm it, I will change all the toLowerCase() calls.

Thanks.
Comment 9 threedot 2016-02-02 15:14:03 UTC
Created attachment 158354 [details]
toLowerCase locale correction 2
Comment 10 threedot 2016-02-02 15:15:36 UTC
(In reply to Tomas Mysik from comment #8)
> There is no other LINE constant in any other enum so your use case may be
> fixed. If you confirm it, I will change all the toLowerCase() calls.
> 
> Thanks.

I downloaded shallow copy of the project and i changed for other places and i attached the patch
Comment 11 Tomas Mysik 2016-02-03 06:30:07 UTC
(In reply to Quality Engineering from comment #7)
> Integrated into 'main-silver', will be available in build *201601300002* on
> http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
> 
> Changeset: http://hg.netbeans.org/main-silver/rev/00a16c36d179
> User: Tomas Mysik <tmysik@netbeans.org>
> Log: #257499 - breakpoint_set Problem for Turkish Locale
> 
> Patch contributed by threedot@netbeans.org.

Have you tried this build please? Is the issue still present?

Thanks.
Comment 12 kodlayici 2016-03-07 22:23:59 UTC
I was tested the patch with Netbeans 201603070002. Here is the results:

Log opened at 2016-03-07 22:05:16
I: Connecting to configured address/port: 127.0.0.1:9000.
I: Connected to client. :-)
-> <init xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" fileuri="file:///D:/inetpub/wwwroot/sedd/index.php" language="PHP" xdebug:language_version="5.6.1-dev" protocol_version="1.0" appid="9780" idekey="netbeans-xdebug"><engine version="2.4.0"><![CDATA[Xdebug]]></engine><author><![CDATA[Derick Rethans]]></author><url><![CDATA[http://xdebug.org]]></url><copyright><![CDATA[Copyright (c) 2002-2016 by Derick Rethans]]></copyright></init>

<- feature_set -i 7 -n show_hıdden -v 1
-> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" command="feature_set" transaction_id="7" status="starting" reason="ok"><error code="3"><message><![CDATA[invalid or missing options]]></message></error></response>

<- feature_set -i 8 -n max_depth -v 3
-> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" command="feature_set" transaction_id="8" feature="max_depth" success="1"></response>

<- feature_set -i 9 -n max_chıldren -v 30
-> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" command="feature_set" transaction_id="9" status="starting" reason="ok"><error code="3"><message><![CDATA[invalid or missing options]]></message></error></response>

<- feature_set -i 10 -n max_data -v 2048
-> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" command="feature_set" transaction_id="10" feature="max_data" success="1"></response>

<- breakpoint_set -i 11 -t line -s enabled -f file:///D:/inetpub/wwwroot/hotspot/local/www/sedd/modules/Hesap_Yonetimi/Hesaplar/Hesaplar.php -n 177
-> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" command="breakpoint_set" transaction_id="11" state="enabled" id="97800001"></response>

<- run -i 12
-> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" command="run" transaction_id="12" status="stopping" reason="ok"></response>

breakpoint_set command has valid characters, but "show_hidden" and "max_children" attribute names is invalid, they has "ı" chars instead of "i" like "breakpoint_set" old "line" command befaore this patch.

i think debugger protocol commands, attributes or names (reserved words like feature_set, line, max_children) must be constant and should not be convert upper or lower case depending system locale.
Comment 13 kodlayici 2016-03-07 22:38:47 UTC
the patch must be in php.dbgp/src/org/netbeans/modules/php/dbgp/packets/FeatureGetCommand.java:

public String toString()
    {
      return super.toString().toLowerCase();
    }

to

public String toString()
    {
      return super.toString().toLowerCase(Locale.US);
    }

or

change static enum strings to lowercase (statically) in all classes in dbgp module and do not convert to lowercase at runtime
Comment 14 Tomas Mysik 2016-05-27 12:24:33 UTC
Will change all enums. Thanks guys for your cooperation and help!
Comment 15 Tomas Mysik 2016-05-27 12:30:08 UTC
Should be fixed now I hope. Please verify if possible, thanks.

http://hg.netbeans.org/web-main/rev/ab17d1583434