Issue Details (XML | Word | Printable)

Key: CORE-5409
Type: Bug Bug
Status: Open Open
Priority: Minor Minor
Assignee: Alexander Peshkov
Reporter: Artyom Smirnov
Votes: 0
Watchers: 1
Operations

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

Non-utf8 input from stdin in isql seems broken on linux

Created: 30/Nov/16 02:24 PM   Updated: 09/Dec/16 04:09 PM
Component/s: ISQL
Affects Version/s: 3.0.1, 3.0.2
Fix Version/s: None

Environment: Linux

QA Status: No test


 Description  « Hide
Prepare file in some non-utf8 encoding. Found this example text in fbt-repository:

echo 'recreate table "ĄČĘĢÆĖŠŚÖÜØ£"(
        "ąčęėįšųūž" varchar(50) character set dos775
        ,"Õisu ja kariste järved" blob sub_type 1 character set dos775
);' | iconv -f utf8 -t cp775 > test775.sql

Try to execute it from stdin:

cat test775.sql | bin/isql -ch dos775 -u sysdba -p masterkey localhost:/tmp/test.fdb
Use CONNECT or CREATE DATABASE to specify a database

And we will get error:

Expected end of statement, encountered EOF

 All   Comments   Change History   Subversion Commits      Sort Order: Ascending order - Click to sort in descending order
Alexander Peshkov added a comment - 30/Nov/16 02:40 PM
Could not reproduce:

localhost bin # cat test775.sql | ./isql -ch dos775 -u sysdba -p masterkey localhost:/tmp/test.fdb
recreate table "������������"(
        "���������" varchar(50) character set dos775
        ,"�isu ja kariste j�rved" blob sub_type 1 character set dos775
);
localhost bin # ./isql -u sysdba -p masterkey localhost:/tmp/test.fdb
Database: localhost:/tmp/test.fdb, User: SYSDBA
SQL> show table;
       ĄČĘĢÆĖŠŚÖÜØ£
SQL> show table "ĄČĘĢÆĖŠŚÖÜØ£";
ąčęėįšųūž VARCHAR(50) CHARACTER SET DOS775 Nullable
Õisu ja kariste järved BLOB segment 80, subtype TEXT CHARACTER SET DOS775 Nullable
SQL>

Artyom Smirnov added a comment - 01/Dec/16 12:49 PM
I can reproduce it on current 3.0 official binaries and own build with supplied editline library (external/editline). Can not reproduce it with --without-editline and --with-system-editline.

Alexander Peshkov added a comment - 09/Dec/16 04:09 PM
I tend to treat an ability to accept from stdin characters missing in selected locale as library implementation detail. Moreover what we have it builtin editline (skip such characters) looks better for me. I could not test with dos775 (my box is missing that particular locale) but I've tried with cp1251 (windows cyrillic) and if I set correct locale editline works fine:

localhost bin # export LANG=be_BY
localhost bin # bash
localhost bin # cat test1251.sql | ./isql -ch win1251 -e t775.fdb
recreate table "Белорусский"(
        "врачар" varchar(50) character set win1251
        ,"Блоб сабтип 1 чарактер сет" blob sub_type 1 character set win1251
);

Compare with:

localhost bin # export LANG=en_US.UTF-8
localhost bin # bash
localhost bin # cat test1251.sql | ./isql -ch win1251 -e t775.fdb
recreate table "
     "
50) character set win1251
        ,"
Expected end of statement, encountered EOF