Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 752126

Summary: app-misc/gcal-4.1: broken alignment when unicode chars present
Product: Gentoo Linux Reporter: Nikita Zlobin <cook60020tmp>
Component: Current packagesAssignee: Gentoo Shell Tools project <shell-tools>
Status: UNCONFIRMED ---    
Severity: normal CC: jstein, sam
Priority: Normal    
Version: unspecified   
Hardware: All   
OS: Linux   
Whiteboard:
Package list:
Runtime testing required: ---

Description Nikita Zlobin 2020-11-01 15:35:22 UTC
When printing eternal events list, words with russian letters before them are aligned as if russian letters occupied two places instead of one.

Reproducible: Always

Steps to Reproduce:
1. Try this (assuming russian locale, no idea with others, to have multibyte/national chars in output):
$ gcal -i- --date-format='%1 %<02*D %<20u*U %Y %2' --cc-holidays=RU -n 2020
1.1. For other locales, different from english (if they have unicode chars in alphabet) you may need to change value for --cc-holidays.
2. Try same command propended with LANG=C.
Actual Results:  
Only second result is properly aligned. In first result it's true only for words without national chars (untranslated). E.g., May word is untranslated, so it has longest indentation before year. Feb and Jan are translated for me, with February longer then January, and intendation after them is less, with least for Feb. Translated (russian) descriptions break indentation so much, that even sign before date may disappear.

Expected Results:  
Correct indentation with all utf chars, supported by terminal.

I have gcal with unicode flag.
Full command I tried:
gcal -i- --date-format='%1 %<02*D %<20u*U %Y %2' --highlighting="$(tput setaf 15)$(tput setab 2)$(tput bold):$(tput sgr0):$(tput setaf 11)$(tput bold):$(tput sgr0)" --cc-holidays=RU -n 2020
(for now I have to stick to %M for month)

My toolchain is somewhat outdated. For example (could affect gcal):
glibc-2.29-r7, gcc-7.4.0-r2, binutils-2.32-r1
Comment 1 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2021-06-13 04:51:07 UTC
I think this may need reporting upstream.
Comment 2 Larry the Git Cow gentoo-dev 2024-03-12 02:50:13 UTC
The bug has been referenced in the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=4a64470630d064066a66fb31291796c346616a0f

commit 4a64470630d064066a66fb31291796c346616a0f
Author:     Sam James <sam@gentoo.org>
AuthorDate: 2024-03-12 02:49:06 +0000
Commit:     Sam James <sam@gentoo.org>
CommitDate: 2024-03-12 02:49:06 +0000

    app-misc/gcal: fix ncurses detection w/ split tinfo
    
    This may fix bug #752126 (not betting on it, but still). If it doesn't, perhaps
    using ncursesw would...?
    
    Bug: https://bugs.gentoo.org/752126
    Signed-off-by: Sam James <sam@gentoo.org>

 app-misc/gcal/files/gcal-4.1-fix-ncurses.patch | 38 ++++++++++++++++
 app-misc/gcal/gcal-4.1-r3.ebuild               | 63 ++++++++++++++++++++++++++
 2 files changed, 101 insertions(+)