Opened 9 years ago

Closed 9 years ago

#6603 closed bug (fixed)

[Installer] not enough chars to store translated string (patch)

Reported by: diver Owned by: anevilyak
Priority: normal Milestone: R1
Component: Applications/Installer Version: R1/Development
Keywords: Cc:
Blocked By: Blocking:
Has a Patch: yes Platform: All

Description

This is hrev38644.

If you select Russian locale in ReadOnlyBootPrompt and then start Installer you'll see question marks in the black diamonds in the drop down menus. See screenshot.

Attachments (2)

installer.png (36.3 KB) - added by diver 9 years ago.
installer.diff (453 bytes) - added by diver 9 years ago.
possible patch

Download all attachments as: .zip

Change History (10)

Changed 9 years ago by diver

Attachment: installer.png added

comment:1 Changed 9 years ago by diver

comment:2 Changed 9 years ago by diver

Has a Patch: set

Changed 9 years ago by diver

Attachment: installer.diff added

possible patch

comment:3 Changed 9 years ago by korli

It seems ok to be applied.

comment:4 Changed 9 years ago by anevilyak

Owner: changed from korli to anevilyak
Status: newin-progress

comment:5 Changed 9 years ago by anevilyak

Resolution: fixed
Status: in-progressclosed

Applied in hrev38647. Thanks!

comment:6 Changed 9 years ago by siarzhuk

Resolution: fixed
Status: closedreopened

Aren't those "black diamonds" the sign that current implementation of "string_for_size" function is buggy? Looks like the string was just cut out regardless of real character boundaries. UTF-8 is not fixed-size symbol encoding. And much more elegant solution would be translating with "..." at end in case proposed buffer is not enough, IMO. Anyway this is a partial solution and I'm not sure, that 20 bytes "will be enough" for any language. ;-)

comment:7 Changed 9 years ago by siarzhuk

By the way another potential place for the same problem:

src/kits/tracker/InfoWindow.cpp

1548                 char capacityStr[16], usedStr[16], freeStr[16];
1549                 string_for_size(capacity, capacityStr, sizeof(capacityStr));
1550                 string_for_size(capacity - fFreeBytes, usedStr, sizeof(usedStr));
1551                 string_for_size(fFreeBytes, freeStr, sizeof(freeStr));

Other occuriences of using "string_for_size" are using either 1024 or 128 bytes for result buffer. ;-)

comment:8 Changed 9 years ago by korli

Resolution: fixed
Status: reopenedclosed

To me, if the bug reporter tested the patch OK, it is good enough. Please create a more general bug for the string_for_size() API problem.

Note: See TracTickets for help on using tickets.