From 5d9907d3f450ddb5f78bec2d186724e00ade1070 Mon Sep 17 00:00:00 2001 From: Eike Rathke Date: Mon, 24 Apr 2023 14:33:19 +0200 Subject: [PATCH] Add RUSTFLAGS commasplit patch --- rustflags-commasplit.patch | 76 ++++++++++++++++++++++++++++++++++++++ thunderbird.spec | 11 ++++-- 2 files changed, 84 insertions(+), 3 deletions(-) create mode 100644 rustflags-commasplit.patch diff --git a/rustflags-commasplit.patch b/rustflags-commasplit.patch new file mode 100644 index 0000000..0669bd8 --- /dev/null +++ b/rustflags-commasplit.patch @@ -0,0 +1,76 @@ +--- thunderbird-102.10.0/build/moz.configure/rust.configure.rustflags-commasplit 2023-03-21 06:16:03.000000000 -0700 ++++ thunderbird-102.10.0/build/moz.configure/rust.configure 2023-04-05 08:57:29.403219120 -0700 +@@ -593,7 +593,7 @@ + + # ============================================================== + +-option(env="RUSTFLAGS", nargs=1, help="Rust compiler flags") ++option(env="RUSTFLAGS", nargs=1, help="Rust compiler flags", comma_split=False) + set_config("RUSTFLAGS", depends("RUSTFLAGS")(lambda flags: flags)) + + +--- thunderbird-102.10.0/python/mozbuild/mozbuild/configure/options.py.rustflags-commasplit 2023-03-21 06:16:09.000000000 -0700 ++++ thunderbird-102.10.0/python/mozbuild/mozbuild/configure/options.py 2023-04-05 08:57:31.270193468 -0700 +@@ -191,6 +191,10 @@ + to instantiate an option indirectly. Set this to a positive integer to + force the script to look into a deeper stack frame when inferring the + `category`. ++ - `comma_split` specifies whether the value string should be split on ++ commas. The default is True. Setting it False is necessary for things ++ like compiler flags which should be a single string that may contain ++ commas. + """ + + __slots__ = ( +@@ -205,6 +209,7 @@ + "possible_origins", + "category", + "define_depth", ++ "comma_split", + ) + + def __init__( +@@ -218,6 +223,7 @@ + category=None, + help=None, + define_depth=0, ++ comma_split=True, + ): + if not name and not env: + raise InvalidOptionError( +@@ -335,9 +341,10 @@ + self.choices = choices + self.help = help + self.category = category or _infer_option_category(define_depth) ++ self.comma_split = comma_split + + @staticmethod +- def split_option(option): ++ def split_option(option, comma_split=True): + """Split a flag or variable into a prefix, a name and values + + Variables come in the form NAME=values (no prefix). +@@ -350,7 +357,13 @@ + + elements = option.split("=", 1) + name = elements[0] +- values = tuple(elements[1].split(",")) if len(elements) == 2 else () ++ if len(elements) == 2: ++ if comma_split: ++ values = tuple(elements[1].split(",")) ++ else: ++ values = (elements[1],) ++ else: ++ values = () + if name.startswith("--"): + name = name[2:] + if not name.islower(): +@@ -426,7 +439,7 @@ + % (option, origin, ", ".join(self.possible_origins)) + ) + +- prefix, name, values = self.split_option(option) ++ prefix, name, values = self.split_option(option, self.comma_split) + option = self._join_option(prefix, name) + + assert name in (self.name, self.env) diff --git a/thunderbird.spec b/thunderbird.spec index 569f5b6..baa7dc4 100644 --- a/thunderbird.spec +++ b/thunderbird.spec @@ -151,6 +151,12 @@ Patch501: expat-CVE-2022-25235.patch Patch502: expat-CVE-2022-25236.patch Patch503: expat-CVE-2022-25315.patch +# Tentative patch for RUSTFLAGS parsing issue, +# borrowed from firefox commit 24c9accce19c5cae9394430b24eaf938a9c17882: +# https://bugzilla.redhat.com/show_bug.cgi?id=2184743 +# https://bugzilla.mozilla.org/show_bug.cgi?id=1474486 +Patch1200: rustflags-commasplit.patch + %if %{official_branding} # Required by Mozilla Corporation @@ -328,6 +334,8 @@ popd %patch502 -p1 -b .expat-CVE-2022-25236 %patch503 -p1 -b .expat-CVE-2022-25315 +%patch1200 -p1 -b .rustflags-commasplit + %if %{official_branding} # Required by Mozilla Corporation @@ -526,9 +534,6 @@ MOZ_LINK_FLAGS="$MOZ_LINK_FLAGS -L%{_libdir}" %endif %ifarch %{arm} %{ix86} %{s390x} export RUSTFLAGS="-Cdebuginfo=0" -%else -# Otherwise since https://src.fedoraproject.org/rpms/redhat-rpm-config/pull-request/243 breaks build. -unset RUSTFLAGS %endif # We don't want thunderbird to use CK_GCM_PARAMS_V3 in nss MOZ_OPT_FLAGS="$MOZ_OPT_FLAGS -DNSS_PKCS11_3_0_STRICT"