Bug 27274 - rpmdrake - %description formatting is lost in rpmdrake which gives poor impression.
Summary: rpmdrake - %description formatting is lost in rpmdrake which gives poor impre...
Status: NEW
Alias: None
Product: Mageia
Classification: Unclassified
Component: RPM Packages (show other bugs)
Version: Cauldron
Hardware: All Linux
Priority: Normal normal
Target Milestone: ---
Assignee: Mageia tools maintainers
QA Contact:
URL:
Whiteboard:
Keywords: Triaged
Depends on:
Blocks:
 
Reported: 2020-09-13 13:13 CEST by Barry Jackson
Modified: 2021-02-02 10:50 CET (History)
6 users (show)

See Also:
Source RPM: rpmdrake-6.30
CVE:
Status comment:


Attachments
Comparison of %description and rendering in rpmdrake (2.59 KB, text/plain)
2020-09-13 13:14 CEST, Barry Jackson
Details
dnfdragora info view after fixing (120.84 KB, image/png)
2020-09-13 17:31 CEST, Angelo Naselli
Details

Description Barry Jackson 2020-09-13 13:13:11 CEST
Description of problem: Carefully formatted text in package %description fields is rendered badly in rpmdrake making readability poor and giving a bad impression of Mageia to users.
Attached is an example of this in a text file taken from a random package (fldigi). 


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


How reproducible:


Steps to Reproduce:
1. Open rpmdrake from MCC
2. enter fldigi in the search
3. try to make sense of the package information :\
Comment 1 Barry Jackson 2020-09-13 13:14:30 CEST
Created attachment 11879 [details]
Comparison of %description and rendering in rpmdrake
Comment 2 Aurelien Oudelet 2020-09-13 16:30:56 CEST
Hi, Thanks reporting this.

I don't think such formatted text should appear on rpmdrake / urpmi in description of packages.
It should be provided as a README file as it gives some informations.

But my thought doesn't matter here.
Thanks for the provided screenshot.

Assigning to Mageia Tools maintainers.

CC: (none) => anaselli, ouaurelien, thierry.vignaud
Keywords: (none) => Triaged
Assignee: bugsquad => mageiatools

Comment 3 Barry Jackson 2020-09-13 16:46:12 CEST
Maybe 'formatting' is too strong a description.
It is only plain text and it seems that line feeds are being stripped out somewhere, which wrecks the display in rpmdrake. Tabs appear to be replaced with spaces which is fine if the line feeds are not removed.
This has not changed for years, but I think it is time it was fixed.
Comment 4 Angelo Naselli 2020-09-13 17:30:48 CEST
For what dnfdragora concern, you're right line feeds are not managed correctly. I've fixed it right now.
Comment 5 Angelo Naselli 2020-09-13 17:31:41 CEST
Created attachment 11882 [details]
dnfdragora info view after fixing
Comment 6 Angelo Naselli 2020-09-13 18:36:06 CEST
rpmdragora instead should manage it already as you can see here:
https://gitweb.mageia.org/software/manatools/tree/lib/ManaTools/Rpmdragora/gui.pm#n1260

dnfdragora widget use richtext so \n is changed to <br> but description is shown as in your attachment, so i'd expect the problem is not in GUI rpmdrake or rpmdragora, but in how description is returned from api.

I maybe wrong since it is a lot of time i am not programming perl... but i printed the returned string where <br> replaced \n and it seems not returning same string as dnfdaeomon... see belove

Fldigi is a software modem for Amateur Radio use. It is a sound card based program that is used for both transmitting and receiving data in any of the following modes:<br><br>BPSK and QPSK        31, 63, 125, 250 (both), and 63F and 500 (BPSK only) PSKR                 125, 250, and 500 CW                   speeds from 5 to 200 wpm DominoEX             4, 5, 8, 11, 16 and 22; also with FEC Hellschreiber        Feld Hell, Slow Hell, Hell x5/x9, FSKHell(-105) and Hell 80 MFSK                 4, 8, 11, 16, 22, 31, 32 and 64; most with image support MT63                 500, 1000 and 2000 OLIVIA               various tones and bandwidths RTTY                 various baud rates, shifts, nbr. of data bits, etc. THOR                 4, 5, 8, 11, 16 and 22 Throb and ThrobX     1, 2, and 4 WWV                  receive only - calibrate your sound card to WWV Frequency Analysis   receive only - measure the frequency of a carrier<br><br>Fldigi can also control a transceiver using Hamlib or RigCAT I/O, perforopen_rpm_db is deprecated use Rpmdragora::DB instead
 at /usr/share/perl5/vendor_perl/ManaTools/Rpmdragora/pkg.pm line 209.
