Bug 34251 - Some characters are replaced by question mark when displayed with less
Summary: Some characters are replaced by question mark when displayed with less
Status: RESOLVED FIXED
Alias: None
Product: Mageia
Classification: Unclassified
Component: RPM Packages (show other bugs)
Version: 9
Hardware: All Linux
Priority: Normal normal
Target Milestone: ---
Assignee: QA Team
QA Contact:
URL:
Whiteboard: MGA9-64-OK
Keywords: advisory, validated_update
Depends on:
Blocks:
 
Reported: 2025-05-07 13:32 CEST by papoteur
Modified: 2025-05-12 21:08 CEST (History)
4 users (show)

See Also:
Source RPM: less-632-1.2.mga9.src.rpm
CVE:
Status comment:


Attachments
text from man nmap without pagination (288.59 KB, text/plain)
2025-05-07 13:35 CEST, papoteur
Details

Description papoteur 2025-05-07 13:32:52 CEST
Some translated man pages are badly rendered, like nmap one in Russian:
nmap(1)                                                                        Справочное р��ководство Nmap                                                                       nmap(1)

НАЗВАНИЕ
       nmap - Утилита для исследования сети и сканер портов

СИНТАКСИС
       nmap [Тип сканирования...] [Опции] {цель сканирования}

ОПИСАНИЕ
       Nmap («Network Mapper») - это утилита с открытым исходным кодо�� для исследования сети и проверки безопасности. Она был�� разработана для быстрого сканирования больших сетей, хотя


Version-Release number of selected component (if applicable): 632


How reproducible: always
Comment 1 papoteur 2025-05-07 13:35:50 CEST
Created attachment 14971 [details]
text from man nmap without pagination

When you 'cat' this page, it is well displayed.
But when with less, there is question marks replacing some characters.
Comment 2 papoteur 2025-05-07 18:55:33 CEST
Submitted:
RPMS:
less-678-1.mga9

SRPMS:
less-678-1.mga9

Assignee: bugsquad => qa-bugs

Comment 3 katnatek 2025-05-07 21:49:21 CEST
For me still, some characters are printed with question marks 

rpm -q less
less-678-1.mga9
Comment 4 Herman Viaene 2025-05-09 11:54:05 CEST
Confirm result from katnatek: current version 632 and update 678 behave exactly the same way.

CC: (none) => herman.viaene

Comment 5 papoteur 2025-05-09 17:18:01 CEST
env|grep LESS
LESSCHARSET=koi8-r
...

However, it should be LESSCHARSET=utf-8

It is provided that the variable is set through a script /etc/profile.d/20less.sh [1]
Sourcing it let the env variable correctly.
Thus the problem is that when the script is sourced, locale is not yet defined.

How to fix that?

Papoteur

[1] Defined in the spec file

CHARSET=\$(locale charmap 2> /dev/null)
case "\$CHARSET" in
         UTF-8)
               export LESSCHARSET="\${LESSCHARSET:-utf-8}"
         ;;
         * )
             export LESSCHARSET="\${LESSCHARSET:-koi8-r}"
         ;;
esac
# Make a filter for less
export LESSOPEN="|/usr/bin/lesspipe.sh %s"
papoteur 2025-05-09 17:26:11 CEST

Assignee: qa-bugs => yvesbrungard

Comment 6 papoteur 2025-05-10 09:39:40 CEST
Submitted:
RPMS:
less-678-1.1.mga9

SRPMS:
less-678-1.1.mga9

This change the file 20less.sh which now avoid to define env variable LESSCHARSET. I checked that it is no more defined in Fedora without issue.
I also added a double | in LESSOPEN according to https://bugzilla.redhat.com/show_bug.cgi?id=1254837

Assignee: yvesbrungard => qa-bugs

katnatek 2025-05-11 02:03:02 CEST

Keywords: (none) => advisory

Comment 7 katnatek 2025-05-11 05:15:15 CEST
RH x86_64

