From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id 30CD0138334 for ; Tue, 24 Sep 2019 17:57:52 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 573E5E08D4; Tue, 24 Sep 2019 17:57:51 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 3E2A5E08D4 for ; Tue, 24 Sep 2019 17:57:51 +0000 (UTC) Received: from oystercatcher.gentoo.org (unknown [IPv6:2a01:4f8:202:4333:225:90ff:fed9:fc84]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 5943934B3EC for ; Tue, 24 Sep 2019 17:57:49 +0000 (UTC) Received: from localhost.localdomain (localhost [IPv6:::1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id D133F7F9 for ; Tue, 24 Sep 2019 17:57:47 +0000 (UTC) From: "Sven Eden" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Sven Eden" Message-ID: <1569347832.5df696152a15ab827381d524c28ce87ee0568a00.yamakuzure@gentoo> Subject: [gentoo-commits] proj/ufed:master commit in: / X-VCS-Repository: proj/ufed X-VCS-Files: .gitignore ufed.pl.in X-VCS-Directories: / X-VCS-Committer: yamakuzure X-VCS-Committer-Name: Sven Eden X-VCS-Revision: 5df696152a15ab827381d524c28ce87ee0568a00 X-VCS-Branch: master Date: Tue, 24 Sep 2019 17:57:47 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply X-Archives-Salt: 9c48bcb7-205e-4b4a-b226-d284666d39a6 X-Archives-Hash: a2d309c276ddf5e454e74a13151a4439 commit: 5df696152a15ab827381d524c28ce87ee0568a00 Author: Sven Eden gmx net> AuthorDate: Tue Sep 24 17:45:47 2019 +0000 Commit: Sven Eden gmx de> CommitDate: Tue Sep 24 17:57:12 2019 +0000 URL: https://gitweb.gentoo.org/proj/ufed.git/commit/?id=5df69615 Do not hand over overly long lines (Fixes bug #695262) ufed-curses-checklist.c:ufed_getline() is limited to LINE_MAX, which is 2048 bytes. Unfortunately local USE flags can blast this limit, as ufed.pl also transmit an alternative description with stripped keywords. This commit lets ufed.pl calculate whether a description has to be shorted, and does so if needed. Bug: https://bugs.gentoo.org/695262 Signed-off-by: Sven Eden gmx.net> .gitignore | 2 ++ ufed.pl.in | 13 +++++++++++-- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/.gitignore b/.gitignore index c16694f..fc4c607 100644 --- a/.gitignore +++ b/.gitignore @@ -25,3 +25,5 @@ depcomp install-sh missing compile +ufed.workspace* +cb/* diff --git a/ufed.pl.in b/ufed.pl.in index 4cd2484..f01c8a2 100644 --- a/ufed.pl.in +++ b/ufed.pl.in @@ -109,9 +109,18 @@ sub flags_dialog { # Finally print the local description lines for my $pkg (sort keys %{$conf->{"local"}}) { + # ufed handles up to 2048 bytes long lines, but local descriptions can be as long + # as maintainers choose, so we have to do a bit more work here. + my $extra_len = length($pkg) + 18; # +One for the NULL-Byte + my $full_desc = $conf->{"local"}{$pkg}{descr}; + my $alt_desc = $conf->{"local"}{$pkg}{descr_alt}; + my $full_max = (2048 - $extra_len) / 3 * 2 - 19; # 19 is the length of the metadata hint + my $alt_max = (2048 - $extra_len) / 3 - 1; $outTxt .= sprintf("\t%s\t%s\t (%s) [ %s%s%s%s%s%s]\n", - $conf->{"local"}{$pkg}{descr}, - $conf->{"local"}{$pkg}{descr_alt}, + ( length($full_desc) > $full_max + ? substr($full_desc, 0, $full_max) . " (See metadata.xml)" + : $full_desc ), + substr($alt_desc, 0, $alt_max), $pkg, $conf->{"local"}{$pkg}{installed} > 0 ? '+' : $conf->{"local"}{$pkg}{installed} < 0 ? '-' : ' ',