m online or cdrom QRZ queries, log QSOs with the built-in logbook or Xlog, and send reception reports to the PSK Automatic Propagation Reporter.<br><br>
Comment 7 Martin Whitaker 2020-09-13 20:30:46 CEST
rpmdrake splits the description into paragraphs. A new paragraph is started by either a blank line or a line starting with one of *, -, +, or o (with or without leading white space). So you can use one of those options to maintain your line structure.

The description is normally displayed in a proportional font, so your vertical alignment is almost certainly doomed.

CC: (none) => mageia

Comment 8 Angelo Naselli 2020-09-13 22:05:16 CEST
Are you saying that we use a kind of proprietary mark-up language for description? and do we have an explanation somewhere?
Comment 9 Martin Whitaker 2020-09-13 22:13:03 CEST
(In reply to Angelo Naselli from comment #8)
> Are you saying that we use a kind of proprietary mark-up language for
> description?

Yes.

> and do we have an explanation somewhere?

Not that I can find, other than the rpmdrake source code. I vaguely remembered seeing such things when using rpmdrake so went looking. 

Note that http://ftp.rpm.org/max-rpm/s1-rpm-specref-preamble.html says:

"The %description tag is used to define an in-depth description of the packaged software. In the descriptive text, a space in the first column indicates that that line of text should be presented to user as-is, with no formatting done by RPM. Blank lines in the descriptive text denote paragraphs."

so we partly comply with that, partly go against it.
Matteo Pasotti 2020-09-13 22:25:55 CEST

CC: (none) => matteo.pasotti

Comment 10 Angelo Naselli 2020-09-13 22:52:41 CEST
So the conclusion is that this issue has to be addressed to fldigi package maintainer then...
Comment 11 Barry Jackson 2020-09-14 01:04:24 CEST
Well it's not only fldigi, that was just the first one that came to mind as having a longish description.

There are probably hundreds of packages that this affects.
I wonder how many packagers know about this 'mark-up'?
I have never come across it and have even commented about this problem in dev-irc in the past.

So the easy solution is to add spaces to the start of each line in the %description to at least get line breaks in the right places in rpmdrake.

Thanks Martin :)

Regarding column alignment, if it's only indentation that is required to make a psudo bulleted list, then it should look OK with a few spaces after the leading space to indent a list.
Comment 12 Angelo Naselli 2020-09-14 08:11:45 CEST
Indeed, i don't think that's the right way to... at least if rpmdrake is the only one who knows that... anyway let's go on...
Comment 13 Martin Whitaker 2020-09-14 10:21:04 CEST
@Barry, no, rpmdrake doesn't use the leading space rule, it detects the bullet markers (-, +, *, o). Not using the leading space rule allows multi-line bullet points (and I quite quickly found an example that did that).

Running this awk script

  BEGIN { in_desc = 0; found = 0; count = 0; }
  in_desc == 1 && /^%/ { if (found) count++; in_desc = 0; }
  /^%description/ { print FILENAME; in_desc = 1; found = 0; }
  in_desc == 1 && /^\s*[-+*o]\s/ { print $0; found = 1; }
  END { print "Found ", count; }

over the cauldron spec files tells me that there are 1156 %description sections that use this feature.

We should write this up on the Wiki somewhere.
Comment 14 Barry Jackson 2020-09-14 11:55:41 CEST
Sorry Martin I thought your explanation in #7 was in addition to the space rule.

In that case we have no means of telling rpmdrake to not interfere with the %description as provided in the spec.
All line breaks that do not start a new paragraph (like this one) are lost and we can't do anything to keep them.

If I now understand correctly? :)
Comment 15 Martin Whitaker 2020-09-14 12:33:12 CEST
Maybe an example helps:

%description
This starts a paragraph
that will wrap according to the window width
and stops here due to the following blank line.

This starts a new paragraph:
* this starts a new line
  which continues here
  and also wraps according to the window width
 * this also starts a new line - the leading space is removed

will be displayed like this:

This starts a paragraph that will wrap according to the window width and stops here due to the following blank line.

This starts a new paragraph:
* this starts a new line which continues here and also wraps according to the window width
* this also starts a new line - the leading space is removed

For a real example (plucked at random) see libalglib3.
Comment 16 Morgan Leijström 2021-02-02 10:50:39 CET
(In reply to Martin Whitaker from comment #13)
> We should write this up on the Wiki somewhere.

I added last point at
 https://wiki.mageia.org/en/Packaging_hints
linking to this nice example comment 15 for now.

CC: (none) => fri


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