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

Non-ASCII data in SEC$USERS is not read correctly [CORE4301] #4624

Closed
firebird-issue-importer opened this issue Dec 19, 2013 · 17 comments
Closed

Comments

@firebird-issue-importer

Submitted by: @sim1984

Is related to QA584

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 ????????????

Commits: 79c6b21 FirebirdSQL/fbt-repository@07fe6f6

====== 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.

@firebird-issue-importer
Copy link
Author

firebird-issue-importer commented Dec 19, 2013

Commented by: @sim1984

Database create as

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

@firebird-issue-importer
Copy link
Author

firebird-issue-importer commented Dec 19, 2013

Modified by: @sim1984

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 ????????????

summary: User comment distorts non-ASCII characters => Comment for users and user attributes distorts non-ASCII characters

@firebird-issue-importer
Copy link
Author

firebird-issue-importer commented Dec 19, 2013

Modified by: Sean Leyne (seanleyne)

summary: Comment for users and user attributes distorts non-ASCII characters => COMMENT ON USER with non-ASCII characters are not saved correctly

@firebird-issue-importer
Copy link
Author

firebird-issue-importer commented Dec 19, 2013

Commented by: Sean Leyne (seanleyne)

I don't agree that should have a "Major" priority.

@firebird-issue-importer
Copy link
Author

firebird-issue-importer commented Jan 27, 2014

Modified by: @sim1984

priority: Major [ 3 ] => Minor [ 4 ]

@firebird-issue-importer
Copy link
Author

firebird-issue-importer commented Jan 27, 2014

Commented by: @sim1984

I agree.

@firebird-issue-importer
Copy link
Author

firebird-issue-importer commented Jan 29, 2014

Commented by: @asfernandes

They are saved correctly. They are not read correctly.

@firebird-issue-importer
Copy link
Author

firebird-issue-importer commented Jan 29, 2014

Modified by: @asfernandes

assignee: Adriano dos Santos Fernandes [ asfernandes ]

@firebird-issue-importer
Copy link
Author

firebird-issue-importer commented Jan 29, 2014

Modified by: @asfernandes

Version: 3.0 Alpha 2 [ 10560 ]

summary: COMMENT ON USER with non-ASCII characters are not saved correctly => Non-ASCII data in SEC$USERS is not read correctly

@firebird-issue-importer
Copy link
Author

firebird-issue-importer commented Jan 29, 2014

Modified by: @asfernandes

status: Open [ 1 ] => Resolved [ 5 ]

resolution: Fixed [ 1 ]

Fix Version: 3.0 Beta 1 [ 10332 ]

@firebird-issue-importer
Copy link
Author

firebird-issue-importer commented Mar 29, 2014

Modified by: @pcisar

Link: This issue is related to QA584 [ QA584 ]

@firebird-issue-importer
Copy link
Author

firebird-issue-importer commented Mar 26, 2015

Commented by: @pavel-zotov

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

@firebird-issue-importer
Copy link
Author

firebird-issue-importer commented Mar 26, 2015

Commented by: @pavel-zotov

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

@firebird-issue-importer
Copy link
Author

firebird-issue-importer commented May 28, 2015

Modified by: @pavel-zotov

status: Resolved [ 5 ] => Resolved [ 5 ]

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.

@firebird-issue-importer
Copy link
Author

firebird-issue-importer commented May 28, 2015

Modified by: @pavel-zotov

status: Resolved [ 5 ] => Resolved [ 5 ]

Test Specifics: [Custom configuration required]

@firebird-issue-importer
Copy link
Author

firebird-issue-importer commented Sep 23, 2015

Commented by: @pcisar

Test created.

@firebird-issue-importer
Copy link
Author

firebird-issue-importer commented Sep 23, 2015

Modified by: @pcisar

status: Resolved [ 5 ] => Closed [ 6 ]

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

2 participants