installing less-678-1.1.mga9.x86_64.rpm from //home/katnatek/qa-testing/x86_64
Preparing...                     ##################################################################################################
      1/1: less                  ##################################################################################################
      1/1: removing less-678-1.mga9.x86_64
                                 ##################################################################################################
----------------------------------------------------------------------
More information on package less-678-1.1.mga9.x86_64
This version of less includes lesspipe.sh from Wolfgang Friebel
( https://www-zeuthen.desy.de/~friebel//unix/less/ ).

This enables you to view gz, bz2, lzma, zip, rpm and html files
among others with less. It works by setting the LESSOPEN 
environment variable, see the man pages for details.

If you want to disable this behavior, either use 'unset LESSOPEN' or
use an alias ( alias less='less -l' ).

less will open html files with lynx, then html2text, then cat if
none of the previous were found.

Need close and start session again to really make effect
Now the russian manual attached is clearly displayed without ? marks

Whiteboard: (none) => MGA9-64-OK
CC: (none) => andrewsfarm

Comment 8 Herman Viaene 2025-05-11 10:59:13 CEST
$ rpm -q less
less-678-1.1.mga9
I still see ?? on various places.
Comment 9 katnatek 2025-05-11 11:45:05 CEST
(In reply to Herman Viaene from comment #8)
> $ rpm -q less
> less-678-1.1.mga9
> I still see ?? on various places.

As I say in my test you have to close
session an star session again
If not the env variable is still present
Comment 10 Alexander T. 2025-05-11 14:03:44 CEST
uname -a
Linux localhost 6.6.88-desktop-3.mga9 
echo $LESSCHARSET
koi8-r
echo $DESKTOP_SESSION
01plasma

less -V
less 632 (POSIX regular expressions)
Copyright (C) 1984-2023  Mark Nudelman

echo $LESSCHARSET
koi8-r

Russian man pages are displayed incorrectly in the terminal "konsole", "terminator", etc.:
- question marks instead of letters, — " исследования сети и проверки безопасност��. ", there is no pattern
- violation of indentation boundaries in the text
- the letter " Л " is not displayed, — " ОПРЕДЕЕНИЕ ЦЕИ СКАНИРОВАНИЯ " (it should be " ОПРЕДЕЛЕНИЕ ЦЕЛИ СКАНИРОВАНИЯ ")

If you give the command " man nmap > ~/Text_nmap_RU.txt " , then all the text in the file will be correct.

After giving the command "unset LESSCHARSET" in the "konsole" terminal, and then immediately giving the command "man nmap", the terminal works correctly, only 1 time. That is, it is necessary to give the command "unset LESSCHARSET" every time before launching "man nmap" (or another "man_RU").

In the ROSA distribution, the "man nmap" command works correctly, and the text in the terminal is written correctly.
uname -a
Linux rosa-zg1jdz 6.12.16-generic-3rosa13-x86_64 
echo $LESSCHARSET
UTF-8
echo $DESKTOP_SESSION
plasma

CC: (none) => algri14

Comment 11 Alexander T. 2025-05-11 16:35:48 CEST
После обновления пакета до версии less-678-1.1.mga9 (из репозитория "Core Updates Testing"), все русские "man_RU" в терминале стали отображаться корректно.
After updating the package to less-678-1.1.mga9 (from the "Core Updates Testing" repository), all Russian "man_RU" in the terminal began to be displayed correctly.
Comment 12 Thomas Andrews 2025-05-12 03:29:09 CEST
Validating.

Keywords: (none) => validated_update
CC: (none) => sysadmin-bugs

Comment 13 Mageia Robot 2025-05-12 21:08:26 CEST
An update for this issue has been pushed to the Mageia Updates repository.

https://advisories.mageia.org/MGAA-2025-0047.html

Resolution: (none) => FIXED
Status: NEW => RESOLVED


Note You need to log in before you can comment on or make changes to this bug.