diff options
author | Richard Purdie <richard.purdie@linuxfoundation.org> | 2023-07-26 20:47:42 +0100 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2023-07-26 20:51:00 +0100 |
commit | 5e7bf2a17d888bf2a8afcbbbd92269d873e7422c (patch) | |
tree | 5c70292caca8127f187342310142a54dd4ed7f22 /meta/recipes-devtools/createrepo-c | |
parent | 7ed65df80f5929229a8e2ba7c179dcbd1ad480ad (diff) | |
download | poky-5e7bf2a17d888bf2a8afcbbbd92269d873e7422c.tar.gz |
createrepo-c: Fix 32 bit architecture segfaults with 64 bit time
After including time64.inc, createrepo-c was segfaulting on 32 bit architectures
when creating repo indexes (even for an empty repo).
Add a patch from Khem to fix this and some other compiler warnings related to 64
bit time on 32 bit.
[YOCTO #15170]
(From OE-Core rev: a5137a5c5c03a728faf57fd335ca8378f4f4cb91)
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/recipes-devtools/createrepo-c')
-rw-r--r-- | meta/recipes-devtools/createrepo-c/createrepo-c/time64fix.patch | 69 | ||||
-rw-r--r-- | meta/recipes-devtools/createrepo-c/createrepo-c_0.21.1.bb | 1 |
2 files changed, 70 insertions, 0 deletions
diff --git a/meta/recipes-devtools/createrepo-c/createrepo-c/time64fix.patch b/meta/recipes-devtools/createrepo-c/createrepo-c/time64fix.patch new file mode 100644 index 0000000000..d022d95b70 --- /dev/null +++ b/meta/recipes-devtools/createrepo-c/createrepo-c/time64fix.patch | |||
@@ -0,0 +1,69 @@ | |||
1 | From 89e1c9415fb8438310036d5810cdb7da75ee3a7f Mon Sep 17 00:00:00 2001 | ||
2 | From: Khem Raj <raj.khem@gmail.com> | ||
3 | Date: Wed, 26 Jul 2023 12:27:14 -0700 | ||
4 | Subject: [PATCH] Adjust printf formats for 64bit time_t on 32bit systems | ||
5 | |||
6 | Fixes format specifier mismatch warnings as well while here | ||
7 | |||
8 | e.g. | ||
9 | warning: format '%ld' expects argument of type 'long int', but argument 2 has type 'time_t' | ||
10 | |||
11 | Upstream-Status: Pending | ||
12 | |||
13 | Signed-off-by: Khem Raj <raj.khem@gmail.com> | ||
14 | --- | ||
15 | src/createrepo_c.c | 4 ++-- | ||
16 | src/misc.c | 4 ++-- | ||
17 | src/xml_dump_repomd.c | 2 +- | ||
18 | 3 files changed, 5 insertions(+), 5 deletions(-) | ||
19 | |||
20 | diff --git a/src/createrepo_c.c b/src/createrepo_c.c | ||
21 | index 8681419..0f9048a 100644 | ||
22 | --- a/src/createrepo_c.c | ||
23 | +++ b/src/createrepo_c.c | ||
24 | @@ -582,9 +582,9 @@ duplicates_warning(const char *nevra, GArray *locations, CmdDupNevra option) | ||
25 | for (size_t i=0; i<locations->len; i++) { | ||
26 | struct DuplicateLocation location = g_array_index(locations, struct | ||
27 | DuplicateLocation, i); | ||
28 | - g_warning(" Sourced from location: \'%s\', build timestamp: %ld%s", | ||
29 | + g_warning(" Sourced from location: \'%s\', build timestamp: %jd%s", | ||
30 | location.location, | ||
31 | - location.pkg->time_build, | ||
32 | + (intmax_t) location.pkg->time_build, | ||
33 | location.pkg->skip_dump ? skip_reason : ""); | ||
34 | |||
35 | } | ||
36 | diff --git a/src/misc.c b/src/misc.c | ||
37 | index 8511ca2..7866c7b 100644 | ||
38 | --- a/src/misc.c | ||
39 | +++ b/src/misc.c | ||
40 | @@ -1512,11 +1512,11 @@ cr_append_pid_and_datetime(const char *str, const char *suffix) | ||
41 | gettimeofday(&tv, NULL); | ||
42 | timeinfo = localtime (&(tv.tv_sec)); | ||
43 | strftime(datetime, 80, "%Y%m%d%H%M%S", timeinfo); | ||
44 | - gchar *result = g_strdup_printf("%s%jd.%s.%ld%s", | ||
45 | + gchar *result = g_strdup_printf("%s%jd.%s.%jd%s", | ||
46 | str ? str : "", | ||
47 | (intmax_t) getpid(), | ||
48 | datetime, | ||
49 | - tv.tv_usec, | ||
50 | + (intmax_t) tv.tv_usec, | ||
51 | suffix ? suffix : ""); | ||
52 | return result; | ||
53 | } | ||
54 | diff --git a/src/xml_dump_repomd.c b/src/xml_dump_repomd.c | ||
55 | index 33b0e09..9d24249 100644 | ||
56 | --- a/src/xml_dump_repomd.c | ||
57 | +++ b/src/xml_dump_repomd.c | ||
58 | @@ -143,7 +143,7 @@ cr_xml_dump_repomd_body(xmlNodePtr root, cr_Repomd *repomd) | ||
59 | BAD_CAST repomd->revision); | ||
60 | } else { | ||
61 | // Use the current time if no revision was explicitly specified | ||
62 | - gchar *rev = g_strdup_printf("%ld", time(NULL)); | ||
63 | + gchar *rev = g_strdup_printf("%jd", (intmax_t) time(NULL)); | ||
64 | xmlNewChild(root, NULL, BAD_CAST "revision", BAD_CAST rev); | ||
65 | g_free(rev); | ||
66 | } | ||
67 | -- | ||
68 | 2.41.0 | ||
69 | |||
diff --git a/meta/recipes-devtools/createrepo-c/createrepo-c_0.21.1.bb b/meta/recipes-devtools/createrepo-c/createrepo-c_0.21.1.bb index 5080131dc1..57f23b8dfd 100644 --- a/meta/recipes-devtools/createrepo-c/createrepo-c_0.21.1.bb +++ b/meta/recipes-devtools/createrepo-c/createrepo-c_0.21.1.bb | |||
@@ -8,6 +8,7 @@ SRC_URI = "git://github.com/rpm-software-management/createrepo_c;branch=master;p | |||
8 | file://0001-Do-not-set-PYTHON_INSTALL_DIR-by-running-python.patch \ | 8 | file://0001-Do-not-set-PYTHON_INSTALL_DIR-by-running-python.patch \ |
9 | file://0001-include-rpm-rpmstring.h.patch \ | 9 | file://0001-include-rpm-rpmstring.h.patch \ |
10 | file://0001-src-cmd_parser.c-add-a-missing-parameter-name.patch \ | 10 | file://0001-src-cmd_parser.c-add-a-missing-parameter-name.patch \ |
11 | file://time64fix.patch \ | ||
11 | " | 12 | " |
12 | 13 | ||
13 | SRCREV = "0652d7303ce236e596c83c29ccc9bee7868fce6e" | 14 | SRCREV = "0652d7303ce236e596c83c29ccc9bee7868fce6e" |