Issue Details (XML | Word | Printable)

Key: CORE-4301
Type: Bug Bug
Status: Closed Closed
Resolution: Fixed
Priority: Minor Minor
Assignee: Adriano dos Santos Fernandes
Reporter: Simonov Denis
Votes: 0
Watchers: 2
Operations

If you were logged in you would be able to see more operations.
Firebird Core

Non-ASCII data in SEC$USERS is not read correctly

Created: 19/Dec/13 03:39 PM   Updated: 23/Sep/15 12:45 PM
Component/s: None
Affects Version/s: 3.0 Alpha 1, 3.0 Alpha 2
Fix Version/s: 3.0 Beta 1

Environment: windows 7 x86, isql
Issue Links:
Relate
 

QA Status: Done with caveats
Test Details:
For test content of COMMENTS field firebird.conf should contain: UserManager = Srp.
Currently it is not so on test-running host, so it was decided to check only content of FIRST_NAME field which is available on any value of `UserManager` parameter.
Test Specifics: Custom configuration required


 Description  « Hide
User comment distorts non-ASCII characters

c:\Program Files\Firebird\Firebird_3_0>chcp 1251
Текущая кодовая страница: 1251

c:\Program Files\Firebird\Firebird_3_0>isql
Use CONNECT or CREATE DATABASE to specify a database
SQL> set names win1251;
SQL> connect 'localhost/3051:test' user 'sysdba' password 'masterkey';
Database: 'localhost/3051:test', User: sysdba
SQL> create table T1(id integer);
SQL> commit;
SQL> comment on table T1 is 'Моя таблица';
SQL> commit;
SQL> select r.rdb$description as descr
CON> from rdb$relations r
CON> where r.rdb$relation_name = 'T1';

            DESCR
=================
              0:3
==============================================================================
DESCR:
Моя таблица
==============================================================================

SQL> create user user1 password '123';
SQL> commit;
SQL> comment on user user1 is 'Новый пользователь';
SQL> commit;
SQL> select u.sec$description as descr
CON> from sec$users u
CON> where u.sec$user_name = 'USER1';

            DESCR
=================
              0:5
==============================================================================
DESCR:
?????????? ????????????????????????
==============================================================================

SQL> alter user user1 set tags(tag1='привет');
SQL> commit;
SQL> select * from sec$user_attributes;

SEC$USER_NAME SEC$KEY SEC$VALUE


=============================== =============================== ========================================================
=======================
USER1 TAG1 ????????????


 All   Comments   Change History   Subversion Commits      Sort Order: Ascending order - Click to sort in descending order
Simonov Denis added a comment - 19/Dec/13 03:41 PM
Database create as

CREATE DATABASE 'localhost/3051:TEST'
USER 'SYSDBA' PASSWORD 'masterkey'
PAGE_SIZE 8192
DEFAULT CHARACTER SET WIN1251;

Simonov Denis made changes - 19/Dec/13 03:46 PM
Field Original Value New Value
Summary User comment distorts non-ASCII characters Comment for users and user attributes distorts non-ASCII characters
Description User comment distorts non-ASCII characters

c:\Program Files\Firebird\Firebird_3_0>chcp 1251
Текущая кодовая страница: 1251

c:\Program Files\Firebird\Firebird_3_0>isql
Use CONNECT or CREATE DATABASE to specify a database
SQL> set names win1251;
SQL> connect 'localhost/3051:test' user 'sysdba' password 'masterkey';
Database: 'localhost/3051:test', User: sysdba
SQL> create table T1(id integer);
SQL> commit;
SQL> comment on table T1 is 'Моя таблица';
SQL> commit;
SQL> select r.rdb$description as descr
CON> from rdb$relations r
CON> where r.rdb$relation_name = 'T1';

            DESCR
=================
              0:3
==============================================================================
DESCR:
Моя таблица
==============================================================================

SQL> create user user1 password '123';
SQL> commit;
SQL> comment on user user1 is 'Новый пользователь';
SQL> commit;
SQL> select u.sec$description as descr
CON> from sec$users u
CON> where u.sec$user_name = 'USER1';

            DESCR
=================
              0:5
==============================================================================
DESCR:
?????????? ????????????????????????
==============================================================================

SQL>
User comment distorts non-ASCII characters

c:\Program Files\Firebird\Firebird_3_0>chcp 1251
Текущая кодовая страница: 1251

c:\Program Files\Firebird\Firebird_3_0>isql
Use CONNECT or CREATE DATABASE to specify a database
SQL> set names win1251;
SQL> connect 'localhost/3051:test' user 'sysdba' password 'masterkey';
Database: 'localhost/3051:test', User: sysdba
SQL> create table T1(id integer);
SQL> commit;
SQL> comment on table T1 is 'Моя таблица';
SQL> commit;
SQL> select r.rdb$description as descr
CON> from rdb$relations r
CON> where r.rdb$relation_name = 'T1';

            DESCR
=================
              0:3
==============================================================================
DESCR:
Моя таблица
==============================================================================

SQL> create user user1 password '123';
SQL> commit;
SQL> comment on user user1 is 'Новый пользователь';
SQL> commit;
SQL> select u.sec$description as descr
CON> from sec$users u
CON> where u.sec$user_name = 'USER1';

            DESCR
=================
              0:5
==============================================================================
DESCR:
?????????? ????????????????????????
==============================================================================

SQL> alter user user1 set tags(tag1='привет');
SQL> commit;
SQL> select * from sec$user_attributes;

SEC$USER_NAME SEC$KEY SEC$VALUE


