Related: #2176603 Resync to rhel-8.8.0

... as of

    commit d740c01d4973175da4dcca5b63023f83ffa10047
    CommitDate: Wed Feb 15 12:44:19 2023 +0100

        Update to 102.8.0 build2
This commit is contained in:
Eike Rathke 2023-03-28 20:31:21 +02:00
parent c6d0ab2558
commit 3cadeef73f
9 changed files with 927 additions and 389 deletions

View File

@ -1,322 +0,0 @@
diff -up comm/third_party/moz.build.D161379.diff comm/third_party/moz.build
--- comm/third_party/moz.build.D161379.diff 2022-10-14 21:45:15.000000000 +0200
+++ comm/third_party/moz.build 2022-11-10 11:49:44.194016978 +0100
@@ -11,9 +11,11 @@ if CONFIG["TB_LIBOTR_PREBUILT"]:
if CONFIG["MZLA_LIBRNP"]:
DIRS += [
- "botan",
"bzip2",
"json-c",
"rnp",
"zlib",
]
+ if CONFIG["MZLA_LIBRNP_BACKEND"] == "botan":
+ DIRS += [ "botan" ]
+
diff -up comm/third_party/openpgp.configure.D161379.diff comm/third_party/openpgp.configure
--- comm/third_party/openpgp.configure.D161379.diff 2022-11-10 11:49:37.605024129 +0100
+++ comm/third_party/openpgp.configure 2022-11-10 11:49:44.194016978 +0100
@@ -199,16 +199,136 @@ with only_when(in_tree_librnp):
set_config("MZLA_BZIP2_CFLAGS", bzip2_flags.cflags)
set_config("MZLA_BZIP2_LIBS", bzip2_flags.ldflags)
- # BOTAN --with-system-botan
- system_lib_option(
- "--with-system-botan",
- help="Use system Botan for librnp (located with pkgconfig)",
- )
-
- botan_pkg = pkg_check_modules(
- "MZLA_BOTAN", "botan-2 >= 2.8.0", when="--with-system-botan"
- )
- set_config("MZLA_SYSTEM_BOTAN", depends_if(botan_pkg)(lambda _: True))
+ # librnp crypto backend selection
+ option("--with-librnp-backend",
+ help="Build librnp with the selected backend: {botan, openssl}",
+ default="botan")
+
+ @depends("--with-librnp-backend")
+ def librnp_backend(backend):
+ allowed = ("botan", "openssl")
+ if backend[0] in allowed:
+ return backend[0]
+ else:
+ die(f"Unsupported librnp backend {backend[0]}.")
+
+ set_config("MZLA_LIBRNP_BACKEND", librnp_backend)
+
+ @depends(librnp_backend)
+ def rnp_botan(backend):
+ return backend == "botan"
+
+ @depends(librnp_backend)
+ def rnp_openssl(backend):
+ return backend == "openssl"
+
+ # Botan backend (--with-system-botan)
+ with only_when(rnp_botan):
+ system_lib_option(
+ "--with-system-botan",
+ help="Use system Botan for librnp (located with pkgconfig)",
+ )
+
+ botan_pkg = pkg_check_modules(
+ "MZLA_BOTAN", "botan-2 >= 2.8.0", when="--with-system-botan"
+ )
+ set_config("MZLA_SYSTEM_BOTAN", depends_if(botan_pkg)(lambda _: True))
+
+
+ # OpenSSL backend
+ with only_when(rnp_openssl):
+ option(
+ "--with-openssl",
+ nargs=1,
+ help="OpenSSL library prefix (when not found by pkgconfig)"
+ )
+ openssl_pkg = pkg_check_modules(
+ "MZLA_LIBRNP_OPENSSL",
+ "openssl > 1.1.1",
+ allow_missing=True,
+ config=False
+ )
+ @depends_if("--with-openssl", openssl_pkg)
+ @imports(_from="os.path", _import="isdir")
+ @imports(_from="os.path", _import="join")
+ def openssl_flags(openssl_prefix, openssl_pkg):
+ if openssl_prefix:
+ openssl_prefix = openssl_prefix[0]
+ include = join(openssl_prefix, "include")
+ lib = join(openssl_prefix, "lib")
+ if not isdir(lib):
+ lib = join(openssl_prefix, "lib64")
+ if isdir(include) and isdir(lib):
+ log.info(f"Using OpenSSL at {openssl_prefix}.")
+ return namespace(
+ cflags=(f"-I{include}",),
+ ldflags=(f"-L{lib}", "-lssl", "-lcrypto"),
+ )
+ if openssl_pkg:
+ return namespace(
+ cflags=openssl_pkg.cflags,
+ ldflags=openssl_pkg.libs,
+ )
+ set_config("MZLA_LIBRNP_OPENSSL_CFLAGS", openssl_flags.cflags)
+ set_config("MZLA_LIBRNP_OPENSSL_LIBS", openssl_flags.ldflags)
+
+
+ @depends(c_compiler, openssl_flags)
+ @imports(_from="textwrap", _import="dedent")
+ def openssl_version(compiler, openssl_flags):
+ log.info("Checking for OpenSSL >= 1.1.1")
+ if openssl_flags is None:
+ die("OpenSSL not found. Must be locatable with pkg-config or use --with-openssl.")
+
+ def ossl_hexver(hex_str):
+ # See opensshlv.h for description of OPENSSL_VERSION_NUMBER
+ MIN_OSSL_VER = 0x1010100f # Version 1.1.1
+ ver_as_int = int(hex_str[:-1], 16)
+ ossl_major = (ver_as_int & 0xf0000000) >> 28
+ ossl_minor = (ver_as_int & 0x0ff00000) >> 20
+ ossl_fix = (ver_as_int & 0x000ff000) >> 12
+ ossl_patch = chr(96 + (ver_as_int & 0x00000ff0) >> 4) # as a letter a-z
+ ver_as_str = f"{ossl_major}.{ossl_minor}.{ossl_fix}{ossl_patch}"
+ if ver_as_int < MIN_OSSL_VER:
+ die(f"OpenSSL version {ver_as_str} is too old.")
+ return ver_as_str
+
+ check = dedent(
+ """\
+ #include <openssl/opensslv.h>
+ #ifdef OPENSSL_VERSION_STR
+ OPENSSL_VERSION_STR
+ #elif defined(OPENSSL_VERSION_NUMBER)
+ OPENSSL_VERSION_NUMBER
+ #else
+ #error Unable to determine OpenSSL version.
+ #endif
+ """
+ )
+ result = try_preprocess(
+ compiler.wrapper
+ + [compiler.compiler]
+ + compiler.flags
+ + list(openssl_flags.cflags),
+ "C",
+ check
+ )
+ if result:
+ openssl_ver = result.splitlines()[-1]
+ if openssl_ver.startswith("0x"):
+ # OpenSSL 1.x.x - like 0x1010107fL
+ openssl_ver = ossl_hexver(openssl_ver)
+ else:
+ # OpenSSL 3.x.x - quoted version like "3.0.7"
+ openssl_ver = openssl_ver.replace('"', "")
+ major_version = openssl_ver.split(".")[0]
+ if major_version != "3":
+ die("Unrecognized OpenSSL version {openssl_version} found. Require >= 1.1.1 or 3.x.x")
+
+ log.info(f"Found OpenSSL {openssl_ver}.")
+ return openssl_ver
+
+ set_config("MZLA_LIBRNP_OPENSSL_VERSION", openssl_version)
# Checks for building librnp itself
# =================================
diff -up comm/third_party/rnp/moz.build.D161379.diff comm/third_party/rnp/moz.build
--- comm/third_party/rnp/moz.build.D161379.diff 2022-11-10 11:49:43.682017534 +0100
+++ comm/third_party/rnp/moz.build 2022-11-10 11:51:22.878909880 +0100
@@ -36,17 +36,53 @@ if CONFIG["CC_TYPE"] == "clang-cl":
"/EHs",
]
+LOCAL_INCLUDES = [
+ "include",
+ "src",
+ "src/common",
+ "src/lib",
+]
+
+IQuote(
+ "{}/src/lib".format(OBJDIR),
+ "{}/src/lib".format(SRCDIR),
+)
+
+# Set up defines for src/lib/config.h
rnp_defines = {
"HAVE_BZLIB_H": True,
"HAVE_ZLIB_H": True,
- "CRYPTO_BACKEND_OPENSSL": True,
- "ENABLE_AEAD": True,
- "ENABLE_TWOFISH": True,
- "ENABLE_BRAINPOOL": True,
"ENABLE_IDEA": True,
"PACKAGE_BUGREPORT": '"https://bugzilla.mozilla.org/enter_bug.cgi?product=Thunderbird"',
"PACKAGE_STRING": '"rnp {}"'.format(CONFIG["MZLA_LIBRNP_FULL_VERSION"])
}
+if CONFIG["MZLA_LIBRNP_BACKEND"] == "botan":
+ LOCAL_INCLUDES += ["!../botan/build/include"]
+ if CONFIG["MZLA_SYSTEM_BOTAN"]:
+ CXXFLAGS += CONFIG["MZLA_BOTAN_CFLAGS"]
+
+ rnp_defines.update({
+ "CRYPTO_BACKEND_BOTAN": True,
+ "ENABLE_AEAD": True,
+ "ENABLE_TWOFISH": True,
+ "ENABLE_BRAINPOOL": True,
+ })
+elif CONFIG["MZLA_LIBRNP_BACKEND"] == "openssl":
+ CXXFLAGS += CONFIG["MZLA_LIBRNP_OPENSSL_CFLAGS"]
+ OS_LIBS += CONFIG["MZLA_LIBRNP_OPENSSL_LIBS"]
+
+ rnp_defines.update({
+ "CRYPTO_BACKEND_OPENSSL": True,
+ # Not supported with RNP+OpenSSL https://github.com/rnpgp/rnp/issues/1642
+ "ENABLE_AEAD": False,
+ # Not supported by OpenSSL https://github.com/openssl/openssl/issues/2046
+ "ENABLE_TWOFISH": False,
+ # Supported, but not with RHEL's OpenSSL, disabled for now;
+ "ENABLE_BRAINPOOL": False,
+ })
+ if CONFIG["MZLA_LIBRNP_OPENSSL_VERSION"][0] == "3":
+ rnp_defines["CRYPTO_BACKEND_OPENSSL3"] = True
+
GeneratedFile(
"src/lib/config.h",
script="/comm/python/rocbuild/process_cmake_define_files.py",
@@ -57,23 +93,6 @@ GeneratedFile(
],
)
-LOCAL_INCLUDES = [
- "include",
- "src",
- "src/common",
- "src/lib",
-]
-
-IQuote(
- "{}/src/lib".format(OBJDIR),
- "{}/src/lib".format(SRCDIR),
-)
-
-if CONFIG["MZLA_SYSTEM_BOTAN"]:
- CXXFLAGS += CONFIG["MZLA_BOTAN_CFLAGS"]
-else:
- LOCAL_INCLUDES += ["!../botan/build/include"]
-
if CONFIG["MOZ_SYSTEM_ZLIB"]:
CXXFLAGS += CONFIG["MOZ_ZLIB_CFLAGS"]
else:
@@ -109,29 +128,16 @@ SOURCES += [
"src/common/time-utils.cpp",
"src/lib/crypto.cpp",
"src/lib/crypto/backend_version.cpp",
- "src/lib/crypto/bn.cpp",
"src/lib/crypto/cipher.cpp",
- "src/lib/crypto/cipher_botan.cpp",
- "src/lib/crypto/dsa.cpp",
- "src/lib/crypto/ec.cpp",
"src/lib/crypto/ec_curves.cpp",
- "src/lib/crypto/ecdh.cpp",
"src/lib/crypto/ecdh_utils.cpp",
- "src/lib/crypto/ecdsa.cpp",
- "src/lib/crypto/eddsa.cpp",
- "src/lib/crypto/elgamal.cpp",
- "src/lib/crypto/hash.cpp",
"src/lib/crypto/hash_common.cpp",
"src/lib/crypto/hash_sha1cd.cpp",
- "src/lib/crypto/mem.cpp",
"src/lib/crypto/mpi.cpp",
- "src/lib/crypto/rng.cpp",
- "src/lib/crypto/rsa.cpp",
"src/lib/crypto/s2k.cpp",
"src/lib/crypto/sha1cd/sha1.c",
"src/lib/crypto/sha1cd/ubc_check.c",
"src/lib/crypto/signatures.cpp",
- "src/lib/crypto/symmetric.cpp",
"src/lib/fingerprint.cpp",
"src/lib/generate-key.cpp",
"src/lib/json-utils.cpp",
@@ -159,4 +165,40 @@ SOURCES += [
"src/librepgp/stream-write.cpp",
]
+if CONFIG["MZLA_LIBRNP_BACKEND"] == "botan":
+ SOURCES += [
+ "src/lib/crypto/bn.cpp",
+ "src/lib/crypto/cipher_botan.cpp",
+ "src/lib/crypto/dsa.cpp",
+ "src/lib/crypto/ec.cpp",
+ "src/lib/crypto/ecdh.cpp",
+ "src/lib/crypto/ecdsa.cpp",
+ "src/lib/crypto/eddsa.cpp",
+ "src/lib/crypto/elgamal.cpp",
+ "src/lib/crypto/hash.cpp",
+ "src/lib/crypto/mem.cpp",
+ "src/lib/crypto/rng.cpp",
+ "src/lib/crypto/rsa.cpp",
+ "src/lib/crypto/symmetric.cpp",
+ ]
+if CONFIG["MZLA_LIBRNP_BACKEND"] == "openssl":
+ SOURCES += [
+ "src/lib/crypto/bn_ossl.cpp",
+ "src/lib/crypto/cipher_ossl.cpp",
+ "src/lib/crypto/dl_ossl.cpp",
+ "src/lib/crypto/dsa_ossl.cpp",
+ "src/lib/crypto/ec_ossl.cpp",
+ "src/lib/crypto/ecdh_ossl.cpp",
+ "src/lib/crypto/ecdsa_ossl.cpp",
+ "src/lib/crypto/eddsa_ossl.cpp",
+ "src/lib/crypto/elgamal_ossl.cpp",
+ "src/lib/crypto/hash_crc24.cpp",
+ "src/lib/crypto/hash_ossl.cpp",
+ "src/lib/crypto/mem_ossl.cpp",
+ "src/lib/crypto/rng_ossl.cpp",
+ "src/lib/crypto/rsa_ossl.cpp",
+ "src/lib/crypto/s2k_ossl.cpp",
+ "src/lib/crypto/symmetric_ossl.cpp",
+ ]
+
DIRS += ["src/rnp", "src/rnpkeys"]

View File

@ -1,49 +0,0 @@
diff --git a/third_party/openpgp.configure b/third_party/openpgp.configure
--- a/third_party/openpgp.configure
+++ b/third_party/openpgp.configure
@@ -198,21 +198,27 @@
)
set_config("MZLA_BZIP2_CFLAGS", bzip2_flags.cflags)
set_config("MZLA_BZIP2_LIBS", bzip2_flags.ldflags)
# librnp crypto backend selection
+ @depends(target_is_linux)
+ def librnp_backend_choices(is_linux):
+ if is_linux:
+ return ("botan", "openssl")
+ else:
+ return ("botan",)
+
option("--with-librnp-backend",
- help="Build librnp with the selected backend: {botan, openssl}",
+ help="Build librnp with the selected backend",
+ choices=librnp_backend_choices,
+ nargs=1,
default="botan")
@depends("--with-librnp-backend")
def librnp_backend(backend):
- allowed = ("botan", "openssl")
- if backend[0] in allowed:
+ if backend:
return backend[0]
- else:
- die(f"Unsupported librnp backend {backend[0]}.")
set_config("MZLA_LIBRNP_BACKEND", librnp_backend)
@depends(librnp_backend)
def rnp_botan(backend):
@@ -273,10 +279,11 @@
set_config("MZLA_LIBRNP_OPENSSL_LIBS", openssl_flags.ldflags)
@depends(c_compiler, openssl_flags)
@imports(_from="textwrap", _import="dedent")
+ @imports(_from="__builtin__", _import="chr")
def openssl_version(compiler, openssl_flags):
log.info("Checking for OpenSSL >= 1.1.1")
if openssl_flags is None:
die("OpenSSL not found. Must be locatable with pkg-config or use --with-openssl.")

