Issue Details (XML | Word | Printable)

Key: CORE-5159
Type: Bug Bug
Status: Resolved Resolved
Resolution: Fixed
Priority: Major Major
Assignee: Adriano dos Santos Fernandes
Reporter: Dmitry Yemanov
Votes: 0
Watchers: 4
Operations

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

Regression: engine may throw transliteration errors when running from non-ASCII system path

Created: 20/Mar/16 11:45 AM   Updated: 23/Mar/16 03:32 PM
Component/s: Engine
Affects Version/s: 3.0 RC2, 4.0 Initial
Fix Version/s: 3.0.0, 4.0 Alpha 1

QA Status: Cannot be tested


 Description  « Hide
Unpack Firebird into some non-ASCII directory and try to create some ICU collation (or restore a backup with ICU attributes), for example:

c:\тест\firebird>gbak -r -v -p 8192 c:\firebird\test.fbk c:\firebird\test.fdb
gbak:opened file c:\firebird\test.fbk
gbak:transportable backup -- data in XDR format
gbak: backup file is compressed
gbak:backup version is 9
gbak: ERROR:arithmetic exception, numeric overflow, or string truncation
gbak: ERROR: Cannot transliterate character between character sets
gbak: ERROR:failed to create database c:\firebird\test.fdb
gbak:Exiting before completion due to errors

It works fine with FB 2.5. Stack trace for error:

  fbintl.dll!Jrd::CsConvert::convert()
  fbintl.dll!Firebird::IntlUtil::parseSpecificAttributes()
fbintl.dll!Jrd::getVersions()
  fbintl.dll!Jrd::UnicodeUtil::loadICU()
  fbintl.dll!Jrd::UnicodeUtil::getCollVersion()
  fbintl.dll!Firebird::IntlUtil::setupIcuAttributes()
  fbintl.dll!LCICU_setup_attributes()
  fbintl.dll!LD_setup_attributes()
  engine12.dll!Jrd::IntlManager::setupCollationAttributes()
  engine12.dll!setupSpecificCollationAttributes()
  engine12.dll!create_collation()
  engine12.dll!DFW_perform_work()
  engine12.dll!DFW_perform_system_work()
  engine12.dll!INI_format()
  engine12.dll!Jrd::JProvider::createDatabase()

Transliteration error happens because attributes are treated as ASCII:

charset cs;
IntlUtil::initAsciiCharset(&cs);

AutoPtr<CharSet> ascii(Jrd::CharSet::createInstance(*getDefaultMemoryPool(), 0, &cs));

IntlUtil::SpecificAttributesMap config;
IntlUtil::parseSpecificAttributes(ascii, configInfo.length(),
(const UCHAR*) configInfo.c_str(), &config);

but in fact it includes a "filename" attribute containing ANSI characters:

p = 0x00000000004a0dab "c:\тест\firebird\intl\fbintl;icu_versions=default"


 All   Comments   Change History   Subversion Commits      Sort Order: Ascending order - Click to sort in descending order
Dimitry Sibiryakov added a comment - 20/Mar/16 12:02 PM
Wasn't decided that configs have to be utf-8 only?..

Dmitry Yemanov added a comment - 20/Mar/16 12:33 PM
"filename" in config does not include the path, the problem is with runtime expansion of $(this). And for v3.0, I doubt it should be in UTF8, I foresee lots of troubles due to this (all I/O is ANSI based).