From nobody Sun Jan 02 15:08:16 2022 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id A96AA19361AE; Sun, 2 Jan 2022 15:08:29 +0000 (UTC) (envelope-from alf.siciliano@gmail.com) Received: from mail-ed1-x52b.google.com (mail-ed1-x52b.google.com [IPv6:2a00:1450:4864:20::52b]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1D4" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4JRj1n447lz3GwB; Sun, 2 Jan 2022 15:08:29 +0000 (UTC) (envelope-from alf.siciliano@gmail.com) Received: by mail-ed1-x52b.google.com with SMTP id b13so126771292edd.8; Sun, 02 Jan 2022 07:08:29 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=date:from:to:cc:subject:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=a2LOq0E2pUrJQUr6zP9/xEPSHrJx0R8DV/qB0Swmbv8=; b=cDM1HU3OOiONrK5PYKvRRz9l5Z7CSlIsFb2yS10taHAnvjbg9sJqFAzYnfoCuBVYVi k9aFoSTggo2f/GKZYkISSd/YYUZbsrKc4T26f6c5HMZBcWALyS8Icjik2gLdpuzmvSVO hxN7GasrxZaKlEuZgEGcyxthC49GVniKfcFF7yaUfYm0lRLWd4jOa97hmRFsYfjJ8ARr jNlEHhj0NnPXX052s3iYENVTnQJGeaYB9i6/1TGRyKS+nYVQxsuFu6bwX0d8TUAxNpog hXrrucKxbkzPDfIUmjN8hnVrlq7UqKqnsniM+QMHtGJypkBfCoGRTImvBB0GAX0OvGXZ CGTg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=a2LOq0E2pUrJQUr6zP9/xEPSHrJx0R8DV/qB0Swmbv8=; b=JmpuOzRJHzzs1i2Ds8l7LS0tBbQloutKvP+FNbuOFPZSd7j/7EDEdBIHjkq0djeutq q4Eo/PyLqysncHcKpIyxdpdIlnRM1DeUAvxDPzvCzWEgZBmUdb0B3wR7x2n1Xe9UQbEO dBMNVzq86O3j1LXZTwhnALkLFpuvC1D+0sCWCyuAad/nATD/WFCgT5DSQMQmjjCgKVaq jUHO7vp1XqzM8VteJT0lyzTzN9X3QKgTaEBDaDL2aX1MkzRMSq3nfVqDfnb4uMWcHgu6 LugepjrBLbj+b/jaVYExuQp5z5hwFNbgtMIipKOP6IbuNRtiVuyWCrOfZLJFP/Z35iin XE0Q== X-Gm-Message-State: AOAM531Bn80VkY14mZ02ZjUOUS/XtZAxJX0d/5sv+ivOiURDRldCKS6W MlW7jSVXcjdutZ2s83XZBIWxFyPbP/mKDw== X-Google-Smtp-Source: ABdhPJxC7jT0CH/jHms8G9mjwDP2DyNEKo/bJ6QZoK7fmX0bg87PGX927OPZTIt4pQn/G3wZdtbLQw== X-Received: by 2002:a17:906:59b:: with SMTP id 27mr6736283ejn.294.1641136108572; Sun, 02 Jan 2022 07:08:28 -0800 (PST) Received: from fbsd.home (host-87-19-153-89.retail.telecomitalia.it. [87.19.153.89]) by smtp.gmail.com with ESMTPSA id x20sm10944510edd.28.2022.01.02.07.08.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 02 Jan 2022 07:08:28 -0800 (PST) Date: Sun, 2 Jan 2022 16:08:16 +0100 From: "alf.siciliano@gmail.com" To: Baptiste Daroussin Cc: Jessica Clarke , "src-committers@freebsd.org" , "dev-commits-src-all@freebsd.org" , "dev-commits-src-main@freebsd.org" , alfsiciliano@gmail.com Subject: Re: git: 18f20d5d967a - main - bsddialog: convert bsdinstall/distextract Message-Id: <20220102160816.b1d9227fcece8eec1086d5cc@gmail.com> In-Reply-To: <20220101214002.k5jy6o7h2njst7l5@aniel.nours.eu> References: <202201012052.201KqrhV082129@gitrepo.freebsd.org> <41538126-67AC-4C19-9414-BD4E8B85D23B@freebsd.org> <20220101214002.k5jy6o7h2njst7l5@aniel.nours.eu> X-Mailer: Sylpheed 3.7.0 (GTK+ 2.24.33; amd64-portbld-freebsd13.0) List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Rspamd-Queue-Id: 4JRj1n447lz3GwB X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[]; TAGGED_FROM(0.00)[] X-ThisMailContainsUnwantedMimeParts: N On Sat, 1 Jan 2022 22:40:02 +0100 Baptiste Daroussin wrote: > On Sat, Jan 01, 2022 at 09:35:50PM +0000, Jessica Clarke wrote: > > On 1 Jan 2022, at 20:52, Baptiste Daroussin wrote: > > >=20 > > > The branch main has been updated by bapt: > > >=20 > > > URL: https://cgit.FreeBSD.org/src/commit/?id=3D18f20d5d967ae790f12196= 3e1fcee68d729a529e > > >=20 > > > commit 18f20d5d967ae790f121963e1fcee68d729a529e > > > Author: Alfonso Siciliano > > > AuthorDate: 2022-01-01 20:50:44 +0000 > > > Commit: Baptiste Daroussin > > > CommitDate: 2022-01-01 20:51:23 +0000 > > >=20 > > > bsddialog: convert bsdinstall/distextract > > >=20 > > > Differential Revision: https://reviews.freebsd.org/D33581 > > > --- > > > usr.sbin/bsdinstall/distextract/Makefile | 3 +- > > > usr.sbin/bsdinstall/distextract/distextract.c | 180 +++++++++++++----= --------- > > > 2 files changed, 92 insertions(+), 91 deletions(-) > > >=20 > > > diff --git a/usr.sbin/bsdinstall/distextract/Makefile b/usr.sbin/bsdi= nstall/distextract/Makefile > > > index 2b7180e28ea0..5e9f2b9e1473 100644 > > > --- a/usr.sbin/bsdinstall/distextract/Makefile > > > +++ b/usr.sbin/bsdinstall/distextract/Makefile > > > @@ -2,7 +2,8 @@ > > >=20 > > > BINDIR=3D ${LIBEXECDIR}/bsdinstall > > > PROG=3D distextract > > > -LIBADD=3D archive dpv dialog m > > > +CFLAGS+=3D -I${SRCTOP}/contrib/bsddialog/lib > > > +LIBADD=3D archive bsddialog m > > >=20 > > > MAN=3D > > >=20 > > > diff --git a/usr.sbin/bsdinstall/distextract/distextract.c b/usr.sbin= /bsdinstall/distextract/distextract.c > > > index 8ad6c7b2c64b..df10c299ab7f 100644 > > > --- a/usr.sbin/bsdinstall/distextract/distextract.c > > > +++ b/usr.sbin/bsdinstall/distextract/distextract.c > > > @@ -33,11 +33,12 @@ __FBSDID("$FreeBSD$"); > > > #include > > > #include > > > #include > > > -#include > > > -#include > > > +#include > > > +#include > > > #include > > > #include > > > #include > > > +#include > > > #include > > > #include > > > #include > > > @@ -46,30 +47,27 @@ __FBSDID("$FreeBSD$"); > > > /* Data to process */ > > > static char *distdir =3D NULL; > > > static struct archive *archive =3D NULL; > > > -static struct dpv_file_node *dists =3D NULL; > > >=20 > > > /* Function prototypes */ > > > static void sig_int(int sig); > > > static int count_files(const char *file); > > > -static int extract_files(struct dpv_file_node *file, int out); > > > +static int extract_files(struct bsddialog_fileminibar *file); > > >=20 > > > -#define _errx(...) (end_dialog(), errx(__VA_ARGS__)) > > > +#define _errx(...) (bsddialog_end(), errx(__VA_ARGS__)) > > >=20 > > > int > > > main(void) > > > { > > > char *chrootdir; > > > char *distributions; > > > + unsigned int i; > > > int retval; > > > - size_t config_size =3D sizeof(struct dpv_config); > > > - size_t file_node_size =3D sizeof(struct dpv_file_node); > > > + size_t minibar_size =3D sizeof(struct bsddialog_fileminibar); > > > size_t span; > > > - struct dpv_config *config; > > > - struct dpv_file_node *dist =3D dists; > > > - static char backtitle[] =3D "FreeBSD Installer"; > > > - static char title[] =3D "Archive Extraction"; > > > - static char aprompt[] =3D "\n Overall Progress:"; > > > - static char pprompt[] =3D "Extracting distribution files...\n"; > > > + unsigned int nminibars; > > > + struct bsddialog_fileminibar *dists; > > > + struct bsddialog_progviewconf pvconf; > > > + struct bsddialog_conf conf; > > > struct sigaction act; > > > char error[PATH_MAX + 512]; > > >=20 > > > @@ -78,17 +76,17 @@ main(void) > > > if ((distdir =3D getenv("BSDINSTALL_DISTDIR")) =3D=3D NULL) > > > distdir =3D __DECONST(char *, ""); > > >=20 > > > - /* Initialize dialog(3) */ > > > - init_dialog(stdin, stdout); > > > - dialog_vars.backtitle =3D backtitle; > > > - dlg_put_backtitle(); > > > - > > > - dialog_msgbox("", > > > - "Checking distribution archives.\nPlease wait...", 4, 35, FALSE= ); > > > - > > > - /* > > > - * Parse $DISTRIBUTIONS into dpv(3) linked-list > > > - */ > > > + if (bsddialog_init() =3D=3D BSDDIALOG_ERROR) > > > + errx(EXIT_FAILURE, "Cannot init libbsdialog"); > > > + bsddialog_initconf(&conf); > > > + bsddialog_backtitle(&conf, __DECONST(char *, "FreeBSD Installer")); > >=20 > > Can all these interfaces really not just use a const char * rather than > > having to scatter __DECONST everywhere if you want to pass a string > > literal to functions like this? There are quite a few __DECONST?s of > > string literals in this patch alone... > >=20 > > Jess >=20 > Adding Alfonso to CC. >=20 > Yes I agree, the __DECONST are from me, not from Alfonso, I added them to= avoid > having to play with WARNS and make progress in the conversion anyway. The= n start > the discussion with Alfonso to see how we can improve this. >=20 > Best regrads, > Bapt Hi Jessica, Thank you for your report, Briefly: I know the problem and it is in the TODO list, I hope to improve soon, it was very tedious "__DECONST" each string in bsdinstall. Rationale:=20 libbsddialog is a new library without real world use cases, indeed it is private in BASE; so far we are adding it "for steps" in PORTS and BASE. I implemented the features to replace LGPL libdialog, now we are working mainly to test/fix/improve the dialogs (infobox, checklist, form, etc) to complete the "library-migration" process. Fortunately this phase is ending (only 2 reviews in progress), then I' ll improve the lib/API: char*/const char*, mixedgauge, wrapping text autosize algorithm, re-update bsdinstall. Finally, the last step: bsddialog utility in bsdinstall/scripts. Please let me know any problem or if you need some new or GPL-dialog feature in bsddialog. Best regards, Alfonso ---=20 Alfonso S. Siciliano=20 http://alfonsosiciliano.gitlab.io