=============================== =============================== ========================================================
=======================
USER1 TAG1 ????????????
Sean Leyne made changes - 19/Dec/13 04:22 PM
Summary Comment for users and user attributes distorts non-ASCII characters COMMENT ON USER with non-ASCII characters are not saved correctly
Sean Leyne added a comment - 19/Dec/13 04:23 PM
I don't agree that should have a "Major" priority.

Simonov Denis made changes - 27/Jan/14 08:41 AM
Priority Major [ 3 ] Minor [ 4 ]
Simonov Denis added a comment - 27/Jan/14 08:42 AM
I agree.

Adriano dos Santos Fernandes added a comment - 29/Jan/14 03:29 PM
They are saved correctly. They are not read correctly.

Adriano dos Santos Fernandes made changes - 29/Jan/14 03:29 PM
Assignee Adriano dos Santos Fernandes [ asfernandes ]
Adriano dos Santos Fernandes made changes - 29/Jan/14 03:30 PM
Summary COMMENT ON USER with non-ASCII characters are not saved correctly Non-ASCII data in SEC$USERS is not read correctly
Affects Version/s 3.0 Alpha 2 [ 10560 ]
Adriano dos Santos Fernandes made changes - 29/Jan/14 03:36 PM
Status Open [ 1 ] Resolved [ 5 ]
Fix Version/s 3.0 Beta 1 [ 10332 ]
Resolution Fixed [ 1 ]
Pavel Cisar made changes - 29/Mar/14 05:46 PM
Link This issue is related to QA-584 [ QA-584 ]
Pavel Zotov added a comment - 26/Mar/15 07:13 PM
How can it be explained that if:

1) create new database:

$ /opt/fb30ss/bin/isql -q
SQL> set names utf8;
SQL> create database '192.168.0.220/3333:/var/db/fb30/c4301.fdb' default character set utf8;
SQL> show version;
ISQL Version: LI-T3.0.0.31740 Firebird 3.0 Beta 2
Server version:
Firebird/Linux/AMD/Intel/x64 (access method), version "LI-T3.0.0.31740 Firebird 3.0 Beta 2"
Firebird/Linux/AMD/Intel/x64 (remote server), version "LI-T3.0.0.31740 Firebird 3.0 Beta 2/tcp (oel64)/P13"
Firebird/Linux/AMD/Intel/x64 (remote interface), version "LI-T3.0.0.31740 Firebird 3.0 Beta 2/tcp (oel64)/P13"
on disk structure version 12.0

2) and run script with only ASCII characters:

drop user tmp$c4301a;
commit;
drop user tmp$c4301b;
commit;
create user tmp$c4301a password '123';
commit;
create user tmp$c4301b password '123';
commit;
comment on user tmp$c4301a is 'This is user tmp$c4301a';
commit;
comment on user tmp$c4301b is 'This is user tmp$c4301b';
commit;
set blob all;
set list on;
select u.SEC$USER_NAME, u.sec$description as descr
from sec$users u
where upper(u.sec$user_name) starting with upper('tmp$c4301');

-- then result is NULLs in the sec$description:

SEC$USER_NAME TMP$C4301A
DESCR <null>

SEC$USER_NAME TMP$C4301B
DESCR <null>

-- ?

PS.
$ cat firebird.conf
AuthClient = Legacy_Auth,Srp,Win_Sspi
AuthServer = Legacy_Auth,Srp

DefaultDbCachePages = 8K

ExternalFileAccess = Restrict /var/db/fb30
FileSystemCacheThreshold = 65536K

LockMemSize = 64M
LockHashSlots = 22111

MaxUserTraceLogSize = 99999
RemoteServicePort = 3333
TempCacheLimit = 2147483647
TempDirectories = /dev/shm;/tmp
UserManager = Legacy_UserManager
WireCrypt = Disabled

Pavel Zotov added a comment - 26/Mar/15 07:51 PM
Sorry for my previous stupid post, the reason was obvious: usage of UserManager = Legacy_UserManager in config.

If run this test on standard firebird.conf than all OK:

$ /opt/fb30ss/bin/isql -q
SQL> set names utf8;
SQL> create database 'localhost/3333:/var/db/fb30/c4301.fdb' default character set utf8;
SQL> create user u30a password 'u30a'; commit;
SQL> create user u30b password 'u30b'; commit;
SQL> comment on user u30a is 'это кто-то из наших'; commit;
SQL> comment on user u30b is 'é alguém do Brasil'; commit;
SQL> select u.SEC$USER_NAME, u.sec$description as descr
CON> from sec$users u
CON> where upper(u.sec$user_name) starting with upper('u30');

SEC$USER_NAME DESCR
=============================== =================
U30A 0:5
==============================================================================
DESCR:
это кто-то из наших
==============================================================================
U30B 0:8
==============================================================================
DESCR:
é alguém do Brasil
==============================================================================

Pavel Zotov made changes - 28/May/15 02:37 PM
Status Resolved [ 5 ] Resolved [ 5 ]
Test Details For test content of COMMENTS field firebird.conf should contain: UserManager = Srp.
Currently it is not so on test-running host, so it was decided to check only content of FIRST_NAME field which is available on any value of `UserManager` parameter.
QA Status Done with caveats
Pavel Zotov made changes - 28/May/15 02:39 PM
Status Resolved [ 5 ] Resolved [ 5 ]
Test Specifics [Custom configuration required]
Pavel Cisar added a comment - 23/Sep/15 12:45 PM
Test created.

Pavel Cisar made changes - 23/Sep/15 12:45 PM
Status Resolved [ 5 ] Closed [ 6 ]