diff --git a/0001-imgtool-fix-parsing-options-with-enum-values.patch b/0001-imgtool-fix-parsing-options-with-enum-values.patch new file mode 100644 index 0000000..b1e6c83 --- /dev/null +++ b/0001-imgtool-fix-parsing-options-with-enum-values.patch @@ -0,0 +1,45 @@ +From 0d8ca95a1b5942b0c56744edfed3f74515418750 Mon Sep 17 00:00:00 2001 +From: Fabrice Bellet +Date: Wed, 27 Jun 2018 08:15:39 +0200 +Subject: [PATCH] imgtool: fix parsing options with enum values + +When parsing an enumerated option, we should use the parameter of the +enumerated value, as an integer, instead of the raw identifier as a +string. The behaviour probably changed around commit b60879e595, but +modules still expect the old behaviour. +--- + src/tools/imgtool/main.cpp | 18 +++++++++++++++++- + 1 file changed, 17 insertions(+), 1 deletion(-) + +diff --git a/src/tools/imgtool/main.cpp b/src/tools/imgtool/main.cpp +index 50c65845dd..5c55535932 100644 +--- a/src/tools/imgtool/main.cpp ++++ b/src/tools/imgtool/main.cpp +@@ -106,7 +106,23 @@ static int parse_options(int argc, char *argv[], int minunnamed, int maxunnamed, + if (i < minunnamed) + goto error; /* Too few unnamed */ + +- resolution->find(name)->set_value(value); ++ util::option_resolution::entry *entry = resolution->find(name); ++ if (entry->option_type() == util::option_guide::entry::option_type::ENUM_BEGIN) ++ { ++ const util::option_guide::entry *enum_value; ++ for (enum_value = entry->enum_value_begin(); enum_value != entry->enum_value_end(); enum_value++) ++ { ++ if (!strcmp (enum_value->identifier(), value)) ++ { ++ entry->set_value(enum_value->parameter()); ++ break; ++ } ++ } ++ if (enum_value == entry->enum_value_end()) ++ goto error; ++ } ++ else ++ entry->set_value(value); + } + } + } +-- +2.17.1 + diff --git a/mame.spec b/mame.spec index 897c35a..03c555b 100644 --- a/mame.spec +++ b/mame.spec @@ -5,7 +5,7 @@ Name: mame Version: 0.%{baseversion} -Release: 3%{?dist} +Release: 4%{?dist} Summary: Multiple Arcade Machine Emulator #LGPLv2+: @@ -22,6 +22,7 @@ Source0: https://github.com/mamedev/%{name}/releases/download/%{name}0%{b Source1: http://mamedev.org/releases/whatsnew_0%{baseversion}.txt Patch0: %{name}-fortify.patch Patch1: %{name}-genie-systemlua.patch +Patch2: 0001-imgtool-fix-parsing-options-with-enum-values.patch # %%{power64}: # https://github.com/mamedev/mame/issues/3157 # https://bugzilla.redhat.com/show_bug.cgi?id=1541613 @@ -155,6 +156,7 @@ find \( -regex '.*\.\(c\|cpp\|fsh\|fx\|h\|hpp\|lua\|make\|map\|md\|txt\|vsh\|xml %patch0 -p1 -b .fortify %patch1 -p1 -b .systemlua +%patch2 -p1 -b .imgtool-options # Create ini files cat > %{name}.ini << EOF @@ -355,6 +357,9 @@ find $RPM_BUILD_ROOT%{_datadir}/%{name} -name LICENSE -exec rm {} \; %changelog +* Mon Jul 23 2018 Bastien Nocera - 0.199-4 +- Fix imgtool options parsing + * Fri Jul 13 2018 Fedora Release Engineering - 0.199-3 - Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild