Message ID | 20230113225425.3301420-1-vfazio@xes-inc.com |
---|---|
State | Superseded |
Headers | show |
Series | [1/2] package/ipmitool: backport fixes for registry issues | expand |
Hello, On Fri, 13 Jan 2023 16:54:24 -0600 Vincent Fazio <vfazio@xes-inc.com> wrote: > From: Vincent Fazio <vfazio@gmail.com> > > Add upstream patches to: > Fix the URL used for hte IANA PEN registry > Make a missing registry file non-fatal > Make downloading/installing the registry optional > > The IANA PEN registry used by ipmitool takes up 4MB+. It is also not > "frozen" and can be updated at the whim of IANA. This causes headaches > when needing reproducible builds. > > Registry installation will be disabled when BR2_REPRODUCIBLE is selected. > > By default, the registry is not installed since it is largely a cosmetic > feature and not driving core functionality. So in the current Buildroot situation (before this patch), the registry is always installed, correct? > > Signed-off-by: Vincent Fazio <vfazio@gmail.com> > Signed-off-by: Vincent Fazio <vfazio@xes-inc.com> > --- > .../0002-Fix-enterprise-numbers-URL.patch | 33 ++++++ > ...t-require-the-IANA-PEN-registry-file.patch | 112 ++++++++++++++++++ > ...c-allow-disabling-registry-downloads.patch | 72 +++++++++++ > package/ipmitool/Config.in | 12 ++ > package/ipmitool/ipmitool.mk | 4 + > 5 files changed, 233 insertions(+) > create mode 100644 package/ipmitool/0002-Fix-enterprise-numbers-URL.patch > create mode 100644 package/ipmitool/0003-Do-not-require-the-IANA-PEN-registry-file.patch > create mode 100644 package/ipmitool/0004-configure.ac-allow-disabling-registry-downloads.patch > > diff --git a/package/ipmitool/0002-Fix-enterprise-numbers-URL.patch b/package/ipmitool/0002-Fix-enterprise-numbers-URL.patch > new file mode 100644 > index 0000000000..af62d22459 > --- /dev/null > +++ b/package/ipmitool/0002-Fix-enterprise-numbers-URL.patch > @@ -0,0 +1,33 @@ > +From 1edb0e27e44196d1ebe449aba0b9be22d376bcb6 Mon Sep 17 00:00:00 2001 > +From: Alexander Amelkin <alexander@amelkin.msk.ru> > +Date: Tue, 22 Nov 2022 13:55:33 +0300 > +Subject: [PATCH] Fix enterprise-numbers URL > + > +IANA has changed their URL scheme, and the content at the old URL for > +enterprise-numbers switched from text/plain to text/html. > + > +Fix Makefile.am to use the new URL > + > +Resolves ipmitool/ipmitool#377 > + > +Signed-off-by: Alexander Amelkin <alexander@amelkin.msk.ru> We need you to add your Signed-off-by here. > diff --git a/package/ipmitool/0003-Do-not-require-the-IANA-PEN-registry-file.patch b/package/ipmitool/0003-Do-not-require-the-IANA-PEN-registry-file.patch > new file mode 100644 > index 0000000000..6ac5ce989b > --- /dev/null > +++ b/package/ipmitool/0003-Do-not-require-the-IANA-PEN-registry-file.patch > @@ -0,0 +1,112 @@ > +From 26b088193a55624df4cbe2a0d33c7bba5bca108d Mon Sep 17 00:00:00 2001 > +From: Vincent Fazio <vfazio@gmail.com> > +Date: Sat, 7 Jan 2023 21:02:48 -0600 > +Subject: [PATCH] Do not require the IANA PEN registry file > + > +Previously, ipmitool would fail to run if the local copy of the IANA PEN > +registry could not be parsed. > + > +When the registry is not available the manufacturer will be "Unknown" but > +ipmitool will otherwise function so should not be considered fatal. > + > +Also, fix an issue with improperly handling the `oem_info_list_load` > +return value. Previously, in `ipmi_oem_info_init`, if `oem_info_list_load` > +returned a negative value due to the registry file not existing, an > +improper count would cause `oem_info_init_from_list` to aallocate a list > +that didn't encompass the full header/tail list. > + > + IANA PEN registry open failed: No such file or directory > + Allocating 3 entries > + [ 1] 16777214 | A Debug Assisting Company, Ltd. > + [ 0] 1048575 | Unspecified > + > +Now, use a signed int and ensure a valid count of loaded OEMs is used. > + > +Signed-off-by: Vincent Fazio <vfazio@gmail.com> What is the upstream status of this patch? > diff --git a/package/ipmitool/0004-configure.ac-allow-disabling-registry-downloads.patch b/package/ipmitool/0004-configure.ac-allow-disabling-registry-downloads.patch > new file mode 100644 > index 0000000000..7c070cb51f > --- /dev/null > +++ b/package/ipmitool/0004-configure.ac-allow-disabling-registry-downloads.patch > @@ -0,0 +1,72 @@ > +From be11d948f89b10be094e28d8a0a5e8fb532c7b60 Mon Sep 17 00:00:00 2001 > +From: Vincent Fazio <vfazio@gmail.com> > +Date: Wed, 11 Jan 2023 22:55:51 -0600 > +Subject: [PATCH] configure.ac: allow disabling registry downloads > + > +Some environments require reproducible builds. Since the IANA PEN > +registry is constantly updating and there is no snapshot available, > +installing ipmitool via `make install` is not reproducible. > + > +Provide a configure mechanism to disable the registry download/install.. Missing Signed-off-by, and missing upstream status. > diff --git a/package/ipmitool/Config.in b/package/ipmitool/Config.in > index dbd6483110..ed3b918f9d 100644 > --- a/package/ipmitool/Config.in > +++ b/package/ipmitool/Config.in > @@ -9,6 +9,18 @@ config BR2_PACKAGE_IPMITOOL > > if BR2_PACKAGE_IPMITOOL > > +comment "IANA PEN Registry will not be installed on reproducible builds" > + depends on BR2_REPRODUCIBLE > + > +config BR2_PACKAGE_IPMITOOL_PEN_REGISTRY > + bool "install PEN registry" Maybe "install IANA PEN registry" > + depends on !BR2_REPRODUCIBLE > + help > + Install the IANA PEN registry. Maybe spell out the PEN acronym here? > + Shows manufacturer name in certain commands. > + > + Not installing the registry saves ~4.3 MB. > + > config BR2_PACKAGE_IPMITOOL_LANPLUS > bool "enable lanplus interface" > select BR2_PACKAGE_OPENSSL > diff --git a/package/ipmitool/ipmitool.mk b/package/ipmitool/ipmitool.mk > index b9f60d8151..f97d94693b 100644 > --- a/package/ipmitool/ipmitool.mk > +++ b/package/ipmitool/ipmitool.mk > @@ -14,6 +14,10 @@ IPMITOOL_CPE_ID_VENDOR = ipmitool_project > IPMITOOL_AUTORECONF = YES > IPMITOOL_DEPENDENCIES = host-pkgconf > > +ifneq ($(BR2_PACKAGE_IPMITOOL_PEN_REGISTRY),y) > +IPMITOOL_CONF_OPTS += --disable-registry-download > +endif Can we make this: ifeq ($(BR2_PACKAGE_IPMITOOL_PEN_REGISTRY),y) IPMITOOL_CONF_OPTS += --enable-registry-download else IPMITOOL_CONF_OPTS += --disable-registry-download endif Thanks a lot! Thomas
On Sat, 14 Jan 2023 15:33:06 -0600 Vincent Fazio <vfazio@gmail.com> wrote: > replies below (i hope, i haven't tried responding to ML emails in gmail) It's almost good, except that gmail adds one extra > on the first line of each paragraph of your replies. > > So in the current Buildroot situation (before this patch), the registry > > is always installed, correct? > > > > Correct, but with a caveat... as of the version bump to 1.8.19, the file > being installed is broken and the tool actually won't work. So the current ipmitool in Buildroot is broken. Could perhaps separate a "fix" that could be backported from a large improvement that allows to not used the registry? > All upstream patches have been accepted into mainline. The commit hashes > in the patches are the mainline commits Thing is we don't which are "upstream patches". If the patches are upstream, you can do: Signed-off-by: John Doe <john.doe@foobar.com> Upstream: https://github.com/some/where/commit/12456abc This makes it very clear that it has been accepted upstream, and will help someone who will do the next ipmitool version bump. Thanks! Thomas
Thomas, All, On 2023-01-14 22:58 +0100, Thomas Petazzoni via buildroot spake thusly: > On Sat, 14 Jan 2023 15:33:06 -0600 > Vincent Fazio <vfazio@gmail.com> wrote: > > replies below (i hope, i haven't tried responding to ML emails in gmail) > It's almost good, except that gmail adds one extra > on the first line > of each paragraph of your replies. Still, I haven't seen Vincent's reply on the list... > > > So in the current Buildroot situation (before this patch), the registry > > > is always installed, correct? > > > > > > Correct, but with a caveat... as of the version bump to 1.8.19, the file > > being installed is broken and the tool actually won't work. > > So the current ipmitool in Buildroot is broken. Could perhaps separate > a "fix" that could be backported from a large improvement that allows > to not used the registry? It was I who asked Vincent to add all the patches from upstream with a single commit in Buildroot. Indeed, my reasonning was that they all pertain to a single issue: the package is broken because 1) the registry URL is now incorrect (it downloads an HTML blob instead of a plain-text description) and 2) the build is not reproducible (as the registry can change on a whim). Furthermore, even though the registry is currently installed, it is of no use because the file is not in the format expected by the tools, so I think it is accetable that we make installing the registry optional, and that the option does not default to y (although I would not mind if it did). > > All upstream patches have been accepted into mainline. The commit hashes > > in the patches are the mainline commits > > Thing is we don't which are "upstream patches". If the patches are > upstream, you can do: > > Signed-off-by: John Doe <john.doe@foobar.com> > Upstream: https://github.com/some/where/commit/12456abc I usually am content with just a git-formatted patch, with the actual history in proper reasing order: From <HASH> <date> From: author.... Date: date... Subject: subject... Commit log... upsteam-sob... [john.doe@foobar.com: backport from upstream] Signed-off-by: John Doe <john.doe@foobar.com> --- diff... thus we can indeed check the commit hash at the beginning of the patch and check whether it is part of a new upstream release. If the patch had to be tweaked, then; From <LOCAL_HASH> <date> From: author.... Date: date... Subject: subject... Commit log... upsteam-sob... [john.doe@foobar.com: backport from upstream HASH] Signed-off-by: John Doe <john.doe@foobar.com> --- diff... > This makes it very clear that it has been accepted upstream, and will > help someone who will do the next ipmitool version bump. But yes, as long as the information is there, that's still OK. Regards, Yann E. MORIN.
diff --git a/package/ipmitool/0002-Fix-enterprise-numbers-URL.patch b/package/ipmitool/0002-Fix-enterprise-numbers-URL.patch new file mode 100644 index 0000000000..af62d22459 --- /dev/null +++ b/package/ipmitool/0002-Fix-enterprise-numbers-URL.patch @@ -0,0 +1,33 @@ +From 1edb0e27e44196d1ebe449aba0b9be22d376bcb6 Mon Sep 17 00:00:00 2001 +From: Alexander Amelkin <alexander@amelkin.msk.ru> +Date: Tue, 22 Nov 2022 13:55:33 +0300 +Subject: [PATCH] Fix enterprise-numbers URL + +IANA has changed their URL scheme, and the content at the old URL for +enterprise-numbers switched from text/plain to text/html. + +Fix Makefile.am to use the new URL + +Resolves ipmitool/ipmitool#377 + +Signed-off-by: Alexander Amelkin <alexander@amelkin.msk.ru> +--- + Makefile.am | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/Makefile.am b/Makefile.am +index ce3267f..3182a52 100644 +--- a/Makefile.am ++++ b/Makefile.am +@@ -41,7 +41,7 @@ MAINTAINERCLEANFILES = Makefile.in aclocal.m4 configure configure-stamp \ + $(distdir).tar.gz $(distdir).tar.bz2 + + SUBDIRS = lib src include doc contrib control +-IANA_PEN = http://www.iana.org/assignments/enterprise-numbers ++IANA_PEN = http://www.iana.org/assignments/enterprise-numbers.txt + + dist-hook: + cp control/ipmitool.spec $(distdir) +-- +2.25.1 + diff --git a/package/ipmitool/0003-Do-not-require-the-IANA-PEN-registry-file.patch b/package/ipmitool/0003-Do-not-require-the-IANA-PEN-registry-file.patch new file mode 100644 index 0000000000..6ac5ce989b --- /dev/null +++ b/package/ipmitool/0003-Do-not-require-the-IANA-PEN-registry-file.patch @@ -0,0 +1,112 @@ +From 26b088193a55624df4cbe2a0d33c7bba5bca108d Mon Sep 17 00:00:00 2001 +From: Vincent Fazio <vfazio@gmail.com> +Date: Sat, 7 Jan 2023 21:02:48 -0600 +Subject: [PATCH] Do not require the IANA PEN registry file + +Previously, ipmitool would fail to run if the local copy of the IANA PEN +registry could not be parsed. + +When the registry is not available the manufacturer will be "Unknown" but +ipmitool will otherwise function so should not be considered fatal. + +Also, fix an issue with improperly handling the `oem_info_list_load` +return value. Previously, in `ipmi_oem_info_init`, if `oem_info_list_load` +returned a negative value due to the registry file not existing, an +improper count would cause `oem_info_init_from_list` to aallocate a list +that didn't encompass the full header/tail list. + + IANA PEN registry open failed: No such file or directory + Allocating 3 entries + [ 1] 16777214 | A Debug Assisting Company, Ltd. + [ 0] 1048575 | Unspecified + +Now, use a signed int and ensure a valid count of loaded OEMs is used. + +Signed-off-by: Vincent Fazio <vfazio@gmail.com> +--- + include/ipmitool/ipmi_strings.h | 2 +- + lib/ipmi_main.c | 5 +---- + lib/ipmi_strings.c | 19 +++++-------------- + 3 files changed, 7 insertions(+), 19 deletions(-) + +diff --git a/include/ipmitool/ipmi_strings.h b/include/ipmitool/ipmi_strings.h +index 17c37c6..d60179c 100644 +--- a/include/ipmitool/ipmi_strings.h ++++ b/include/ipmitool/ipmi_strings.h +@@ -55,7 +55,7 @@ extern const struct valstr ipmi_integrity_algorithms[]; + extern const struct valstr ipmi_encryption_algorithms[]; + extern const struct valstr ipmi_user_enable_status_vals[]; + extern const struct valstr *ipmi_oem_info; +-int ipmi_oem_info_init(); ++void ipmi_oem_info_init(); + void ipmi_oem_info_free(); + + extern const struct valstr picmg_frucontrol_vals[]; +diff --git a/lib/ipmi_main.c b/lib/ipmi_main.c +index a673a30..510bc2d 100644 +--- a/lib/ipmi_main.c ++++ b/lib/ipmi_main.c +@@ -853,10 +853,7 @@ ipmi_main(int argc, char ** argv, + } + + /* load the IANA PEN registry */ +- if (ipmi_oem_info_init()) { +- lprintf(LOG_ERR, "Failed to initialize the OEM info dictionary"); +- goto out_free; +- } ++ ipmi_oem_info_init(); + + /* run OEM setup if found */ + if (oemtype && +diff --git a/lib/ipmi_strings.c b/lib/ipmi_strings.c +index 26b359f..c8fc2d0 100644 +--- a/lib/ipmi_strings.c ++++ b/lib/ipmi_strings.c +@@ -1719,39 +1719,30 @@ out: + return rc; + } + +-int ipmi_oem_info_init() ++void ipmi_oem_info_init() + { + oem_valstr_list_t terminator = { { -1, NULL}, NULL }; /* Terminator */ + oem_valstr_list_t *oemlist = &terminator; + bool free_strings = true; +- size_t count; +- int rc = -4; ++ int count; + + lprintf(LOG_INFO, "Loading IANA PEN Registry..."); + + if (ipmi_oem_info) { + lprintf(LOG_INFO, "IANA PEN Registry is already loaded"); +- rc = 0; + goto out; + } + +- if (!(count = oem_info_list_load(&oemlist))) { +- /* +- * We can't identify OEMs without a loaded registry. +- * Set the pointer to dummy and return. +- */ +- ipmi_oem_info = ipmi_oem_info_dummy; +- goto out; ++ if ((count = oem_info_list_load(&oemlist)) < 1) { ++ lprintf(LOG_WARN, "Failed to load entries from IANA PEN Registry"); ++ count = 0; + } + + /* In the array was allocated, don't free the strings at cleanup */ + free_strings = !oem_info_init_from_list(oemlist, count); + +- rc = IPMI_CC_OK; +- + out: + oem_info_list_free(&oemlist, free_strings); +- return rc; + } + + void ipmi_oem_info_free() +-- +2.25.1 + diff --git a/package/ipmitool/0004-configure.ac-allow-disabling-registry-downloads.patch b/package/ipmitool/0004-configure.ac-allow-disabling-registry-downloads.patch new file mode 100644 index 0000000000..7c070cb51f --- /dev/null +++ b/package/ipmitool/0004-configure.ac-allow-disabling-registry-downloads.patch @@ -0,0 +1,72 @@ +From be11d948f89b10be094e28d8a0a5e8fb532c7b60 Mon Sep 17 00:00:00 2001 +From: Vincent Fazio <vfazio@gmail.com> +Date: Wed, 11 Jan 2023 22:55:51 -0600 +Subject: [PATCH] configure.ac: allow disabling registry downloads + +Some environments require reproducible builds. Since the IANA PEN +registry is constantly updating and there is no snapshot available, +installing ipmitool via `make install` is not reproducible. + +Provide a configure mechanism to disable the registry download/install.. +--- + configure.ac | 30 ++++++++++++++++++++---------- + 1 file changed, 20 insertions(+), 10 deletions(-) + +diff --git a/configure.ac b/configure.ac +index 4ee1be8..1dd2742 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -18,8 +18,6 @@ AC_PROG_LN_S + AC_PROG_MAKE_SET + AC_CHECK_PROG([RPMBUILD], [rpmbuild], [rpmbuild], [rpm]) + AC_CHECK_PROG([SED], [sed], [sed]) +-AC_CHECK_PROG([WGET], [wget], [wget]) +-AC_CHECK_PROG([CURL], [curl], [curl]) + + AC_HEADER_STDC + AC_CHECK_HEADERS([stdlib.h string.h sys/ioctl.h sys/stat.h unistd.h paths.h]) +@@ -56,21 +54,33 @@ if test "x$exec_prefix" = "xNONE"; then + exec_prefix="$prefix" + fi + +-if test "x$WGET" = "x"; then +- if test "x$CURL" = "x"; then ++dnl allow enabling/disabling the fetching of the IANA PEN registry ++AC_ARG_ENABLE([registry-download], ++ [AC_HELP_STRING([--enable-registry-download], ++ [download/install the IANA PEN registry [default=yes]])], ++ [xenable_registry_download=$enableval], ++ [xenable_registry_download=yes]) ++ ++AM_CONDITIONAL([DOWNLOAD], [false]) ++ ++if test "x$xenable_registry_download" = "xyes"; then ++ AC_CHECK_PROG([WGET], [wget], [wget]) ++ AC_CHECK_PROG([CURL], [curl], [curl]) ++ ++ if test "x$WGET" = "x" && test "x$CURL" = "x"; then + AC_MSG_WARN([** Neither wget nor curl could be found.]) + AC_MSG_WARN([** IANA PEN database will not be installed by `make install` !]) + else +- DOWNLOAD="$CURL --location --progress-bar" + AM_CONDITIONAL([DOWNLOAD], [true]) ++ if test "x$WGET" != "x"; then ++ DOWNLOAD="$WGET -c -nd -O -" ++ else ++ DOWNLOAD="$CURL --location --progress-bar" ++ fi + fi +-else +- DOWNLOAD="$WGET -c -nd -O -" +- AM_CONDITIONAL([DOWNLOAD], [true]) + fi + +-AC_MSG_WARN([** Download is:]) +-AC_MSG_WARN($DOWNLOAD) ++AC_MSG_WARN([** Download is: $DOWNLOAD]) + AC_SUBST(DOWNLOAD, $DOWNLOAD) + + dnl +-- +2.25.1 + diff --git a/package/ipmitool/Config.in b/package/ipmitool/Config.in index dbd6483110..ed3b918f9d 100644 --- a/package/ipmitool/Config.in +++ b/package/ipmitool/Config.in @@ -9,6 +9,18 @@ config BR2_PACKAGE_IPMITOOL if BR2_PACKAGE_IPMITOOL +comment "IANA PEN Registry will not be installed on reproducible builds" + depends on BR2_REPRODUCIBLE + +config BR2_PACKAGE_IPMITOOL_PEN_REGISTRY + bool "install PEN registry" + depends on !BR2_REPRODUCIBLE + help + Install the IANA PEN registry. + Shows manufacturer name in certain commands. + + Not installing the registry saves ~4.3 MB. + config BR2_PACKAGE_IPMITOOL_LANPLUS bool "enable lanplus interface" select BR2_PACKAGE_OPENSSL diff --git a/package/ipmitool/ipmitool.mk b/package/ipmitool/ipmitool.mk index b9f60d8151..f97d94693b 100644 --- a/package/ipmitool/ipmitool.mk +++ b/package/ipmitool/ipmitool.mk @@ -14,6 +14,10 @@ IPMITOOL_CPE_ID_VENDOR = ipmitool_project IPMITOOL_AUTORECONF = YES IPMITOOL_DEPENDENCIES = host-pkgconf +ifneq ($(BR2_PACKAGE_IPMITOOL_PEN_REGISTRY),y) +IPMITOOL_CONF_OPTS += --disable-registry-download +endif + ifeq ($(BR2_PACKAGE_FREEIPMI),y) IPMITOOL_DEPENDENCIES += freeipmi IPMITOOL_CONF_OPTS += --enable-intf-free