patchThe GNU Bourne-Again SHell - Patches: patch #10076, fix regression in 5.1: cannot...

 
 

You are not allowed to post comments on this tracker with your current authentication level.

patch #10076: fix regression in 5.1: cannot enter cyrillic 'я' (ya) letter in 1-byte encoding cp1251

Submitter:  Volodymyr Prodan <vovcat>
Submitted:  Sun 06 Jun 2021 03:32:10 PM UTC
   
 
Category:  None Priority:  5 - Normal
Status:  Done Privacy:  Public
Assigned to:  None Open/Closed:  Open

Mon 07 Jun 2021 08:58:47 PM UTC, comment #2: 

Thanks for the report and fix.

Chet Ramey <chet>
Group administrator
Sun 06 Jun 2021 03:37:35 PM UTC, comment #1: 

To reploduce:


$ echo -e echo \'\\0377\' |PS1=@ LC_ALL=C ./bash --norc -i 2>&1 |hd
00000000  40 65 63 68 6f 20 27 27  0a ff 0a 40 65 78 69 74  |@echo ''.я.@exit|
00000010  0a                                                |.|
00000011


Expected output:


$ echo -e echo \'\\0377\' |PS1=@ LC_ALL=C bash --norc -i 2>&1 |hd
00000000  40 65 63 68 6f 20 27 ff  27 0a ff 0a 40 65 78 69  |@echo 'я'.я.@exi|
00000010  74 0a                                             |t.|
00000012


Volodymyr Prodan <vovcat>
Sun 06 Jun 2021 03:32:10 PM UTC, original submission:  

commit bbd6499ee7b260cfdea74d44b300e7096fb04489 (HEAD -> master)
Author: Volodymyr Prodan <vovcat@gmail.com>
Date:   Sun Jun 6 18:27:41 2021 +0300

    fix regression in 5.1: cannot enter cyrillic 'я' (ya) letter in 1-byte encoding cp1251
   
    In the bash-5.1 in file lib/readline/display.c in function update_line() a
    call to _rl_output_some_chars() was replaced by puts_face(), which doesn't
    print char if it is EOF (-1). In some encodings (cp1251 for example) char -1
    can encode regular letter.
   
    Fix it by casting character value to unsigned char.

diff --git lib/readline/display.c lib/readline/display.c
index 38b3d0e7..f5d32945 100644
--- lib/readline/display.c
+++ lib/readline/display.c
@@ -1598,7 +1598,7 @@ puts_face (const char *str, const char *face, int n)
   char cur_face;
 
   for (cur_face = FACE_NORMAL, i = 0; i < n; i++)
-    putc_face (str[i], face[i], &cur_face);
+    putc_face ((unsigned char) str[i], face[i], &cur_face);
   putc_face (EOF, FACE_NORMAL, &cur_face);
 }

Volodymyr Prodan <vovcat>

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attached Files

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by chet (Posted a comment)
  • -email is unavailable- added by vovcat (Submitted the item)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

     

    Follow 2 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2021-06-07 chet StatusNone Done
    2021-06-06 vovcat Attached File- Added cannot-enter-cyrillic-ya-letter.patch, #51522

    Back to the top

    Powered by Savane 3.13-d3ae.
    Corresponding source code