View File

@ -0,0 +1,681 @@
--- thunderbird-78.9.0/Cargo.lock.D87019-thin-vec-big-endian.diff 2021-03-22 11:34:35.584716638 +0100
+++ thunderbird-78.9.0/Cargo.lock 2021-03-22 12:29:14.140624979 +0100
@@ -4792,9 +4792,9 @@ checksum = "8eaa81235c7058867fa8c0e7314f
[[package]]
name = "thin-vec"
-version = "0.1.2"
+version = "0.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "3a93c9ade36a827a69257925808463db46ffcf193442fad01eb9bdc1d31aed81"
+checksum = "dcc760ada4a9f56fc6d0e81bd143984ebc7bb1b875a6891aa2fa613ca7394fc0"
[[package]]
name = "thiserror"
--- thunderbird-78.9.0/gfx/webrender_bindings/Cargo.toml.D87019-thin-vec-big-endian.diff 2021-03-19 22:35:16.000000000 +0100
+++ thunderbird-78.9.0/gfx/webrender_bindings/Cargo.toml 2021-03-22 11:34:35.587716631 +0100
@@ -20,7 +20,7 @@ nsstring = { path = "../../xpcom/rust/ns
bincode = "1.0"
uuid = { version = "0.8", features = ["v4"] }
fxhash = "0.2.1"
-thin-vec = { version = "0.1.0", features = ["gecko-ffi"] }
+thin-vec = { version = "0.2.1", features = ["gecko-ffi"] }
swgl = { path = "../wr/swgl" }
[dependencies.webrender]
--- thunderbird-78.9.0/intl/l10n/rust/fluent-ffi/Cargo.toml.D87019-thin-vec-big-endian.diff 2021-03-19 22:35:16.000000000 +0100
+++ thunderbird-78.9.0/intl/l10n/rust/fluent-ffi/Cargo.toml 2021-03-22 11:34:35.589716625 +0100
@@ -10,4 +10,4 @@ fluent-pseudo = "0.2"
intl-memoizer = "0.4"
unic-langid = "0.8"
nsstring = { path = "../../../../xpcom/rust/nsstring" }
-thin-vec = { version = "0.1.0", features = ["gecko-ffi"] }
+thin-vec = { version = "0.2.1", features = ["gecko-ffi"] }
--- thunderbird-78.9.0/intl/locale/rust/fluent-langneg-ffi/Cargo.toml.D87019-thin-vec-big-endian.diff 2021-03-19 22:35:16.000000000 +0100
+++ thunderbird-78.9.0/intl/locale/rust/fluent-langneg-ffi/Cargo.toml 2021-03-22 11:34:35.590716623 +0100
@@ -9,7 +9,7 @@ edition = "2018"
nserror = { path = "../../../../xpcom/rust/nserror" }
nsstring = { path = "../../../../xpcom/rust/nsstring" }
xpcom = { path = "../../../../xpcom/rust/xpcom" }
-thin-vec = { version = "0.1.0", features = ["gecko-ffi"] }
+thin-vec = { version = "0.2.1", features = ["gecko-ffi"] }
fluent-langneg = { version = "0.12.1", features = ["cldr"] }
unic-langid = "0.8"
unic-langid-ffi = { path = "../unic-langid-ffi" }
--- thunderbird-78.9.0/intl/locale/rust/unic-langid-ffi/Cargo.toml.D87019-thin-vec-big-endian.diff 2021-03-19 22:35:16.000000000 +0100
+++ thunderbird-78.9.0/intl/locale/rust/unic-langid-ffi/Cargo.toml 2021-03-22 11:34:35.591716620 +0100
@@ -9,5 +9,5 @@ edition = "2018"
nserror = { path = "../../../../xpcom/rust/nserror" }
nsstring = { path = "../../../../xpcom/rust/nsstring" }
xpcom = { path = "../../../../xpcom/rust/xpcom" }
-thin-vec = { version = "0.1.0", features = ["gecko-ffi"] }
+thin-vec = { version = "0.2.1", features = ["gecko-ffi"] }
unic-langid = { version = "0.8", features = ["likelysubtags"] }
--- thunderbird-78.9.0/netwerk/socket/neqo_glue/Cargo.toml.D87019-thin-vec-big-endian.diff 2021-03-19 22:35:40.000000000 +0100
+++ thunderbird-78.9.0/netwerk/socket/neqo_glue/Cargo.toml 2021-03-22 11:34:35.600716597 +0100
@@ -14,7 +14,7 @@ neqo-common = { tag = "v0.2.4", git = "h
nserror = { path = "../../../xpcom/rust/nserror" }
nsstring = { path = "../../../xpcom/rust/nsstring" }
xpcom = { path = "../../../xpcom/rust/xpcom" }
-thin-vec = { version = "0.1.0", features = ["gecko-ffi"] }
+thin-vec = { version = "0.2.1", features = ["gecko-ffi"] }
[dependencies.neqo-crypto]
tag = "v0.2.4"
--- thunderbird-78.9.0/security/manager/ssl/cert_storage/Cargo.toml.D87019-thin-vec-big-endian.diff 2021-03-19 22:35:52.000000000 +0100
+++ thunderbird-78.9.0/security/manager/ssl/cert_storage/Cargo.toml 2021-03-22 11:34:35.601716594 +0100
@@ -18,6 +18,6 @@ rust_cascade = "0.6.0"
sha2 = "^0.8"
storage_variant = { path = "../../../../storage/variant" }
tempfile = "3"
-thin-vec = { version = "0.1.0", features = ["gecko-ffi"] }
+thin-vec = { version = "0.2.1", features = ["gecko-ffi"] }
time = "0.1"
xpcom = { path = "../../../../xpcom/rust/xpcom" }
--- thunderbird-78.9.0/services/fxaccounts/rust-bridge/firefox-accounts-bridge/Cargo.toml.D87019-thin-vec-big-endian.diff 2021-03-19 22:35:49.000000000 +0100
+++ thunderbird-78.9.0/services/fxaccounts/rust-bridge/firefox-accounts-bridge/Cargo.toml 2021-03-22 11:34:35.603716589 +0100
@@ -20,5 +20,5 @@ nserror = { path = "../../../../xpcom/ru
nsstring = { path = "../../../../xpcom/rust/nsstring" }
xpcom = { path = "../../../../xpcom/rust/xpcom" }
storage_variant = { path = "../../../../storage/variant" }
-thin-vec = { version = "0.1", features = ["gecko-ffi"] }
+thin-vec = { version = "0.2.1", features = ["gecko-ffi"] }
fxa-client = { git = "https://github.com/mozilla/application-services", rev = "61dcc364ac0d6d0816ab88a494bbf20d824b009b", features = ["gecko"] }
--- thunderbird-78.9.0/services/sync/golden_gate/Cargo.toml.D87019-thin-vec-big-endian.diff 2021-03-19 22:35:53.000000000 +0100
+++ thunderbird-78.9.0/services/sync/golden_gate/Cargo.toml 2021-03-22 11:34:35.605716584 +0100
@@ -19,5 +19,5 @@ sync15-traits = { git = "https://github.
xpcom = { path = "../../../xpcom/rust/xpcom" }
[dependencies.thin-vec]
-version = "0.1.0"
+version = "0.2.1"
features = ["gecko-ffi"]
--- thunderbird-78.9.0/third_party/rust/thin-vec/.cargo-checksum.json.D87019-thin-vec-big-endian.diff 2021-03-22 11:34:35.606716581 +0100
+++ thunderbird-78.9.0/third_party/rust/thin-vec/.cargo-checksum.json 2021-03-22 12:30:38.588587238 +0100
@@ -1 +1 @@
-{"files":{"Cargo.toml":"7b164cc8a702a204a4732cb4da2940711b8e3be915c258e2a972d4874d767b4c","README.md":"c26d7101e3031e7dd8890ce938e50cad7a1e6adf7fc2f2b0d3c36b03afe68c0b","src/lib.rs":"9f2a087cabfe0b6f83818323bb9004b45fe7548c51376816fd8d4572256bd0e8","src/range.rs":"bac59bcb6230367a39c7e28ac15263e4526f966cd8c72015873017f17c115aaa"},"package":"3a93c9ade36a827a69257925808463db46ffcf193442fad01eb9bdc1d31aed81"}
\ No newline at end of file
+{"files":{"Cargo.toml":"754c05523d17eb7591c3ea2c9294e47c05fbb257fed04b78546fb2ec7cafa8b4","README.md":"c26d7101e3031e7dd8890ce938e50cad7a1e6adf7fc2f2b0d3c36b03afe68c0b","src/lib.rs":"627c6094c3f0286dba25bc73f5672c06c5061c25b01c513d213cbdda100673a2"},"package":"dcc760ada4a9f56fc6d0e81bd143984ebc7bb1b875a6891aa2fa613ca7394fc0"}
--- thunderbird-78.9.0/third_party/rust/thin-vec/Cargo.toml.D87019-thin-vec-big-endian.diff 2021-03-19 22:36:33.000000000 +0100
+++ thunderbird-78.9.0/third_party/rust/thin-vec/Cargo.toml 2021-03-22 12:32:38.577621737 +0100
@@ -11,8 +11,9 @@
# will likely look very different (and much more reasonable)
[package]
+edition = "2018"
name = "thin-vec"
-version = "0.1.2"
+version = "0.2.1"
authors = ["Alexis Beingessner <a.beingessner@gmail.com>"]
description = "a vec that takes up less space on the stack"
homepage = "https://github.com/gankro/thin-vec"
--- thunderbird-78.9.0/third_party/rust/thin-vec/src/lib.rs.D87019-thin-vec-big-endian.diff 2021-03-19 22:36:28.000000000 +0100
+++ thunderbird-78.9.0/third_party/rust/thin-vec/src/lib.rs 2021-03-22 12:34:10.271595434 +0100
@@ -1,47 +1,252 @@
-mod range;
+//! ThinVec is exactly the same as Vec, except that it stores its `len` and `capacity` in the buffer
+//! it allocates.
+//!
+//! This makes the memory footprint of ThinVecs lower; notably in cases where space is reserved for
+//! a non-existence ThinVec<T>. So `Vec<ThinVec<T>>` and `Option<ThinVec<T>>::None` will waste less
+//! space. Being pointer-sized also means it can be passed/stored in registers.
+//!
+//! Of course, any actually constructed ThinVec will theoretically have a bigger allocation, but
+//! the fuzzy nature of allocators means that might not actually be the case.
+//!
+//! Properties of Vec that are preserved:
+//! * `ThinVec::new()` doesn't allocate (it points to a statically allocated singleton)
+//! * reallocation can be done in place
+//! * `size_of::<ThinVec<T>>()` == `size_of::<Option<ThinVec<T>>>()`
+//!
+//! Properties of Vec that aren't preserved:
+//! * `ThinVec<T>` can't ever be zero-cost roundtripped to a `Box<[T]>`, `String`, or `*mut T`
+//! * `from_raw_parts` doesn't exist
+//! * ThinVec currently doesn't bother to not-allocate for Zero Sized Types (e.g. `ThinVec<()>`),
+//! but it could be done if someone cared enough to implement it.
+//!
+//!
+//!
+//! # Gecko FFI
+//!
+//! If you enable the gecko-ffi feature, ThinVec will verbatim bridge with the nsTArray type in
+//! Gecko (Firefox). That is, ThinVec and nsTArray have identical layouts *but not ABIs*,
+//! so nsTArrays/ThinVecs an be natively manipulated by C++ and Rust, and ownership can be
+//! transferred across the FFI boundary (**IF YOU ARE CAREFUL, SEE BELOW!!**).
+//!
+//! While this feature is handy, it is also inherently dangerous to use because Rust and C++ do not
+//! know about eachother. Specifically, this can be an issue with non-POD types (types which
+//! have destructors, move constructors, or are `!Copy`).
+//!
+//! ## Do Not Pass By Value
+//!
+//! The biggest thing to keep in mind is that **FFI functions cannot pass ThinVec/nsTArray
+//! by-value**. That is, these are busted APIs:
+//!
+//! ```rust,ignore
+//! // BAD WRONG
+//! extern fn process_data(data: ThinVec<u32>) { ... }
+//! // BAD WRONG
+//! extern fn get_data() -> ThinVec<u32> { ... }
+//! ```
+//!
+//! You must instead pass by-reference:
+//!
+//! ```rust
+//! # use thin_vec::*;
+//! # use std::mem;
+//!
+//! // Read-only access, ok!
+//! extern fn process_data(data: &ThinVec<u32>) {
+//! for val in data {
+//! println!("{}", val);
+//! }
+//! }
+//!
+//! // Replace with empty instance to take ownership, ok!
+//! extern fn consume_data(data: &mut ThinVec<u32>) {
+//! let owned = mem::replace(data, ThinVec::new());
+//! mem::drop(owned);
+//! }
+//!
+//! // Mutate input, ok!
+//! extern fn add_data(dataset: &mut ThinVec<u32>) {
+//! dataset.push(37);
+//! dataset.push(12);
+//! }
+//!
+//! // Return via out-param, usually ok!
+//! //
+//! // WARNING: output must be initialized! (Empty nsTArrays are free, so just do it!)
+//! extern fn get_data(output: &mut ThinVec<u32>) {
+//! *output = thin_vec![1, 2, 3, 4, 5];
+//! }
+//! ```
+//!
+//! Ignorable Explanation For Those Who Really Want To Know Why:
+//!
+//! > The fundamental issue is that Rust and C++ can't currently communicate about destructors, and
+//! > the semantics of C++ require destructors of function arguments to be run when the function
+//! > returns. Whether the callee or caller is responsible for this is also platform-specific, so
+//! > trying to hack around it manually would be messy.
+//! >
+//! > Also a type having a destructor changes its C++ ABI, because that type must actually exist
+//! > in memory (unlike a trivial struct, which is often passed in registers). We don't currently
+//! > have a way to communicate to Rust that this is happening, so even if we worked out the
+//! > destructor issue with say, MaybeUninit, it would still be a non-starter without some RFCs
+//! > to add explicit rustc support.
+//! >
+//! > Realistically, the best answer here is to have a "heavier" bindgen that can secretly
+//! > generate FFI glue so we can pass things "by value" and have it generate by-reference code
+//! > behind our back (like the cxx crate does). This would muddy up debugging/searchfox though.
+//!
+//! ## Types Should Be Trivially Relocatable
+//!
+//! Types in Rust are always trivially relocatable (unless suitably borrowed/[pinned][]/hidden).
+//! This means all Rust types are legal to relocate with a bitwise copy, you cannot provide
+//! copy or move constructors to execute when this happens, and the old location won't have its
+//! destructor run. This will cause problems for types which have a significant location
+//! (types that intrusively point into themselves or have their location registered with a service).
+//!
+//! While relocations are generally predictable if you're very careful, **you should avoid using
+//! types with significant locations with Rust FFI**.
+//!
+//! Specifically, ThinVec will trivially relocate its contents whenever it needs to reallocate its
+//! buffer to change its capacity. This is the default reallocation strategy for nsTArray, and is
+//! suitable for the vast majority of types. Just be aware of this limitation!
+//!
+//! ## Auto Arrays Are Dangerous
+//!
+//! ThinVec has *some* support for handling auto arrays which store their buffer on the stack,
+//! but this isn't well tested.
+//!
+//! Regardless of how much support we provide, Rust won't be aware of the buffer's limited lifetime,
+//! so standard auto array safety caveats apply about returning/storing them! ThinVec won't ever
+//! produce an auto array on its own, so this is only an issue for transferring an nsTArray into
+//! Rust.
+//!
+//! ## Other Issues
+//!
+//! Standard FFI caveats also apply:
+//!
+//! * Rust is more strict about POD types being initialized (use MaybeUninit if you must)
+//! * `ThinVec<T>` has no idea if the C++ version of `T` has move/copy/assign/delete overloads
+//! * `nsTArray<T>` has no idea if the Rust version of `T` has a Drop/Clone impl
+//! * C++ can do all sorts of unsound things that Rust can't catch
+//! * C++ and Rust don't agree on how zero-sized/empty types should be handled
+//!
+//! The gecko-ffi feature will not work if you aren't linking with code that has nsTArray
+//! defined. Specifically, we must share the symbol for nsTArray's empty singleton. You will get
+//! linking errors if that isn't defined.
+//!
+//! The gecko-ffi feature also limits ThinVec to the legacy behaviors of nsTArray. Most notably,
+//! nsTArray has a maximum capacity of i32::MAX (~2.1 billion items). Probably not an issue.
+//! Probably.
+//!
+//! [pinned]: https://doc.rust-lang.org/std/pin/index.html
use std::{fmt, io, ptr, mem, slice};
use std::collections::Bound;
use std::iter::FromIterator;
use std::slice::IterMut;
-use std::ops::{Deref, DerefMut};
+use std::ops::{Deref, DerefMut, RangeBounds};
use std::marker::PhantomData;
use std::alloc::*;
use std::cmp::*;
use std::hash::*;
use std::borrow::*;
-use range::RangeArgument;
use std::ptr::NonNull;
-#[cfg(not(feature = "gecko-ffi"))]
-type SizeType = usize;
-#[cfg(feature = "gecko-ffi")]
-type SizeType = u32;
+use impl_details::*;
-#[cfg(feature = "gecko-ffi")]
-const AUTO_MASK: u32 = 1 << 31;
-#[cfg(feature = "gecko-ffi")]
-const CAP_MASK: u32 = !AUTO_MASK;
+// modules: a simple way to cfg a whole bunch of impl details at once
#[cfg(not(feature = "gecko-ffi"))]
-const MAX_CAP: usize = !0;
-#[cfg(feature = "gecko-ffi")]
-const MAX_CAP: usize = i32::max_value() as usize;
+mod impl_details {
+ pub type SizeType = usize;
+ pub const MAX_CAP: usize = !0;
-#[cfg(not(feature = "gecko-ffi"))]
-#[inline(always)]
-fn assert_size(x: usize) -> SizeType { x }
+ #[inline(always)]
+ pub fn assert_size(x: usize) -> SizeType { x }
+}
#[cfg(feature = "gecko-ffi")]
-#[inline]
-fn assert_size(x: usize) -> SizeType {
- if x > MAX_CAP as usize {
- panic!("nsTArray size may not exceed the capacity of a 32-bit sized int");
+mod impl_details {
+ // Support for briding a gecko nsTArray verbatim into a ThinVec.
+ //
+ // ThinVec can't see copy/move/delete implementations
+ // from C++
+ //
+ // The actual layout of an nsTArray is:
+ //
+ // ```cpp
+ // struct {
+ // uint32_t mLength;
+ // uint32_t mCapacity: 31;
+ // uint32_t mIsAutoArray: 1;
+ // }
+ // ```
+ //
+ // Rust doesn't natively support bit-fields, so we manually mask
+ // and shift the bit. When the "auto" bit is set, the header and buffer
+ // are actually on the stack, meaning the ThinVec pointer-to-header
+ // is essentially an "owned borrow", and therefore dangerous to handle.
+ // There are no safety guards for this situation.
+ //
+ // On little-endian platforms, the auto bit will be the high-bit of
+ // our capacity u32. On big-endian platforms, it will be the low bit.
+ // Hence we need some platform-specific CFGs for the necessary masking/shifting.
+ //
+ // ThinVec won't ever construct an auto array. They only happen when
+ // bridging from C++. This means we don't need to ever set/preserve the bit.
+ // We just need to be able to read and handle it if it happens to be there.
+ //
+ // Handling the auto bit mostly just means not freeing/reallocating the buffer.
+
+ pub type SizeType = u32;
+
+ pub const MAX_CAP: usize = i32::max_value() as usize;
+
+ // Little endian: the auto bit is the high bit, and the capacity is
+ // verbatim. So we just need to mask off the high bit. Note that
+ // this masking is unnecessary when packing, because assert_size
+ // guards against the high bit being set.
+ #[cfg(target_endian = "little")]
+ pub fn pack_capacity(cap: SizeType) -> SizeType {
+ cap as SizeType
+ }
+ #[cfg(target_endian = "little")]
+ pub fn unpack_capacity(cap: SizeType) -> usize {
+ (cap as usize) & !(1 << 31)
+ }
+ #[cfg(target_endian = "little")]
+ pub fn is_auto(cap: SizeType) -> bool {
+ (cap & (1 << 31)) != 0
+ }
+
+ // Big endian: the auto bit is the low bit, and the capacity is
+ // shifted up one bit. Masking out the auto bit is unnecessary,
+ // as rust shifts always shift in 0's for unsigned integers.
+ #[cfg(target_endian = "big")]
+ pub fn pack_capacity(cap: SizeType) -> SizeType {
+ (cap as SizeType) << 1
+ }
+ #[cfg(target_endian = "big")]
+ pub fn unpack_capacity(cap: SizeType) -> usize {
+ (cap >> 1) as usize
+ }
+ #[cfg(target_endian = "big")]
+ pub fn is_auto(cap: SizeType) -> bool {
+ (cap & 1) != 0
}
- x as SizeType
+
+ #[inline]
+ pub fn assert_size(x: usize) -> SizeType {
+ if x > MAX_CAP as usize {
+ panic!("nsTArray size may not exceed the capacity of a 32-bit sized int");
+ }
+ x as SizeType
+ }
+
}
-/// The header of a ThinVec
+/// The header of a ThinVec.
+///
+/// The _cap can be a bitfield, so use accessors to avoid trouble.
#[repr(C)]
struct Header {
_len: SizeType,
@@ -53,38 +258,10 @@ impl Header {
self._len as usize
}
- #[cfg(feature = "gecko-ffi")]
- fn cap(&self) -> usize {
- (self._cap & CAP_MASK) as usize
- }
-
- #[cfg(not(feature = "gecko-ffi"))]
- fn cap(&self) -> usize {
- self._cap as usize
- }
-
fn set_len(&mut self, len: usize) {
self._len = assert_size(len);
}
- #[cfg(feature = "gecko-ffi")]
- fn set_cap(&mut self, cap: usize) {
- debug_assert!(cap & (CAP_MASK as usize) == cap);
- // FIXME: this is busted because it reads uninit memory
- // debug_assert!(!self.uses_stack_allocated_buffer());
- self._cap = assert_size(cap) & CAP_MASK;
- }
-
- #[cfg(feature = "gecko-ffi")]
- fn uses_stack_allocated_buffer(&self) -> bool {
- self._cap & AUTO_MASK != 0
- }
-
- #[cfg(not(feature = "gecko-ffi"))]
- fn set_cap(&mut self, cap: usize) {
- self._cap = assert_size(cap);
- }
-
fn data<T>(&self) -> *mut T {
let header_size = mem::size_of::<Header>();
let padding = padding::<T>();
@@ -102,6 +279,41 @@ impl Header {
}
}
+
+#[cfg(feature = "gecko-ffi")]
+impl Header {
+ fn cap(&self) -> usize {
+ unpack_capacity(self._cap)
+ }
+
+ fn set_cap(&mut self, cap: usize) {
+ // debug check that our packing is working
+ debug_assert_eq!(unpack_capacity(pack_capacity(cap as SizeType)), cap);
+ // FIXME: this assert is busted because it reads uninit memory
+ // debug_assert!(!self.uses_stack_allocated_buffer());
+
+ // NOTE: this always stores a cleared auto bit, because set_cap
+ // is only invoked by Rust, and Rust doesn't create auto arrays.
+ self._cap = pack_capacity(assert_size(cap));
+ }
+
+ fn uses_stack_allocated_buffer(&self) -> bool {
+ is_auto(self._cap)
+ }
+}
+
+#[cfg(not(feature = "gecko-ffi"))]
+impl Header {
+ fn cap(&self) -> usize {
+ self._cap as usize
+ }
+
+ fn set_cap(&mut self, cap: usize) {
+ self._cap = assert_size(cap);
+ }
+}
+
+
/// Singleton that all empty collections share.
/// Note: can't store non-zero ZSTs, we allocate in that case. We could
/// optimize everything to not do that (basically, make ptr == len and branch
@@ -118,9 +330,7 @@ extern {
// TODO: overflow checks everywhere
-// Utils
-
-fn oom() -> ! { std::process::abort() }
+// Utils for computing layouts of allocations
fn alloc_size<T>(cap: usize) -> usize {
// Compute "real" header size with pointer math
@@ -165,9 +375,10 @@ fn layout<T>(cap: usize) -> Layout {
fn header_with_capacity<T>(cap: usize) -> NonNull<Header> {
debug_assert!(cap > 0);
unsafe {
- let header = alloc(layout::<T>(cap)) as *mut Header;
+ let layout = layout::<T>(cap);
+ let header = alloc(layout) as *mut Header;
- if header.is_null() { oom() }
+ if header.is_null() { handle_alloc_error(layout) }
// "Infinite" capacity for zero-sized types:
(*header).set_cap(if mem::size_of::<T>() == 0 { MAX_CAP } else { cap });
@@ -179,28 +390,8 @@ fn header_with_capacity<T>(cap: usize) -
-/// ThinVec is exactly the same as Vec, except that it stores its `len` and `capacity` in the buffer
-/// it allocates.
-///
-/// This makes the memory footprint of ThinVecs lower; notably in cases where space is reserved for
-/// a non-existence ThinVec<T>. So `Vec<ThinVec<T>>` and `Option<ThinVec<T>>::None` will waste less
-/// space. Being pointer-sized also means it can be passed/stored in registers.
-///
-/// Of course, any actually constructed ThinVec will theoretically have a bigger allocation, but
-/// the fuzzy nature of allocators means that might not actually be the case.
-///
-/// Properties of Vec that are preserved:
-/// * `ThinVec::new()` doesn't allocate (it points to a statically allocated singleton)
-/// * reallocation can be done in place
-/// * `size_of::<ThinVec<T>>()` == `size_of::<Option<ThinVec<T>>>()`
-/// * NOTE: This is only possible when the `unstable` feature is used.
-///
-/// Properties of Vec that aren't preserved:
-/// * `ThinVec<T>` can't ever be zero-cost roundtripped to a `Box<[T]>`, `String`, or `*mut T`
-/// * `from_raw_parts` doesn't exist
-/// * ThinVec currently doesn't bother to not-allocate for Zero Sized Types (e.g. `ThinVec<()>`),
-/// but it could be done if someone cared enough to implement it.
-#[cfg_attr(feature = "gecko-ffi", repr(C))]
+/// See the crate's top level documentation for a description of this type.
+#[repr(C)]
pub struct ThinVec<T> {
ptr: NonNull<Header>,
boo: PhantomData<T>,
@@ -630,15 +821,15 @@ impl<T> ThinVec<T> {
}
pub fn drain<R>(&mut self, range: R) -> Drain<T>
- where R: RangeArgument<usize>
+ where R: RangeBounds<usize>
{
let len = self.len();
- let start = match range.start() {
+ let start = match range.start_bound() {
Bound::Included(&n) => n,
Bound::Excluded(&n) => n + 1,
Bound::Unbounded => 0,
};
- let end = match range.end() {
+ let end = match range.end_bound() {
Bound::Included(&n) => n + 1,
Bound::Excluded(&n) => n,
Bound::Unbounded => len,
@@ -688,11 +879,30 @@ impl<T> ThinVec<T> {
alloc_size::<T>(new_cap),
) as *mut Header;
- if ptr.is_null() { oom() }
+ if ptr.is_null() { handle_alloc_error(layout::<T>(new_cap)) }
(*ptr).set_cap(new_cap);
self.ptr = NonNull::new_unchecked(ptr);
} else {
- self.ptr = header_with_capacity::<T>(new_cap);
+ let mut new_header = header_with_capacity::<T>(new_cap);
+
+ // If we get here and have a non-zero len, then we must be handling
+ // a gecko auto array, and we have items in a stack buffer. We shouldn't
+ // free it, but we should memcopy the contents out of it and mark it as empty.
+ //
+ // T is assumed to be trivially relocatable, as this is ~required
+ // for Rust compatibility anyway. Furthermore, we assume C++ won't try
+ // to unconditionally destroy the contents of the stack allocated buffer
+ // (i.e. it's obfuscated behind a union).
+ //
+ // In effect, we are partially reimplementing the auto array move constructor
+ // by leaving behind a valid empty instance.
+ let len = self.len();
+ if cfg!(feature = "gecko-ffi") && len > 0 {
+ new_header.as_mut().data::<T>().copy_from_nonoverlapping(self.data_raw(), len);
+ self.set_len(0);
+ }
+
+ self.ptr = new_header;
}
}
@@ -1093,10 +1303,7 @@ mod tests {
use std::mem::size_of;
assert_eq!(size_of::<ThinVec<u8>>(), size_of::<&u8>());
- // We don't perform the null-pointer optimization on stable rust.
- if cfg!(feature = "unstable") {
- assert_eq!(size_of::<Option<ThinVec<u8>>>(), size_of::<&u8>());
- }
+ assert_eq!(size_of::<Option<ThinVec<u8>>>(), size_of::<&u8>());
}
#[test]
@@ -1731,7 +1938,6 @@ mod std_tests {
assert_eq!(v, &[(), ()]);
}
-/* TODO: support inclusive ranges
#[test]
fn test_drain_inclusive_range() {
let mut v = thin_vec!['a', 'b', 'c', 'd', 'e'];
@@ -1761,6 +1967,7 @@ mod std_tests {
}
#[test]
+ #[cfg(not(feature = "gecko-ffi"))]
fn test_drain_max_vec_size() {
let mut v = ThinVec::<()>::with_capacity(usize::max_value());
unsafe { v.set_len(usize::max_value()); }
@@ -1781,7 +1988,6 @@ mod std_tests {
let mut v = thin_vec![1, 2, 3, 4, 5];
v.drain(5..=5);
}
-*/
/* TODO: implement splice?
#[test]
@@ -2187,7 +2393,7 @@ mod std_tests {
assert!(v.capacity() >= 33)
}
-/* TODO: implement try_reserve
+/* TODO: implement try_reserve
#[test]
fn test_try_reserve() {
--- thunderbird-78.9.0/toolkit/components/cascade_bloom_filter/Cargo.toml.D87019-thin-vec-big-endian.diff 2021-03-19 22:36:12.000000000 +0100
+++ thunderbird-78.9.0/toolkit/components/cascade_bloom_filter/Cargo.toml 2021-03-22 11:37:44.287130273 +0100
@@ -8,5 +8,5 @@ nserror = { path = "../../../xpcom/rust/
nsstring = { path = "../../../xpcom/rust/nsstring" }
rental = "0.5.5"
rust_cascade = "0.6.0"
-thin-vec = { version = "0.1.0", features = ["gecko-ffi"] }
+thin-vec = { version = "0.2.1", features = ["gecko-ffi"] }
xpcom = { path = "../../../xpcom/rust/xpcom" }
--- thunderbird-78.9.0/toolkit/components/extensions/storage/webext_storage_bridge/Cargo.toml.D87019-thin-vec-big-endian.diff 2021-03-19 22:36:28.000000000 +0100
+++ thunderbird-78.9.0/toolkit/components/extensions/storage/webext_storage_bridge/Cargo.toml 2021-03-22 11:37:44.288130270 +0100
@@ -13,7 +13,7 @@ moz_task = { path = "../../../../../xpco
nserror = { path = "../../../../../xpcom/rust/nserror" }
nsstring = { path = "../../../../../xpcom/rust/nsstring" }
once_cell = "1"
-thin-vec = { version = "0.1.0", features = ["gecko-ffi"] }
+thin-vec = { version = "0.2.1", features = ["gecko-ffi"] }
xpcom = { path = "../../../../../xpcom/rust/xpcom" }
serde = "1"
serde_json = "1"
--- thunderbird-78.9.0/toolkit/components/kvstore/Cargo.toml.D87019-thin-vec-big-endian.diff 2021-03-19 22:36:33.000000000 +0100
+++ thunderbird-78.9.0/toolkit/components/kvstore/Cargo.toml 2021-03-22 11:37:44.289130267 +0100
@@ -18,7 +18,7 @@ rkv = "0.10.2"
storage_variant = { path = "../../../storage/variant" }
xpcom = { path = "../../../xpcom/rust/xpcom" }
tempfile = "3"
-thin-vec = { version = "0.1.0", features = ["gecko-ffi"] }
+thin-vec = { version = "0.2.1", features = ["gecko-ffi"] }
# Get rid of failure's dependency on backtrace. Eventually
# backtrace will move into Rust core, but we don't need it here.
--- thunderbird-78.9.0/toolkit/components/places/bookmark_sync/Cargo.toml.D87019-thin-vec-big-endian.diff 2021-03-19 22:36:25.000000000 +0100
+++ thunderbird-78.9.0/toolkit/components/places/bookmark_sync/Cargo.toml 2021-03-22 11:37:44.289130267 +0100
@@ -19,5 +19,5 @@ url = "2.0"
xpcom = { path = "../../../../xpcom/rust/xpcom" }
[dependencies.thin-vec]
-version = "0.1.0"
+version = "0.2.1"
features = ["gecko-ffi"]
--- thunderbird-78.9.0/tools/profiler/rust-helper/Cargo.toml.D87019-thin-vec-big-endian.diff 2021-03-19 22:36:33.000000000 +0100
+++ thunderbird-78.9.0/tools/profiler/rust-helper/Cargo.toml 2021-03-22 11:37:44.290130265 +0100
@@ -23,7 +23,7 @@ features = ["endian_fd", "elf32", "elf64
default-features = false
[dependencies.thin-vec]
-version = "0.1.0"
+version = "0.2.1"
features = ["gecko-ffi"]
[features]
--- thunderbird-78.9.0/xpcom/rust/xpcom/Cargo.toml.D87019-thin-vec-big-endian.diff 2021-03-19 22:36:33.000000000 +0100
+++ thunderbird-78.9.0/xpcom/rust/xpcom/Cargo.toml 2021-03-22 11:37:44.291130262 +0100
@@ -9,4 +9,4 @@ nsstring = { path = "../nsstring" }
nserror = { path = "../nserror" }
threadbound = "0.1"
xpcom_macros = { path = "xpcom_macros" }
-thin-vec = { version = "0.1.0", features = ["gecko-ffi"] }
+thin-vec = { version = "0.2.1", features = ["gecko-ffi"] }

View File

@ -0,0 +1,118 @@
# HG changeset patch
# User Rob Lemley <rob@thunderbird.net>
# Date 1662996130 0
# Mon Sep 12 15:22:10 2022 +0000
# Node ID 5dfb405f325609c62215f9d74e01dba029b84611
# Parent 9998ed5c2bcee289b03828eba670053614fa26da
Bug 1790446 - Stop rewriting RNP config.h.in when updating the source from upstream. r=dandarnell
Differential Revision: https://phabricator.services.mozilla.com/D157151
diff --git a/comm/python/thirdroc/thirdroc/rnp.py b/comm/python/thirdroc/thirdroc/rnp.py
--- a/comm/python/thirdroc/thirdroc/rnp.py
+++ b/comm/python/thirdroc/thirdroc/rnp.py
@@ -11,19 +11,18 @@ import re
from packaging.version import parse
from mozbuild.preprocessor import Preprocessor
-def rnp_source_update(rnp_root, version_str, revision, timestamp, bug_report):
+def rnp_source_update(rnp_root, version_str, revision, timestamp):
"""
Update RNP source files: generate version.h and mangle config.h.in
:param rnp_root:
:type rnp_root:
:param string version_str: latest version
:param string revision: revision hash (short form)
:param float timestamp: UNIX timestamp from revision
- :param string bug_report: where to report bugs for this RNP build
"""
version = parse(version_str)
version_major = version.major
version_minor = version.minor
version_patch = version.micro
@@ -36,20 +35,17 @@ def rnp_source_update(rnp_root, version_
RNP_VERSION_MINOR=version_minor,
RNP_VERSION_PATCH=version_patch,
RNP_VERSION=version_str,
RNP_VERSION_FULL=version_full,
RNP_VERSION_COMMIT_TIMESTAMP=str(timestamp),
- BUGREPORT_EMAIL=bug_report,
)
src_lib = os.path.join(rnp_root, "src", "lib")
version_h_in = os.path.join(src_lib, "version.h.in")
version_h = os.path.join(src_lib, "version.h")
- config_h_in = os.path.join(src_lib, "config.h.in")
readme_rnp = os.path.join(rnp_root, "..", "README.rnp")
generate_version_h(version_h_in, version_h, defines)
- mangle_config_h_in(config_h_in, defines)
update_readme(readme_rnp, revision)
def rnp_preprocess(tmpl, dest, defines):
"""
@@ -79,30 +75,10 @@ def generate_version_h(template, destina
with open(template) as tmpl:
with open(destination, "w") as dest:
rnp_preprocess(tmpl, dest, defines)
-def mangle_config_h_in(template, defines):
- """
- Mangle RNP's config.h.in so that it will work with CONFIGURE_DEFINE_FILES
- :param string template: path to config.h.in
- :param dict defines: result of get_defines()
- """
- with open(template) as tmpl:
- tmp_string = StringIO()
- rnp_preprocess(tmpl, tmp_string, defines)
-
- tmp_string.seek(0)
-
- with open(template, "w") as dest:
- for line in tmp_string:
- if line.startswith("#cmakedefine"):
- line = line.replace("#cmakedefine", "#undef")
- dest.write(line)
- dest.write("\n")
-
-
def update_readme(path, revision):
"""
Updates the commit hash in README.rnp
:param string path: Path to README.rnp
:param string revision: revision to insert
diff --git a/comm/third_party/update_rnp.sh b/comm/third_party/update_rnp.sh
--- a/comm/third_party/update_rnp.sh
+++ b/comm/third_party/update_rnp.sh
@@ -42,26 +42,23 @@ TAGLIST=$(git -C "${RNPgit}" tag --list
LATEST_VERSION=$($THIRDROC latest_version $TAGLIST)
REVISION=$(git -C "${RNPgit}" rev-parse --verify HEAD)
TIMESTAMP=$(git -C "${RNPgit}" show -s --format=%ct)
-BUGREPORT="https://bugzilla.mozilla.org/enter_bug.cgi?product=Thunderbird"
-
# Cleanup rnp checkout
rm -rf ${RNPgit}/{.git,.github,.cirrus.yml,.clang-format,.gitignore}
rm -rf ${RNPgit}/{_config.yml,docker.sh,ci,cmake,git-hooks,travis.sh,vcpkg.txt}
rm -rf ${RNPgit}/{Brewfile,CMakeLists.txt,CMakeSettings.json}
# Do the switch
rm -rf rnp
mv "${RNPgit}" rnp
-# Build version.h/config.h.in
+# Build version.h
$THIRDROC rnp_source_update rnp/ \
"${LATEST_VERSION}" \
"${REVISION}" \
- "${TIMESTAMP}" \
- "${BUGREPORT}"
+ "${TIMESTAMP}"
# Restore moz.build
hg revert rnp/moz.build rnp/module.ver rnp/rnp.symbols rnp/src/lib/rnp/rnp_export.h \
rnp/src/rnp/moz.build rnp/src/rnpkeys/moz.build

View File

@ -1,12 +0,0 @@
diff -up thunderbird-102.4.0/comm/third_party/rnp/moz.build.rnp-openssl thunderbird-102.4.0/comm/third_party/rnp/moz.build
--- thunderbird-102.4.0/comm/third_party/rnp/moz.build.rnp-openssl 2022-11-01 14:36:02.940726858 +0100
+++ thunderbird-102.4.0/comm/third_party/rnp/moz.build 2022-11-01 14:36:23.091726917 +0100
@@ -39,7 +39,7 @@ if CONFIG["CC_TYPE"] == "clang-cl":
rnp_defines = {
"HAVE_BZLIB_H": True,
"HAVE_ZLIB_H": True,
- "CRYPTO_BACKEND_BOTAN": True,
+ "CRYPTO_BACKEND_OPENSSL": True,
"ENABLE_AEAD": True,
"ENABLE_TWOFISH": True,
"ENABLE_BRAINPOOL": True,

126
get-calendar-langpacks.sh Executable file
View File

@ -0,0 +1,126 @@
#!/bin/bash
#set -x
set -e
usage()
{
cat << EOF
usage: $0 options
This script downloads calendar langpacks for Thunderbird.
OPTIONS:
-h Show this message
-v Version string (7.0.1)
-b Build number (1, 2, 3)
-r Reuse downloaded files (when you don't want to redownload)
EOF
}
VER=
BUILDNUM=
LANG_DATE=`date "+%Y%m%d"`
while getopts “hv:b:r” OPTION
do
case $OPTION in
h)
usage
exit 1
;;
v)
VER=$OPTARG
;;
b)
BUILDNUM=$OPTARG
;;
?)
usage
exit
;;
esac
done
if [ -z "$VER" -o -z "$BUILDNUM" ]
then
echo "Missing version or build number."
usage
exit 1
fi
WHITE='\033[1;33m'
NC='\033[0m' # No Color
LOCALES=`curl -f https://archive.mozilla.org/pub/thunderbird/candidates/$VER-candidates/build$BUILDNUM/linux-i686/ | grep "a href"|sed -e "s|.*/\([^/]*\)/\".*|\1|"|tail -n+2 |grep -v xpi`
#echo $LOCALES
rm -rf lightning-langpacks
mkdir -p lightning-langpacks
cd lightning-langpacks
LOCALE_COUNT=`echo $LOCALES| tr ' ' '\n' | wc -l`
LOCALE_NUM=0
for lang in $LOCALES; do
LOCALE_NUM=$((LOCALE_NUM+1))
echo -e "${WHITE}Processing calendar locale: $lang ($LOCALE_NUM/$LOCALE_COUNT)${NC}"
mkdir -p extracted_lightning
mkdir -p calendar-locales
#echo Downloading TB binary for locale: $lang
wget --quiet https://archive.mozilla.org/pub/thunderbird/candidates/$VER-candidates/build$BUILDNUM/linux-i686/$lang/thunderbird-$VER.tar.bz2
cd extracted_lightning
tar -xf ../thunderbird-$VER.tar.bz2 thunderbird/distribution/extensions/\{e2fda1a4-762b-4020-b5ad-a41df1933103\}.xpi
set +e
unzip -qq thunderbird/distribution/extensions/\{e2fda1a4-762b-4020-b5ad-a41df1933103\}.xpi
set -e
LIGHTNING_VERSION=`cat app.ini |grep "^Version="|sed -e 's/Version=//'`
BUILD_ID=`cat app.ini |grep "^BuildID="|sed -e 's/BuildID=//'`
MAX_VERSION=`cat app.ini |grep MaxVersion|sed -e s/MaxVersion=//`
MIN_VERSION=`cat app.ini |grep MinVersion|sed -e s/MinVersion=//`
rm -rf thunderbird
mkdir -p ../calendar-locales/chrome
cp -r chrome/calendar-$lang ../calendar-locales/chrome
cp -r chrome/lightning-$lang ../calendar-locales/chrome
cd -
cd calendar-locales
# create manifest
cat > manifest.json <<EOL
{
"languages": {
"$lang": {
"chrome_resources": {
"calendar": "chrome/calendar-$lang/locale/$lang/calendar/",
"lightning": "chrome/lightning-$lang/locale/$lang/lightning/"
},
"version": "$LIGHTNING_VERSION"
}
},
"applications": {
"gecko": {
"strict_min_version": "$MIN_VERSION",
"id": "langpack-cal-$lang@lightning.mozilla.org",
"strict_max_version": "$MAX_VERSION"
}
},
"langpack_id": "$lang",
"version": "7.$LIGHTNING_VERSION.$BUILD_ID",
"name": "$lang Language Pack Calendar",
"manifest_version": 2,
"sources": {
"browser": {
"base_path": "browser/"
}
},
"author": "Mozilla.cz (contributors: Pavel Cvrček, Pavel Franc, Michal Stanke, Michal Vašíček)",
"description": "Language pack for Thunderbird for $lang, this was repacked by Fedora/RHEL package maintainer from original binaries."
}
EOL
zip --quiet -r ../langpack-cal-$lang@lightning.mozilla.org.xpi *
cd -
rm -rf calendar-locales
rm -rf extracted_lightning
rm -f thunderbird-$VER.tar.bz2
done
echo "Creating lightning-langpacks-$VER.tar.xz..."
tar cJf ../lightning-langpacks-$VER.tar.xz *.xpi
cd ..
rm -rf lightning-langpacks

View File

@ -1,6 +1,5 @@
SHA512 (cbindgen-vendor.tar.xz) = 590e27b6c093a5c1bd839ca39c68537097d0849087a4a385ee6d7b180e9ceadbbb8974fa997f5f75af03e2c243a2f232d0d4c4c46e253ea464521b76c6886067
SHA512 (nspr-4.34.0-3.el8_1.src.rpm) = fe4715694c297cd8cefa577946358a90103bde73e78a3fdf13d202a3791736e8a48fbece09ee3d15f6d81ae051e26d96400b03bb6bf8630715746c5e1a643543
SHA512 (nss-3.79.0-6.el8_1.src.rpm) = 5887d0f306045adf7c6f3389840fff2e2732e5a15ec5e22cf885e578105b54d9e753c237e7730c2d3f0990728b10123c653e8d18a8b8dd0174bfb5b443eab7ef SHA512 (nss-3.79.0-6.el8_1.src.rpm) = 5887d0f306045adf7c6f3389840fff2e2732e5a15ec5e22cf885e578105b54d9e753c237e7730c2d3f0990728b10123c653e8d18a8b8dd0174bfb5b443eab7ef
SHA512 (nspr-4.34.0-3.el8_1.src.rpm) = fe4715694c297cd8cefa577946358a90103bde73e78a3fdf13d202a3791736e8a48fbece09ee3d15f6d81ae051e26d96400b03bb6bf8630715746c5e1a643543
SHA512 (cbindgen-vendor.tar.xz) = 590e27b6c093a5c1bd839ca39c68537097d0849087a4a385ee6d7b180e9ceadbbb8974fa997f5f75af03e2c243a2f232d0d4c4c46e253ea464521b76c6886067
SHA512 (thunderbird-102.8.0.b2.processed-source.tar.xz) = 8a3ad807791a3688212167eda848a72121273ebb76945c8f077228baf2166a51e4fe6a9dff7a0395837ba04d50c7b850dea7e8c63d2f343f702044178ece83e4 SHA512 (thunderbird-102.8.0.b2.processed-source.tar.xz) = 8a3ad807791a3688212167eda848a72121273ebb76945c8f077228baf2166a51e4fe6a9dff7a0395837ba04d50c7b850dea7e8c63d2f343f702044178ece83e4
SHA512 (thunderbird-langpacks-102.8.0-20230215.tar.xz) = c85933b2c2f90ad0c1584c740fa7ce0657b023a80968e0924eaa34599b3167161e6eb493645fc4ea84290f7532b4b30a229bbb3e0691a1147eecd27456a7abdc SHA512 (thunderbird-langpacks-102.8.0-20230215.tar.xz) = c85933b2c2f90ad0c1584c740fa7ce0657b023a80968e0924eaa34599b3167161e6eb493645fc4ea84290f7532b4b30a229bbb3e0691a1147eecd27456a7abdc
SHA512 (thunderbird-symbolic.svg) = edde2f75ec8eee9e9fb060140b7b4dc034771a92027c2518a010652c53e6cd0ecc8b7ed08f13143f2d8ac15b0e4416cb95450b524e42f46cdb9dd0f00a27f285

View File

View File

@ -1255,9 +1255,6 @@ gtk-update-icon-cache %{_datadir}/icons/hicolor &>/dev/null || :
#=============================================================================== #===============================================================================
%changelog %changelog
* Mon Feb 20 2023 CentOS Sources <bugs@centos.org> - 102.8.0-2.el8.centos
- Apply debranding changes
* Wed Feb 15 2023 Eike Rathke <erack@redhat.com> - 102.8.0-2 * Wed Feb 15 2023 Eike Rathke <erack@redhat.com> - 102.8.0-2
- Update to 102.8.0 build2 - Update to 102.8.0 build2