Thanks, merged!
On Fri, 2018-01-19 at 18:57 +0100, Jonatan Schlag wrote:
The removed patches are included in this version so there is no need that we apply them.
Signed-off-by: Jonatan Schlag jonatan.schlag@ipfire.org
lfs/dmidecode | 8 +-- ...d-no-sysfs-option-description-to-h-output.patch | 15 ---- ...BIOS-nor-DMI-entry-point-found-on-SMBIOS3.patch | 26 ------- ...Let-read_file-return-the-actual-data-size.patch | 84 -------------------
...se-read_file-to-read-the-DMI-table-from-s.patch | 72 ------------------- 5 files changed, 2 insertions(+), 203 deletions(-) delete mode 100644 src/patches/dmidecode/0001-Add-no-sysfs-option- description-to-h-output.patch delete mode 100644 src/patches/dmidecode/0002-Fix-No-SMBIOS-nor-DMI-entry- point-found-on-SMBIOS3.patch delete mode 100644 src/patches/dmidecode/0003-Let-read_file-return-the- actual-data-size.patch delete mode 100644 src/patches/dmidecode/0004-dmidecode-Use-read_file-to- read-the-DMI-table-from-s.patch
diff --git a/lfs/dmidecode b/lfs/dmidecode index a2dcc2357..8f8a2491c 100644 --- a/lfs/dmidecode +++ b/lfs/dmidecode @@ -24,7 +24,7 @@
include Config
-VER = 3.0 +VER = 3.1
THISAPP = dmidecode-$(VER) DL_FILE = $(THISAPP).tar.gz @@ -41,7 +41,7 @@ objects = $(DL_FILE)
$(DL_FILE) = $(DL_FROM)/$(DL_FILE)
-$(DL_FILE)_MD5 = be7501ad0f844e875976b96106afaa3c +$(DL_FILE)_MD5 = 7798f68a02b82358c44af913da3b6b42
install : $(TARGET) check : $(patsubst %,$(DIR_CHK)/%,$(objects)) @@ -70,10 +70,6 @@ $(subst %,%_MD5,$(objects)) : $(TARGET) : $(patsubst %,$(DIR_DL)/%,$(objects)) @$(PREBUILD) @rm -rf $(DIR_APP) && cd $(DIR_SRC) && tar zxf $(DIR_DL)/$(DL_FILE)
- cd $(DIR_APP) && patch -Np1 -i $(DIR_SRC)/src/patches/dmidecode/0001-
Add-no-sysfs-option-description-to-h-output.patch
- cd $(DIR_APP) && patch -Np1 -i $(DIR_SRC)/src/patches/dmidecode/0002-
Fix-No-SMBIOS-nor-DMI-entry-point-found-on-SMBIOS3.patch
- cd $(DIR_APP) && patch -Np1 -i $(DIR_SRC)/src/patches/dmidecode/0003-
Let-read_file-return-the-actual-data-size.patch
- cd $(DIR_APP) && patch -Np1 -i $(DIR_SRC)/src/patches/dmidecode/0004-
dmidecode-Use-read_file-to-read-the-DMI-table-from-s.patch cd $(DIR_APP) && patch -Np1 -i $(DIR_SRC)/src/patches/dmidecode/0005- nothing-should-go-into-usr-local.patch cd $(DIR_APP) && make $(MAKETUNING) $(EXTRA_MAKE) cd $(DIR_APP) && make install diff --git a/src/patches/dmidecode/0001-Add-no-sysfs-option-description-to-h- output.patch b/src/patches/dmidecode/0001-Add-no-sysfs-option-description-to- h-output.patch deleted file mode 100644 index 4b6c1177c..000000000 --- a/src/patches/dmidecode/0001-Add-no-sysfs-option-description-to-h- output.patch +++ /dev/null @@ -1,15 +0,0 @@ -diff --git a/dmiopt.c b/dmiopt.c -index 0d142d2..de607f4 100644 ---- a/dmiopt.c -+++ b/dmiopt.c -@@ -314,6 +314,7 @@ void print_help(void)
" -u, --dump Do not decode the entries\n"
" --dump-bin FILE Dump the DMI data to a binary
file\n"
" --from-dump FILE Read the DMI data from a binary
file\n" -+ " --no-sysfs Do not attempt to read DMI data from sysfs files\n"
" -V, --version Display the version and exit\n";
- printf("%s", help);
-2.1.4
diff --git a/src/patches/dmidecode/0002-Fix-No-SMBIOS-nor-DMI-entry-point- found-on-SMBIOS3.patch b/src/patches/dmidecode/0002-Fix-No-SMBIOS-nor-DMI- entry-point-found-on-SMBIOS3.patch deleted file mode 100644 index 9f7db9cb4..000000000 --- a/src/patches/dmidecode/0002-Fix-No-SMBIOS-nor-DMI-entry-point-found-on- SMBIOS3.patch +++ /dev/null @@ -1,26 +0,0 @@ -diff --git a/dmidecode.c b/dmidecode.c -index ce0511b..cfcade4 100644 ---- a/dmidecode.c -+++ b/dmidecode.c -@@ -4866,8 +4866,16 @@ int main(int argc, char * const argv[])
goto exit_free;
- }
-- if (smbios_decode(buf, opt.devmem, 0)) -- found++; -+ if (memcmp(buf, "_SM3_", 5) == 0) -+ { -+ if (smbios3_decode(buf, opt.devmem, 0)) -+ found++; -+ } -+ else if (memcmp(buf, "_SM_", 4) == 0) -+ { -+ if (smbios_decode(buf, opt.devmem, 0)) -+ found++; -+ }
- goto done;
- memory_scan:
-2.1.4
diff --git a/src/patches/dmidecode/0003-Let-read_file-return-the-actual-data- size.patch b/src/patches/dmidecode/0003-Let-read_file-return-the-actual-data- size.patch deleted file mode 100644 index 3fea6bc79..000000000 --- a/src/patches/dmidecode/0003-Let-read_file-return-the-actual-data- size.patch +++ /dev/null @@ -1,84 +0,0 @@ -diff --git a/dmidecode.c b/dmidecode.c -index 183ced4..a43cfd1 100644 ---- a/dmidecode.c -+++ b/dmidecode.c -@@ -4751,6 +4751,7 @@ int main(int argc, char * const argv[])
- int ret = 0; /* Returned value */
- int found = 0;
- off_t fp;
-+ size_t size;
- int efi;
- u8 *buf;
-@@ -4820,8 +4821,9 @@ int main(int argc, char * const argv[])
* contain one of several types of entry points, so read enough for
* the largest one, then determine what type it contains.
*/
-+ size = 0x20;
- if (!(opt.flags & FLAG_NO_SYSFS)
-- && (buf = read_file(0x20, SYS_ENTRY_FILE)) != NULL) -+ && (buf = read_file(&size, SYS_ENTRY_FILE)) != NULL)
- {
if (!(opt.flags & FLAG_QUIET))
printf("Getting SMBIOS data from sysfs.\n");
-diff --git a/util.c b/util.c -index f97ac0d..52ed413 100644 ---- a/util.c -+++ b/util.c -@@ -94,10 +94,11 @@ int checksum(const u8 *buf, size_t len)
- needs to be freed by the caller.
- This provides a similar usage model to mem_chunk()
-- * Returns pointer to buffer of max_len bytes, or NULL on error -+ * Returns pointer to buffer of max_len bytes, or NULL on error, and -+ * sets max_len to the length actually read.
- */
--void *read_file(size_t max_len, const char *filename) -+void *read_file(size_t *max_len, const char *filename)
- {
- int fd;
- size_t r2 = 0;
-@@ -115,7 +116,7 @@ void *read_file(size_t max_len, const char *filename)
return(NULL);
- }
-- if ((p = malloc(max_len)) == NULL) -+ if ((p = malloc(*max_len)) == NULL)
- {
perror("malloc");
return NULL;
-@@ -123,7 +124,7 @@ void *read_file(size_t max_len, const char *filename)
- do
- {
-- r = read(fd, p + r2, max_len - r2); -+ r = read(fd, p + r2, *max_len - r2);
if (r == -1)
{
if (errno != EINTR)
-@@ -140,6 +141,8 @@ void *read_file(size_t max_len, const char *filename)
- while (r != 0);
- close(fd);
-+ *max_len = r2; -+
- return p;
- }
-diff --git a/util.h b/util.h -index 9d409cd..b8748f1 100644 ---- a/util.h -+++ b/util.h -@@ -25,7 +25,7 @@
- #define ARRAY_SIZE(x) (sizeof(x)/sizeof((x)[0]))
- int checksum(const u8 *buf, size_t len);
--void *read_file(size_t len, const char *filename); -+void *read_file(size_t *len, const char *filename);
- void *mem_chunk(off_t base, size_t len, const char *devmem);
- int write_dump(size_t base, size_t len, const void *data, const char
*dumpfile, int add);
- u64 u64_range(u64 start, u64 end);
-2.1.4
diff --git a/src/patches/dmidecode/0004-dmidecode-Use-read_file-to-read-the- DMI-table-from-s.patch b/src/patches/dmidecode/0004-dmidecode-Use-read_file- to-read-the-DMI-table-from-s.patch deleted file mode 100644 index 45584b72b..000000000 --- a/src/patches/dmidecode/0004-dmidecode-Use-read_file-to-read-the-DMI- table-from-s.patch +++ /dev/null @@ -1,72 +0,0 @@ -From 364055211b1956539c6a6268e111e244e1292c8c Mon Sep 17 00:00:00 2001 -From: Jean Delvare jdelvare@suse.de -Date: Mon, 2 Nov 2015 09:45:31 +0100 -Subject: [PATCH] dmidecode: Use read_file() to read the DMI table from sysfs
-We shouldn't use mem_chunk() to read the DMI table from sysfs. This -will fail for SMBIOS v3 implementations which specify a maximum length -for the table rather than its exact length. The kernel will trim the -table to the actual length, so the DMI file will be shorter than the -length announced in entry point.
-read_file() fits the bill in this case, as it deals with end of file -nicely.
-This also helps with corrupted DMI tables, as the kernel will not -export the part of the table that it wasn't able to parse, effectively -trimming it.
-This fixes bug #46176: -https://savannah.nongnu.org/bugs/?46176
-Unexpected end of file error
- CHANGELOG | 3 +++
- dmidecode.c | 29 +++++++++++++++++++++--------
- 2 files changed, 24 insertions(+), 8 deletions(-)
-diff --git a/dmidecode.c b/dmidecode.c -index a43cfd1..16d1823 100644 ---- a/dmidecode.c -+++ b/dmidecode.c -@@ -4524,16 +4524,29 @@ static void dmi_table(off_t base, u32 len, u16 num, u16 ver, const char *devmem,
printf("\n");
- }
-- /* -- * When we are reading the DMI table from sysfs, we want to print -- * the address of the table (done above), but the offset of the -- * data in the file is 0. When reading from /dev/mem, the offset -- * in the file is the address. -- */
- if (flags & FLAG_NO_FILE_OFFSET)
-- base = 0; -+ { -+ /* -+ * When reading from sysfs, the file may be shorter than -+ * announced. For SMBIOS v3 this is expcted, as we only know -+ * the maximum table size, not the actual table size. For older -+ * implementations (and for SMBIOS v3 too), this would be the -+ * result of the kernel truncating the table on parse error. -+ */ -+ size_t size = len; -+ buf = read_file(&size, devmem); -+ if (!(opt.flags & FLAG_QUIET) && num && size != (size_t)len) -+ { -+ printf("Wrong DMI structures length: %u bytes " -+ "announced, only %lu bytes available.\n", -+ len, (unsigned long)size); -+ } -+ len = size; -+ } -+ else -+ buf = mem_chunk(base, len, devmem);
-- if ((buf = mem_chunk(base, len, devmem)) == NULL) -+ if (buf == NULL)
- {
fprintf(stderr, "Table is unreachable, sorry."
- #ifndef USE_MMAP
-2.1.4