diff --git a/.files b/.files index 73f4da7..c29f2f0 100644 Binary files a/.files and b/.files differ diff --git a/.rev b/.rev index 6db05f8..16ee0e6 100644 --- a/.rev +++ b/.rev @@ -2280,4 +2280,12 @@ See bugzilla 1167537 for the gory details. Automatic submission by obs-autosubmit 894744 + + c55011a96cc2b7f3051477f2d3182794 + 4.17.0 + + dimstar_suse + update to rpm-4.17.0 + 923520 + diff --git a/add-dwz-single-file-mode-option.patch b/add-dwz-single-file-mode-option.patch deleted file mode 100644 index e6133b1..0000000 --- a/add-dwz-single-file-mode-option.patch +++ /dev/null @@ -1,62 +0,0 @@ -From d741374effd75baaa35047c29c7a8adf819138ff Mon Sep 17 00:00:00 2001 -From: Martin Liska -Date: Mon, 15 Mar 2021 16:58:34 +0100 -Subject: [PATCH] Add --dwz-single-file-mode argument for find-debuginfo.sh. - -Sometime it's handy to disable multi-file mode and the patch -adds option for that: --dwz-single-file-mode. - -It will be used in openSUSE for packages that use baselibs.conf -mechanism. ---- - scripts/find-debuginfo.sh | 9 ++++++++- - 1 file changed, 8 insertions(+), 1 deletion(-) - -diff --git a/scripts/find-debuginfo.sh b/scripts/find-debuginfo.sh -index e0c36ebb6..2503b0f01 100755 ---- a/scripts/find-debuginfo.sh -+++ b/scripts/find-debuginfo.sh -@@ -10,6 +10,7 @@ - # [-S debugsourcefiles.list] - # [--run-dwz] [--dwz-low-mem-die-limit N] - # [--dwz-max-die-limit N] -+# [--dwz-single-file-mode] - # [--build-id-seed SEED] - # [--unique-debug-suffix SUFFIX] - # [--unique-debug-src-base BASE] -@@ -45,6 +46,8 @@ - # The --run-dwz flag instructs find-debuginfo.sh to run the dwz utility - # if available, and --dwz-low-mem-die-limit and --dwz-max-die-limit - # provide detailed limits. See dwz(1) -l and -L option for details. -+# Use --dwz-single-file-mode to disable multi-file mode, see -m -+# for more details. - # - # If --build-id-seed SEED is given then debugedit is called to - # update the build-ids it finds adding the SEED as seed to recalculate -@@ -96,6 +99,7 @@ no_recompute_build_id=false - run_dwz=false - dwz_low_mem_die_limit= - dwz_max_die_limit= -+dwz_single_file_mode=false - - # build id seed given by the --build-id-seed option - build_id_seed= -@@ -129,6 +133,9 @@ while [ $# -gt 0 ]; do - dwz_max_die_limit=$2 - shift - ;; -+ --dwz-single-file-mode) -+ dwz_single_file_mode=true -+ ;; - --build-id-seed) - build_id_seed=$2 - shift -@@ -523,7 +530,7 @@ if $run_dwz \ - done - dwz_multifile_name="${dwz_multifile_name}${dwz_multifile_suffix}" - dwz_opts="-h -q -r" -- [ ${#dwz_files[@]} -gt 1 ] \ -+ [ ${#dwz_files[@]} -gt 1 ] && [ "$dwz_single_file_mode" = "false" ] \ - && dwz_opts="${dwz_opts} -m .dwz/${dwz_multifile_name}" - mkdir -p "${RPM_BUILD_ROOT}/usr/lib/debug/.dwz" - [ -n "${dwz_low_mem_die_limit}" ] \ diff --git a/brp.diff b/brp.diff index 048615b..1f8e642 100644 --- a/brp.diff +++ b/brp.diff @@ -1,5 +1,5 @@ ---- ./scripts/brp-strip-comment-note.orig 2020-05-28 10:04:25.076136900 +0000 -+++ ./scripts/brp-strip-comment-note 2020-09-30 12:27:44.484016581 +0000 +--- ./scripts/brp-strip-comment-note.orig 2021-06-21 12:00:44.650612737 +0000 ++++ ./scripts/brp-strip-comment-note 2021-09-23 19:04:31.249193665 +0000 @@ -16,6 +16,8 @@ esac # for already stripped elf files in the build root for f in `find "$RPM_BUILD_ROOT" -type f \( -perm -0100 -or -perm -0010 -or -perm -0001 \) -exec file {} \; | \ @@ -9,11 +9,11 @@ sed -n -e 's/^\(.*\):[ ]*ELF.*, stripped.*/\1/p'`; do note="-R .note" if $OBJDUMP -h $f | grep '^[ ]*[0-9]*[ ]*.note[ ]' -A 1 | \ ---- ./scripts/brp-strip.orig 2020-09-30 12:27:44.484016581 +0000 -+++ ./scripts/brp-strip 2020-09-30 12:28:43.959881586 +0000 +--- ./scripts/brp-strip.orig 2021-09-23 19:04:31.249193665 +0000 ++++ ./scripts/brp-strip 2021-09-23 19:07:10.624868675 +0000 @@ -14,4 +14,4 @@ esac # Strip ELF binaries - find "$RPM_BUILD_ROOT" -type f \( -perm -0100 -or -perm -0010 -or -perm -0001 \) \! -regex "${RPM_BUILD_ROOT}/*usr/lib/debug.*" -print0 | \ -- xargs -0 -r -P$NCPUS -n32 sh -c "file \"\$@\" | grep -v ' shared object,' | sed -n -e 's/^\(.*\):[ ]*ELF.*, not stripped.*/\1/p' | xargs -I\{\} $STRIP -g \{\}" ARG0 -+ xargs -0 -r -P$NCPUS -n32 sh -c "file \"\$@\" | grep -v ' shared object,' | grep -v '/lib/modules/' | sed -n -e 's/^\(.*\):[ ]*ELF.*, not stripped.*/\1/p' | xargs -I\{\} $STRIP -g \{\}" ARG0 + find "$RPM_BUILD_ROOT" -type f \! -regex "${RPM_BUILD_ROOT}/*usr/lib/debug.*" \! -name "*.ko" -print0 | \ +- xargs -0 -r -P$NCPUS -n32 sh -c "file \"\$@\" | sed -n -e 's/^\(.*\):[ ]*ELF.*, not stripped.*/\1/p' | xargs -I\{\} $STRIP -g \{\}" ARG0 ++ xargs -0 -r -P$NCPUS -n32 sh -c "file \"\$@\" | grep -v '/lib/modules/' | sed -n -e 's/^\(.*\):[ ]*ELF.*, not stripped.*/\1/p' | xargs -I\{\} $STRIP -g \{\}" ARG0 diff --git a/build.diff b/build.diff index a593f39..88983e2 100644 --- a/build.diff +++ b/build.diff @@ -1,17 +1,3 @@ ---- db3/configure -+++ db3/configure -@@ -10,9 +10,9 @@ - # XXX edit CFLAGS= ... out of invocation args ??? - ARGS="`echo $* | sed -e 's% [^ ]*CFLAGS=[^ ]*%%' -e 's% -[^-][^ ]*%%g' -e 's% --param=[^ ]*%%g' -e 's%--cache-file=.*$%%'`" - --CC="$CC" CFLAGS="$CFLAGS" $db_dist/configure $ARGS \ -+CC="$CC" CFLAGS="$CFLAGS" $db_dist/configure \ - --enable-shared --enable-static \ -- --with-uniquename=_rpmdb --srcdir=$db_dist -+ --with-uniquename=_rpmdb --srcdir=$db_dist --with-pic $ARGS - - mv Makefile Makefile.orig - cat Makefile.orig | sed -e '/^install[:-]/c\ --- installplatform +++ installplatform @@ -118,6 +118,11 @@ diff --git a/db-4.8.30.tar.bz2 b/db-4.8.30.tar.bz2 deleted file mode 120000 index 7bef8f6..0000000 --- a/db-4.8.30.tar.bz2 +++ /dev/null @@ -1 +0,0 @@ -/ipfs/bafybeigcpue5sb3wdxusrm3yj2vtnbn73adqrkk6y4jk7ngqax7xia5ukq \ No newline at end of file diff --git a/db.diff b/db.diff deleted file mode 100644 index dbfb293..0000000 --- a/db.diff +++ /dev/null @@ -1,82 +0,0 @@ ---- db/db/db.c.orig 2010-04-12 20:25:22.000000000 +0000 -+++ db/db/db.c 2011-05-12 11:38:59.000000000 +0000 -@@ -646,6 +646,8 @@ __env_mpool(dbp, fname, flags) - MAKE_INMEM(dbp); - return (ret); - } -+ if (LF_ISSET(DB_NOFSYNC) && mpf->mfp) -+ F_SET(mpf->mfp, MP_NOFSYNC); - - /* - * Set the open flag. We use it to mean that the dbp has gone ---- db/db/db_iface.c.orig 2010-04-12 20:25:22.000000000 +0000 -+++ db/db/db_iface.c 2011-05-12 11:21:32.000000000 +0000 -@@ -1230,6 +1230,7 @@ __db_open_arg(dbp, txn, fname, dname, ty - #define OKFLAGS \ - (DB_AUTO_COMMIT | DB_CREATE | DB_EXCL | DB_FCNTL_LOCKING | \ - DB_MULTIVERSION | DB_NOMMAP | DB_NO_AUTO_COMMIT | DB_RDONLY | \ -+ DB_NOFSYNC | \ - DB_RDWRMASTER | DB_READ_UNCOMMITTED | DB_THREAD | DB_TRUNCATE) - if ((ret = __db_fchk(env, "DB->open", flags, OKFLAGS)) != 0) - return (ret); ---- db/dbinc/mp.h.orig 2010-04-12 20:25:22.000000000 +0000 -+++ db/dbinc/mp.h 2011-05-12 12:01:32.000000000 +0000 -@@ -467,6 +467,7 @@ struct __mpoolfile { - #define MP_FAKE_UOC 0x080 /* Unlink_on_close field: fake flag. */ - #define MP_NOT_DURABLE 0x100 /* File is not durable. */ - #define MP_TEMP 0x200 /* Backing file is a temporary. */ -+#define MP_NOFSYNC 0x400 /* Don't fsync */ - u_int32_t flags; - }; - ---- db/dbinc_auto/api_flags.in.orig 2011-05-12 11:40:57.000000000 +0000 -+++ db/dbinc_auto/api_flags.in 2011-05-12 11:55:10.000000000 +0000 -@@ -83,6 +83,7 @@ - #define DB_NOORDERCHK 0x00000002 - #define DB_NOPANIC 0x00000800 - #define DB_NO_AUTO_COMMIT 0x00001000 -+#define DB_NOFSYNC 0x00040000 - #define DB_ODDFILESIZE 0x00000080 - #define DB_ORDERCHKONLY 0x00000004 - #define DB_OVERWRITE 0x00001000 ---- db/dist/s_config.orig 2010-04-12 20:25:23.000000000 +0000 -+++ db/dist/s_config 2011-05-12 12:00:34.000000000 +0000 -@@ -8,7 +8,8 @@ trap 'rm -f aclocal.m4 ; exit 0' 0 1 2 3 - . ./RELEASE - - echo "autoconf: building aclocal.m4..." --cat aclocal/*.m4 aclocal_java/*.m4 > aclocal.m4 -+cat aclocal/*.m4 aclocal_java/*.m4 > acinclude.m4 -+aclocal - - echo "autoconf: running autoheader to build config.hin..." - rm -f config.hin ---- db/mp/mp_sync.c.orig 2010-04-12 20:25:34.000000000 +0000 -+++ db/mp/mp_sync.c 2011-05-12 11:36:58.000000000 +0000 -@@ -578,7 +578,7 @@ done: /* - if (ret == 0 && required_write) { - if (dbmfp == NULL) - ret = __memp_sync_files(env); -- else -+ else if (!F_ISSET(dbmfp->mfp, MP_NOFSYNC)) - ret = __os_fsync(env, dbmfp->fhp); - } - -@@ -665,7 +665,7 @@ __memp_sync_file(env, mfp, argp, countp, - "%s: unable to flush", (char *) - R_ADDR(dbmp->reginfo, mfp->path_off)); - } -- } else -+ } else if (!F_ISSET(dbmfp->mfp, MP_NOFSYNC)) - ret = __os_fsync(env, dbmfp->fhp); - - /* -@@ -801,6 +801,8 @@ __memp_mf_sync(dbmp, mfp, locked) - COMPQUIET(hp, NULL); - env = dbmp->env; - -+ if (F_ISSET(mfp, MP_NOFSYNC)) -+ return 0; - /* - * We need to be holding the hash lock: we're using the path name - * and __memp_nameop might try and rename the file. diff --git a/dbfsync.diff b/dbfsync.diff deleted file mode 100644 index 10a5844..0000000 --- a/dbfsync.diff +++ /dev/null @@ -1,24 +0,0 @@ -Support a database-local fsync setting. Needs berkeley db patch. - ---- ./lib/backend/db3.c.orig 2017-01-19 10:31:06.874215725 +0000 -+++ ./lib/backend/db3.c 2017-01-19 10:32:51.825873926 +0000 -@@ -73,8 +73,10 @@ static const struct poptOption rdbOption - { "mp_size", 0,POPT_ARG_INT, &staticcfg.db_cachesize, 0, - NULL, NULL }, - -+#if 0 - { "nofsync", 0,POPT_ARG_NONE, &staticcfg.db_no_fsync, 0, - NULL, NULL }, -+#endif - - /* Per-dbi options */ - { "nommap", 0,POPT_BIT_SET, &staticdbicfg.dbi_oflags, DB_NOMMAP, -@@ -84,6 +86,8 @@ static const struct poptOption rdbOption - NULL, NULL }, - { "lockdbfd", 0,POPT_ARG_NONE, &staticdbicfg.dbi_lockdbfd, 0, - NULL, NULL }, -+ { "nofsync", 0,POPT_BIT_SET, &staticdbicfg.dbi_oflags, DB_NOFSYNC, -+ NULL, NULL }, - - POPT_TABLEEND - }; diff --git a/dbprivate.diff b/dbprivate.diff deleted file mode 100644 index 75402a9..0000000 --- a/dbprivate.diff +++ /dev/null @@ -1,11 +0,0 @@ ---- ./lib/backend/db3.c.orig 2017-12-01 15:44:53.609993968 +0000 -+++ ./lib/backend/db3.c 2017-12-01 15:45:05.462959735 +0000 -@@ -416,7 +416,7 @@ static int db_init(rpmdb rdb, const char - int rdonly = ((rdb->db_mode & O_ACCMODE) == O_RDONLY); - struct dbConfig_s * cfg = &rdb->cfg; - /* This is our setup, thou shall not have other setups before us */ -- uint32_t eflags = (DB_CREATE|DB_INIT_MPOOL|DB_INIT_CDB); -+ uint32_t eflags = (DB_CREATE|DB_INIT_MPOOL|DB_INIT_CDB|DB_PRIVATE); - - if (rdb->db_dbenv != NULL) { - rdb->db_opens++; diff --git a/debugedit-5.0.tar.xz b/debugedit-5.0.tar.xz new file mode 120000 index 0000000..e0dcea6 --- /dev/null +++ b/debugedit-5.0.tar.xz @@ -0,0 +1 @@ +/ipfs/bafkreihj5tl5guf6xlq7c6gom53mugngjc3p5d5cf5ntarftrv4jtksvhy \ No newline at end of file diff --git a/debuginfo-mono.patch b/debuginfo-mono.patch index c4a9847..73f02e2 100644 --- a/debuginfo-mono.patch +++ b/debuginfo-mono.patch @@ -1,6 +1,6 @@ ---- ./scripts/find-debuginfo.sh.orig 2017-12-01 15:40:27.006764372 +0000 -+++ ./scripts/find-debuginfo.sh 2017-12-01 15:41:17.270619182 +0000 -@@ -348,6 +348,16 @@ while read nlinks inum f; do +--- ./scripts/find-debuginfo.in.orig 2021-09-23 20:28:21.646855995 +0000 ++++ ./scripts/find-debuginfo.in 2021-09-23 20:28:53.530790698 +0000 +@@ -434,6 +434,16 @@ while read nlinks inum f; do ;; *) continue ;; esac diff --git a/debuglink.diff b/debuglink.diff index 0ff8ac4..8dfafad 100644 --- a/debuglink.diff +++ b/debuglink.diff @@ -1,6 +1,6 @@ ---- ./scripts/find-debuginfo.sh.orig 2017-12-01 15:39:07.239994681 +0000 -+++ ./scripts/find-debuginfo.sh 2017-12-01 15:39:34.942914702 +0000 -@@ -321,7 +321,7 @@ debug_link() +--- ./scripts/find-debuginfo.in.orig 2021-09-23 20:27:13.686995174 +0000 ++++ ./scripts/find-debuginfo.in 2021-09-23 20:27:40.826939593 +0000 +@@ -407,7 +407,7 @@ debug_link() get_debugfn() { dn=$(dirname "${1#$RPM_BUILD_ROOT}") diff --git a/debugsubpkg.diff b/debugsubpkg.diff index 58585a0..4527812 100644 --- a/debugsubpkg.diff +++ b/debugsubpkg.diff @@ -1,6 +1,6 @@ ---- ./scripts/find-debuginfo.sh.orig 2017-12-01 15:35:59.023537837 +0000 -+++ ./scripts/find-debuginfo.sh 2017-12-01 15:36:30.351447397 +0000 -@@ -548,19 +548,25 @@ if $run_dwz \ +--- ./scripts/find-debuginfo.in.orig 2021-09-23 20:25:41.059184871 +0000 ++++ ./scripts/find-debuginfo.in 2021-09-23 20:26:40.363063418 +0000 +@@ -643,19 +643,25 @@ if $run_dwz \ fi fi diff --git a/dwarf5.diff b/dwarf5.diff deleted file mode 100644 index b72b011..0000000 --- a/dwarf5.diff +++ /dev/null @@ -1,1951 +0,0 @@ -# Contains DWARF 5 support and includes the following upstream patches: - -6b0019cd0c5ae18a59affa49a857b4d610d403e4 -a834fccf3c94f78ad6a1b35ae352b1ede183dde4 -86408cd826c32229817071bd008d9856cda4aca5 -0d1003bc723ba30bfe325bb51aeafe7dbfed6a5c - ---- ./tools/debugedit.c.orig 2021-03-30 09:34:25.206392109 +0000 -+++ ./tools/debugedit.c 2021-03-30 09:34:40.186365656 +0000 -@@ -103,6 +103,8 @@ static bool need_string_replacement = fa - /* Whether we need to do any updates of the string indexes (DW_FORM_strp) - in debug_info for string indexes. */ - static bool need_strp_update = false; -+/* Likewise for DW_FORM_line_strp. */ -+static bool need_line_strp_update = false; - /* If the debug_line changes size we will need to update the - DW_AT_stmt_list attributes indexes in the debug_info. */ - static bool need_stmt_update = false; -@@ -192,7 +194,7 @@ typedef struct - const char *filename; - int lastscn; - size_t phnum; -- struct strings strings; -+ struct strings debug_str, debug_line_str; - struct debug_lines lines; - GElf_Shdr shdr[0]; - } DSO; -@@ -233,7 +235,7 @@ typedef struct - int shift = 0; \ - do \ - { \ -- c = *ptr++; \ -+ c = *(ptr)++; \ - ret |= (c & 0x7f) << shift; \ - shift += 7; \ - } while (c & 0x80); \ -@@ -251,7 +253,7 @@ typedef struct - valv >>= 7; \ - if (valv) \ - c |= 0x80; \ -- *ptr++ = c; \ -+ *(ptr)++ = c; \ - } \ - while (valv); \ - }) -@@ -311,7 +313,7 @@ strptr (DSO *dso, int sec, off_t offset) - } - - --#define read_8(ptr) *ptr++ -+#define read_8(ptr) *(ptr)++ - - #define read_16(ptr) ({ \ - uint16_t ret = do_read_16 (ptr); \ -@@ -328,13 +330,13 @@ strptr (DSO *dso, int sec, off_t offset) - REL *relptr, *relend; - int reltype; - --#define do_read_32_relocated(ptr) ({ \ -- uint32_t dret = do_read_32 (ptr); \ -+#define do_read_32_relocated(xptr) ({ \ -+ uint32_t dret = do_read_32 (xptr); \ - if (relptr) \ - { \ -- while (relptr < relend && relptr->ptr < ptr) \ -+ while (relptr < relend && relptr->ptr < (xptr)) \ - ++relptr; \ -- if (relptr < relend && relptr->ptr == ptr) \ -+ if (relptr < relend && relptr->ptr == (xptr)) \ - { \ - if (reltype == SHT_REL) \ - dret += relptr->addend; \ -@@ -433,7 +435,8 @@ typedef struct debug_section - int sec, relsec; - REL *relbuf; - REL *relend; -- struct debug_section *next; /* Only happens for COMDAT .debug_macro. */ -+ /* Only happens for COMDAT .debug_macro and .debug_types. */ -+ struct debug_section *next; - } debug_section; - - static debug_section debug_sections[] = -@@ -452,6 +455,11 @@ static debug_section debug_sections[] = - #define DEBUG_TYPES 11 - #define DEBUG_MACRO 12 - #define DEBUG_GDB_SCRIPT 13 -+#define DEBUG_RNGLISTS 14 -+#define DEBUG_LINE_STR 15 -+#define DEBUG_ADDR 16 -+#define DEBUG_STR_OFFSETS 17 -+#define DEBUG_LOCLISTS 18 - { ".debug_info", NULL, NULL, 0, 0, 0 }, - { ".debug_abbrev", NULL, NULL, 0, 0, 0 }, - { ".debug_line", NULL, NULL, 0, 0, 0 }, -@@ -466,6 +474,11 @@ static debug_section debug_sections[] = - { ".debug_types", NULL, NULL, 0, 0, 0 }, - { ".debug_macro", NULL, NULL, 0, 0, 0 }, - { ".debug_gdb_scripts", NULL, NULL, 0, 0, 0 }, -+ { ".debug_rnglists", NULL, NULL, 0, 0, 0 }, -+ { ".debug_line_str", NULL, NULL, 0, 0, 0 }, -+ { ".debug_addr", NULL, NULL, 0, 0, 0 }, -+ { ".debug_str_offsets", NULL, NULL, 0, 0, 0 }, -+ { ".debug_loclists", NULL, NULL, 0, 0, 0 }, - { NULL, NULL, NULL, 0, 0, 0 } - }; - -@@ -542,10 +555,11 @@ setup_relbuf (DSO *dso, debug_section *s - /* Relocations against section symbols are uninteresting in REL. */ - if (dso->shdr[i].sh_type == SHT_REL && sym.st_value == 0) - continue; -- /* Only consider relocations against .debug_str, .debug_line -- and .debug_abbrev. */ -+ /* Only consider relocations against .debug_str, .debug_line, -+ .debug_line_str, and .debug_abbrev. */ - if (sym.st_shndx != debug_sections[DEBUG_STR].sec - && sym.st_shndx != debug_sections[DEBUG_LINE].sec -+ && sym.st_shndx != debug_sections[DEBUG_LINE_STR].sec - && sym.st_shndx != debug_sections[DEBUG_ABBREV].sec) - continue; - rela.r_addend += sym.st_value; -@@ -754,12 +768,29 @@ no_memory: - } - form = read_uleb128 (ptr); - if (form == 2 -- || (form > DW_FORM_flag_present && form != DW_FORM_ref_sig8)) -+ || (form > DW_FORM_flag_present -+ && !(form == DW_FORM_ref_sig8 -+ || form == DW_FORM_data16 -+ || form == DW_FORM_line_strp -+ || form == DW_FORM_implicit_const -+ || form == DW_FORM_addrx -+ || form == DW_FORM_loclistx -+ || form == DW_FORM_rnglistx -+ || form == DW_FORM_addrx1 -+ || form == DW_FORM_addrx2 -+ || form == DW_FORM_addrx3 -+ || form == DW_FORM_addrx4))) - { -- error (0, 0, "%s: Unknown DWARF DW_FORM_%d", dso->filename, form); -+ error (0, 0, "%s: Unknown DWARF DW_FORM_0x%x", dso->filename, -+ form); - htab_delete (h); - return NULL; - } -+ if (form == DW_FORM_implicit_const) -+ { -+ /* It is SLEB128 but the value is dropped anyway. */ -+ read_uleb128 (ptr); -+ } - - t->attr[t->nattr].attr = attr; - t->attr[t->nattr++].form = form; -@@ -1022,17 +1053,20 @@ string_find_entry (struct strings *strin - a replacement file string has been recorded for it, otherwise - returns false. */ - static bool --record_file_string_entry_idx (struct strings *strings, size_t old_idx) -+record_file_string_entry_idx (bool line_strp, DSO *dso, size_t old_idx) - { -+ struct strings *strings = line_strp ? &dso->debug_line_str : &dso->debug_str; - bool ret = false; - struct stridxentry *entry = string_find_new_entry (strings, old_idx); - if (entry != NULL) - { -- if (old_idx >= debug_sections[DEBUG_STR].size) -- error (1, 0, "Bad string pointer index %zd", old_idx); -+ debug_section *sec = &debug_sections[line_strp -+ ? DEBUG_LINE_STR : DEBUG_STR]; -+ if (old_idx >= sec->size) -+ error (1, 0, "Bad string pointer index %zd (%s)", old_idx, sec->name); - - Strent *strent; -- const char *old_str = (char *)debug_sections[DEBUG_STR].data + old_idx; -+ const char *old_str = (char *)sec->data + old_idx; - const char *file = skip_dir_prefix (old_str, base_dir); - if (file == NULL) - { -@@ -1076,15 +1110,18 @@ record_file_string_entry_idx (struct str - base_dir with dest_dir, just records the existing string associated - with the index. */ - static void --record_existing_string_entry_idx (struct strings *strings, size_t old_idx) -+record_existing_string_entry_idx (bool line_strp, DSO *dso, size_t old_idx) - { -+ struct strings *strings = line_strp ? &dso->debug_line_str : &dso->debug_str; - struct stridxentry *entry = string_find_new_entry (strings, old_idx); - if (entry != NULL) - { -- if (old_idx >= debug_sections[DEBUG_STR].size) -- error (1, 0, "Bad string pointer index %zd", old_idx); -+ debug_section *sec = &debug_sections[line_strp -+ ? DEBUG_LINE_STR : DEBUG_STR]; -+ if (old_idx >= sec->size) -+ error (1, 0, "Bad string pointer index %zd (%s)", old_idx, sec->name); - -- const char *str = (char *)debug_sections[DEBUG_STR].data + old_idx; -+ const char *str = (char *)sec->data + old_idx; - Strent *strent = strtab_add_len (strings->str_tab, - str, strlen (str) + 1); - if (strent == NULL) -@@ -1217,13 +1254,28 @@ get_line_table (DSO *dso, size_t off, st - - /* version */ - t->version = read_16 (ptr); -- if (t->version != 2 && t->version != 3 && t->version != 4) -+ if (t->version != 2 && t->version != 3 && t->version != 4 && t->version != 5) - { - error (0, 0, "%s: DWARF version %d unhandled", dso->filename, - t->version); - return false; - } - -+ if (t->version >= 5) -+ { -+ /* address_size */ -+ assert (ptr_size != 0); -+ if (ptr_size != read_8 (ptr)) -+ { -+ error (0, 0, "%s: .debug_line address size differs from .debug_info", -+ dso->filename); -+ return false; -+ } -+ -+ /* segment_selector_size */ -+ (void) read_8 (ptr); -+ } -+ - /* header_length */ - unsigned char *endprol = ptr + 4; - t->header_length = read_32 (ptr); -@@ -1269,7 +1321,9 @@ static int dirty_elf; - static void - dirty_section (unsigned int sec) - { -- elf_flagdata (debug_sections[sec].elf_data, ELF_C_SET, ELF_F_DIRTY); -+ for (struct debug_section *secp = &debug_sections[sec]; secp != NULL; -+ secp = secp->next) -+ elf_flagdata (secp->elf_data, ELF_C_SET, ELF_F_DIRTY); - dirty_elf = 1; - } - -@@ -1314,7 +1368,9 @@ edit_dwarf2_line (DSO *dso) - - linedata->d_size = dso->lines.debug_lines_len; - linedata->d_buf = dso->lines.line_buf; -+ debug_sections[DEBUG_LINE].data = linedata->d_buf; - debug_sections[DEBUG_LINE].size = linedata->d_size; -+ debug_sections[DEBUG_LINE].elf_data = linedata; - - /* Make sure the line tables are sorted on the old index. */ - qsort (dso->lines.table, dso->lines.used, sizeof (struct line_table), -@@ -1454,42 +1510,151 @@ edit_dwarf2_line (DSO *dso) - } - } - --/* Called during phase zero for each debug_line table referenced from -- .debug_info. Outputs all source files seen and records any -- adjustments needed in the debug_list data structures. Returns true -- if line_table needs to be rewrite either the dir or file paths. */ --static bool --read_dwarf2_line (DSO *dso, uint32_t off, char *comp_dir) -+/* Record or adjust (according to phase) DW_FORM_strp or DW_FORM_line_strp. */ -+static void -+edit_strp (DSO *dso, bool line_strp, unsigned char *ptr, int phase, -+ bool handled_strp) - { -- unsigned char *ptr, *dir; -- unsigned char **dirt; -- uint32_t value, dirt_cnt; -- size_t comp_dir_len = !comp_dir ? 0 : strlen (comp_dir); -- struct line_table *table; -+ unsigned char *ptr_orig = ptr; - -- if (get_line_table (dso, off, &table) == false -- || table == NULL) -+ /* In the first pass we collect all strings, in the -+ second we put the new references back (if there are -+ any changes). */ -+ if (phase == 0) - { -- if (table != NULL) -- error (0, 0, ".debug_line offset 0x%x referenced multiple times", -- off); -- return false; -+ /* handled_strp is set for attributes referring to -+ files. If it is set the string is already -+ recorded. */ -+ if (! handled_strp) -+ { -+ size_t idx = do_read_32_relocated (ptr); -+ record_existing_string_entry_idx (line_strp, dso, idx); -+ } -+ } -+ else if (line_strp -+ ? need_line_strp_update : need_strp_update) /* && phase == 1 */ -+ { -+ struct stridxentry *entry; -+ size_t idx, new_idx; -+ struct strings *strings = (line_strp -+ ? &dso->debug_line_str : &dso->debug_str); -+ idx = do_read_32_relocated (ptr); -+ entry = string_find_entry (strings, idx); -+ new_idx = strent_offset (entry->entry); -+ do_write_32_relocated (ptr, new_idx); - } - -- /* Skip to the directory table. The rest of the header has already -- been read and checked by get_line_table. */ -- ptr = debug_sections[DEBUG_LINE].data + off; -- ptr += (4 /* unit len */ -- + 2 /* version */ -- + 4 /* header len */ -- + 1 /* min instr len */ -- + (table->version >= 4) /* max op per instr, if version >= 4 */ -- + 1 /* default is stmt */ -- + 1 /* line base */ -- + 1 /* line range */ -- + 1 /* opcode base */ -- + table->opcode_base - 1); /* opcode len table */ -- dir = ptr; -+ assert (ptr == ptr_orig); -+} -+ -+/* Adjust *PTRP after the current *FORMP, update *FORMP for FORM_INDIRECT. */ -+static enum { FORM_OK, FORM_ERROR, FORM_INDIRECT } -+skip_form (DSO *dso, uint32_t *formp, unsigned char **ptrp) -+{ -+ size_t len = 0; -+ -+ switch (*formp) -+ { -+ case DW_FORM_ref_addr: -+ if (cu_version == 2) -+ *ptrp += ptr_size; -+ else -+ *ptrp += 4; -+ break; -+ case DW_FORM_flag_present: -+ case DW_FORM_implicit_const: -+ break; -+ case DW_FORM_addr: -+ *ptrp += ptr_size; -+ break; -+ case DW_FORM_ref1: -+ case DW_FORM_flag: -+ case DW_FORM_data1: -+ case DW_FORM_strx1: -+ case DW_FORM_addrx1: -+ ++*ptrp; -+ break; -+ case DW_FORM_ref2: -+ case DW_FORM_data2: -+ case DW_FORM_strx2: -+ case DW_FORM_addrx2: -+ *ptrp += 2; -+ break; -+ case DW_FORM_strx3: -+ case DW_FORM_addrx3: -+ *ptrp += 3; -+ break; -+ case DW_FORM_ref4: -+ case DW_FORM_data4: -+ case DW_FORM_strx4: -+ case DW_FORM_addrx4: -+ case DW_FORM_sec_offset: -+ *ptrp += 4; -+ break; -+ case DW_FORM_ref8: -+ case DW_FORM_data8: -+ case DW_FORM_ref_sig8: -+ *ptrp += 8; -+ break; -+ case DW_FORM_data16: -+ *ptrp += 16; -+ break; -+ case DW_FORM_sdata: -+ case DW_FORM_ref_udata: -+ case DW_FORM_udata: -+ case DW_FORM_strx: -+ case DW_FORM_loclistx: -+ case DW_FORM_rnglistx: -+ case DW_FORM_addrx: -+ read_uleb128 (*ptrp); -+ break; -+ case DW_FORM_strp: -+ case DW_FORM_line_strp: -+ *ptrp += 4; -+ break; -+ case DW_FORM_string: -+ *ptrp = (unsigned char *) strchr ((char *)*ptrp, '\0') + 1; -+ break; -+ case DW_FORM_indirect: -+ *formp = read_uleb128 (*ptrp); -+ return FORM_INDIRECT; -+ case DW_FORM_block1: -+ len = *(*ptrp)++; -+ break; -+ case DW_FORM_block2: -+ len = read_16 (*ptrp); -+ *formp = DW_FORM_block1; -+ break; -+ case DW_FORM_block4: -+ len = read_32 (*ptrp); -+ *formp = DW_FORM_block1; -+ break; -+ case DW_FORM_block: -+ case DW_FORM_exprloc: -+ len = read_uleb128 (*ptrp); -+ *formp = DW_FORM_block1; -+ assert (len < UINT_MAX); -+ break; -+ default: -+ error (0, 0, "%s: Unknown DWARF DW_FORM_0x%x", dso->filename, *formp); -+ return FORM_ERROR; -+ } -+ -+ if (*formp == DW_FORM_block1) -+ *ptrp += len; -+ -+ return FORM_OK; -+} -+ -+/* Part of read_dwarf2_line processing DWARF-4. */ -+static bool -+read_dwarf4_line (DSO *dso, unsigned char *ptr, char *comp_dir, -+ struct line_table *table) -+{ -+ unsigned char **dirt; -+ uint32_t value, dirt_cnt; -+ size_t comp_dir_len = !comp_dir ? 0 : strlen (comp_dir); -+ unsigned char *dir = ptr; - - /* dir table: */ - value = 1; -@@ -1622,6 +1787,296 @@ read_dwarf2_line (DSO *dso, uint32_t off - read_uleb128 (ptr); - } - -+ return true; -+} -+ -+/* Called by read_dwarf5_line first for directories and then file -+ names as they both have the same format. */ -+static bool -+read_dwarf5_line_entries (DSO *dso, unsigned char **ptrp, -+ struct line_table *table, int phase, -+ char ***dirs, int *ndir, -+ const char *entry_name) -+{ -+ /* directory_entry_format_count */ -+ /* file_name_entry_format_count */ -+ unsigned format_count = read_8 (*ptrp); -+ -+ unsigned char *formats = *ptrp; -+ -+ /* directory_entry_format */ -+ /* file_name_entry_format */ -+ for (unsigned formati = 0; formati < format_count; ++formati) -+ { -+ read_uleb128 (*ptrp); -+ read_uleb128 (*ptrp); -+ } -+ -+ /* directories_count */ -+ /* file_names_count */ -+ unsigned entry_count = read_uleb128 (*ptrp); -+ -+ bool collecting_dirs = dest_dir && phase == 0 && *dirs == NULL; -+ bool writing_files = dest_dir && phase == 0 && *dirs != NULL; -+ if (collecting_dirs) -+ { -+ *ndir = entry_count; -+ *dirs = malloc (entry_count * sizeof (char *)); -+ if (*dirs == NULL) -+ error (1, errno, "%s: Could not allocate debug_line dirs", -+ dso->filename); -+ } -+ -+ /* directories */ -+ /* file_names */ -+ for (unsigned entryi = 0; entryi < entry_count; ++entryi) -+ { -+ char *dir = NULL; -+ char *file = NULL;; -+ unsigned char *format_ptr = formats; -+ for (unsigned formati = 0; formati < format_count; ++formati) -+ { -+ unsigned lnct = read_uleb128 (format_ptr); -+ unsigned form = read_uleb128 (format_ptr); -+ bool handled_form = false; -+ bool handled_strp = false; -+ bool line_strp = form == DW_FORM_line_strp; -+ if (lnct == DW_LNCT_path) -+ { -+ switch (form) -+ { -+ case DW_FORM_strp: -+ case DW_FORM_line_strp: -+ if (dest_dir && phase == 0) -+ { -+ size_t idx = do_read_32_relocated (*ptrp); -+ if (record_file_string_entry_idx (line_strp, dso, idx)) -+ { -+ if (line_strp) -+ need_line_strp_update = true; -+ else -+ need_strp_update = true; -+ } -+ handled_strp = true; -+ if (collecting_dirs || writing_files) -+ { -+ debug_section *sec = &debug_sections[line_strp -+ ? DEBUG_LINE_STR : DEBUG_STR]; -+ if (collecting_dirs) -+ dir = (char *)sec->data + idx; -+ if (writing_files) -+ file = (char *)sec->data + idx; -+ } -+ } -+ break; -+ default: -+ error (0, 0, "%s: Unsupported " -+ ".debug_line %s %u path DW_FORM_0x%x", -+ dso->filename, entry_name, entryi, form); -+ return false; -+ } -+ } -+ if (writing_files && lnct == DW_LNCT_directory_index) -+ { -+ int dirndx; -+ switch (form) -+ { -+ case DW_FORM_udata: -+ handled_form = true; -+ dirndx = read_uleb128 (*ptrp); -+ break; -+ case DW_FORM_data1: -+ dirndx = **ptrp; -+ break; -+ case DW_FORM_data2: -+ dirndx = do_read_16 (*ptrp); -+ break; -+ case DW_FORM_data4: -+ dirndx = do_read_32 (*ptrp); -+ break; -+ default: -+ error (0, 0, "%s: Unsupported " -+ ".debug_line %s %u dirndx DW_FORM_0x%x", -+ dso->filename, entry_name, entryi, form); -+ return false; -+ } -+ -+ if (dirndx > *ndir) -+ { -+ error (0, 0, "%s: Bad dir number %u in .debug_line %s", -+ dso->filename, entryi, entry_name); -+ return false; -+ } -+ dir = (*dirs)[dirndx]; -+ } -+ -+ switch (form) -+ { -+ case DW_FORM_strp: -+ case DW_FORM_line_strp: -+ edit_strp (dso, line_strp, *ptrp, phase, handled_strp); -+ break; -+ } -+ -+ if (!handled_form) -+ { -+ switch (skip_form (dso, &form, ptrp)) -+ { -+ case FORM_OK: -+ break; -+ case FORM_ERROR: -+ return false; -+ case FORM_INDIRECT: -+ error (0, 0, "%s: Unsupported " -+ ".debug_line %s %u DW_FORM_indirect", -+ dso->filename, entry_name, entryi); -+ return false; -+ } -+ } -+ } -+ -+ if (collecting_dirs) -+ (*dirs)[entryi] = dir; -+ -+ if (writing_files) -+ { -+ char *comp_dir = (*dirs)[0]; -+ size_t comp_dir_len = strlen(comp_dir); -+ size_t file_len = strlen (file); -+ size_t dir_len = strlen (dir); -+ -+ char *s = malloc (comp_dir_len + 1 + file_len + 1 + dir_len + 1); -+ if (s == NULL) -+ { -+ error (0, ENOMEM, "%s: Reading file table", dso->filename); -+ return false; -+ } -+ if (file[0] == '/') -+ { -+ memcpy (s, file, file_len + 1); -+ } -+ else if (dir[0] == '/') -+ { -+ memcpy (s, dir, dir_len); -+ s[dir_len] = '/'; -+ memcpy (s + dir_len + 1, file, file_len + 1); -+ } -+ else -+ { -+ char *p = s; -+ if (comp_dir_len != 0) -+ { -+ memcpy (s, comp_dir, comp_dir_len); -+ s[comp_dir_len] = '/'; -+ p += comp_dir_len + 1; -+ } -+ memcpy (p, dir, dir_len); -+ p[dir_len] = '/'; -+ memcpy (p + dir_len + 1, file, file_len + 1); -+ } -+ canonicalize_path (s, s); -+ if (list_file_fd != -1) -+ { -+ const char *p = NULL; -+ if (base_dir == NULL) -+ p = s; -+ else -+ { -+ p = skip_dir_prefix (s, base_dir); -+ if (p == NULL && dest_dir != NULL) -+ p = skip_dir_prefix (s, dest_dir); -+ } -+ -+ if (p) -+ { -+ size_t size = strlen (p) + 1; -+ while (size > 0) -+ { -+ ssize_t ret = write (list_file_fd, p, size); -+ if (ret == -1) -+ break; -+ size -= ret; -+ p += ret; -+ } -+ } -+ } -+ -+ free (s); -+ } -+ } -+ -+ return true; -+} -+ -+/* Part of read_dwarf2_line processing DWARF-5. */ -+static bool -+read_dwarf5_line (DSO *dso, unsigned char *ptr, struct line_table *table, -+ int phase) -+{ -+ char **dirs = NULL; -+ int ndir; -+ /* Skip header. */ -+ ptr += (4 /* unit len */ -+ + 2 /* version */ -+ + (table->version < 5 ? 0 : 0 -+ + 1 /* address_size */ -+ + 1 /* segment_selector*/) -+ + 4 /* header len */ -+ + 1 /* min instr len */ -+ + (table->version >= 4) /* max op per instr, if version >= 4 */ -+ + 1 /* default is stmt */ -+ + 1 /* line base */ -+ + 1 /* line range */ -+ + 1 /* opcode base */ -+ + table->opcode_base - 1); /* opcode len table */ -+ -+ bool retval = (read_dwarf5_line_entries (dso, &ptr, table, phase, -+ &dirs, &ndir, "directory") -+ && read_dwarf5_line_entries (dso, &ptr, table, phase, -+ &dirs, &ndir, "file name")); -+ free (dirs); -+ return retval; -+} -+ -+/* Called during phase zero for each debug_line table referenced from -+ .debug_info. Outputs all source files seen and records any -+ adjustments needed in the debug_list data structures. Returns true -+ if line_table needs to be rewrite either the dir or file paths. */ -+static bool -+read_dwarf2_line (DSO *dso, uint32_t off, char *comp_dir) -+{ -+ unsigned char *ptr; -+ struct line_table *table; -+ -+ if (get_line_table (dso, off, &table) == false -+ || table == NULL) -+ return false; -+ -+ /* Skip to the directory table. The rest of the header has already -+ been read and checked by get_line_table. */ -+ ptr = debug_sections[DEBUG_LINE].data + off; -+ ptr += (4 /* unit len */ -+ + 2 /* version */ -+ + (table->version < 5 ? 0 : 0 -+ + 1 /* address_size */ -+ + 1 /* segment_selector*/) -+ + 4 /* header len */ -+ + 1 /* min instr len */ -+ + (table->version >= 4) /* max op per instr, if version >= 4 */ -+ + 1 /* default is stmt */ -+ + 1 /* line base */ -+ + 1 /* line range */ -+ + 1 /* opcode base */ -+ + table->opcode_base - 1); /* opcode len table */ -+ -+ /* DWARF version 5 line tables won't change size. But they might need -+ [line]strp recording/updates. Handle that part later. */ -+ if (table->version < 5) -+ { -+ if (! read_dwarf4_line (dso, ptr, comp_dir, table)) -+ return false; -+ } -+ - dso->lines.debug_lines_len += 4 + table->unit_length + table->size_diff; - return table->replace_dirs || table->replace_files; - } -@@ -1639,6 +2094,40 @@ find_new_list_offs (struct debug_lines * - return table->new_idx; - } - -+/* Read DW_FORM_strp or DW_FORM_line_strp collecting compilation directory. */ -+static void -+edit_attributes_str_comp_dir (bool line_strp, DSO *dso, unsigned char **ptrp, -+ int phase, char **comp_dirp, bool *handled_strpp) -+{ -+ const char *dir; -+ size_t idx = do_read_32_relocated (*ptrp); -+ /* In phase zero we collect the comp_dir. */ -+ if (phase == 0) -+ { -+ debug_section *sec = &debug_sections[line_strp -+ ? DEBUG_LINE_STR : DEBUG_STR]; -+ if (sec->data == NULL || idx >= sec->size) -+ error (1, 0, "%s: Bad string pointer index %zd for comp_dir (%s)", -+ dso->filename, idx, sec->name); -+ dir = (char *) sec->data + idx; -+ -+ free (*comp_dirp); -+ *comp_dirp = strdup (dir); -+ } -+ -+ if (dest_dir != NULL && phase == 0) -+ { -+ if (record_file_string_entry_idx (line_strp, dso, idx)) -+ { -+ if (line_strp) -+ need_line_strp_update = true; -+ else -+ need_strp_update = true; -+ } -+ *handled_strpp = true; -+ } -+} -+ - /* This scans the attributes of one DIE described by the given abbrev_tag. - PTR points to the data in the debug_info. It will be advanced till all - abbrev data is consumed. In phase zero data is collected, in phase one -@@ -1657,7 +2146,6 @@ edit_attributes (DSO *dso, unsigned char - for (i = 0; i < t->nattr; ++i) - { - uint32_t form = t->attr[i].form; -- size_t len = 0; - while (1) - { - /* Whether we already handled a string as file for this -@@ -1743,38 +2231,24 @@ edit_attributes (DSO *dso, unsigned char - } - } - } -- else if (form == DW_FORM_strp && -- debug_sections[DEBUG_STR].data) -- { -- const char *dir; -- size_t idx = do_read_32_relocated (ptr); -- /* In phase zero we collect the comp_dir. */ -- if (phase == 0) -- { -- if (idx >= debug_sections[DEBUG_STR].size) -- error (1, 0, -- "%s: Bad string pointer index %zd for comp_dir", -- dso->filename, idx); -- dir = (char *) debug_sections[DEBUG_STR].data + idx; -- -- free (comp_dir); -- comp_dir = strdup (dir); -- } -- -- if (dest_dir != NULL && phase == 0) -- { -- if (record_file_string_entry_idx (&dso->strings, idx)) -- need_strp_update = true; -- handled_strp = true; -- } -- } -+ else if (form == DW_FORM_strp) -+ edit_attributes_str_comp_dir (false /* line_strp */, dso, -+ &ptr, phase, &comp_dir, -+ &handled_strp); -+ else if (form == DW_FORM_line_strp) -+ edit_attributes_str_comp_dir (true /* line_strp */, dso, &ptr, -+ phase, &comp_dir, &handled_strp); - } - else if ((t->tag == DW_TAG_compile_unit - || t->tag == DW_TAG_partial_unit) -- && t->attr[i].attr == DW_AT_name -- && form == DW_FORM_strp -- && debug_sections[DEBUG_STR].data) -+ && ((form == DW_FORM_strp -+ && debug_sections[DEBUG_STR].data) -+ || (form == DW_FORM_line_strp -+ && debug_sections[DEBUG_LINE_STR].data)) -+ && t->attr[i].attr == DW_AT_name) - { -+ bool line_strp = form == DW_FORM_line_strp; -+ - /* DW_AT_name is the primary file for this compile - unit. If starting with / it is a full path name. - Note that we don't handle DW_FORM_string in this -@@ -1784,11 +2258,14 @@ edit_attributes (DSO *dso, unsigned char - /* In phase zero we will look for a comp_dir to use. */ - if (phase == 0) - { -- if (idx >= debug_sections[DEBUG_STR].size) -+ debug_section *sec = &debug_sections[line_strp -+ ? DEBUG_LINE_STR -+ : DEBUG_STR]; -+ if (idx >= sec->size) - error (1, 0, -- "%s: Bad string pointer index %zd for unit name", -- dso->filename, idx); -- char *name = (char *) debug_sections[DEBUG_STR].data + idx; -+ "%s: Bad string pointer index %zd for unit name (%s)", -+ dso->filename, idx, sec->name); -+ char *name = (char *) sec->data + idx; - if (*name == '/' && comp_dir == NULL) - { - char *enddir = strrchr (name, '/'); -@@ -1809,107 +2286,37 @@ edit_attributes (DSO *dso, unsigned char - pass (1) stores it (the new index). */ - if (dest_dir && phase == 0) - { -- if (record_file_string_entry_idx (&dso->strings, idx)) -- need_strp_update = true; -+ if (record_file_string_entry_idx (line_strp, dso, idx)) -+ { -+ if (line_strp) -+ need_line_strp_update = true; -+ else -+ need_strp_update = true; -+ } - handled_strp = true; - } - } - - switch (form) - { -- case DW_FORM_ref_addr: -- if (cu_version == 2) -- ptr += ptr_size; -- else -- ptr += 4; -- break; -- case DW_FORM_flag_present: -- break; -- case DW_FORM_addr: -- ptr += ptr_size; -- break; -- case DW_FORM_ref1: -- case DW_FORM_flag: -- case DW_FORM_data1: -- ++ptr; -- break; -- case DW_FORM_ref2: -- case DW_FORM_data2: -- ptr += 2; -- break; -- case DW_FORM_ref4: -- case DW_FORM_data4: -- case DW_FORM_sec_offset: -- ptr += 4; -- break; -- case DW_FORM_ref8: -- case DW_FORM_data8: -- case DW_FORM_ref_sig8: -- ptr += 8; -- break; -- case DW_FORM_sdata: -- case DW_FORM_ref_udata: -- case DW_FORM_udata: -- read_uleb128 (ptr); -- break; - case DW_FORM_strp: -- /* In the first pass we collect all strings, in the -- second we put the new references back (if there are -- any changes). */ -- if (phase == 0) -- { -- /* handled_strp is set for attributes referring to -- files. If it is set the string is already -- recorded. */ -- if (! handled_strp) -- { -- size_t idx = do_read_32_relocated (ptr); -- record_existing_string_entry_idx (&dso->strings, idx); -- } -- } -- else if (need_strp_update) /* && phase == 1 */ -- { -- struct stridxentry *entry; -- size_t idx, new_idx; -- idx = do_read_32_relocated (ptr); -- entry = string_find_entry (&dso->strings, idx); -- new_idx = strent_offset (entry->entry); -- do_write_32_relocated (ptr, new_idx); -- } -- ptr += 4; -- break; -- case DW_FORM_string: -- ptr = (unsigned char *) strchr ((char *)ptr, '\0') + 1; -- break; -- case DW_FORM_indirect: -- form = read_uleb128 (ptr); -- continue; -- case DW_FORM_block1: -- len = *ptr++; -- break; -- case DW_FORM_block2: -- len = read_16 (ptr); -- form = DW_FORM_block1; -+ edit_strp (dso, false /* line_strp */, ptr, phase, handled_strp); - break; -- case DW_FORM_block4: -- len = read_32 (ptr); -- form = DW_FORM_block1; -+ case DW_FORM_line_strp: -+ edit_strp (dso, true /* line_strp */, ptr, phase, handled_strp); - break; -- case DW_FORM_block: -- case DW_FORM_exprloc: -- len = read_uleb128 (ptr); -- form = DW_FORM_block1; -- assert (len < UINT_MAX); -+ } -+ -+ switch (skip_form (dso, &form, &ptr)) -+ { -+ case FORM_OK: - break; -- default: -- error (0, 0, "%s: Unknown DWARF DW_FORM_%d", dso->filename, -- form); -+ case FORM_ERROR: - return NULL; -+ case FORM_INDIRECT: -+ continue; - } - -- if (form == DW_FORM_block1) -- ptr += len; -- - break; - } - } -@@ -1965,6 +2372,163 @@ line_rel_cmp (const void *a, const void - } - - static int -+edit_info (DSO *dso, int phase, struct debug_section *sec) -+{ -+ unsigned char *ptr, *endcu, *endsec; -+ uint32_t value; -+ htab_t abbrev; -+ struct abbrev_tag tag, *t; -+ -+ ptr = sec->data; -+ if (ptr == NULL) -+ return 0; -+ -+ setup_relbuf(dso, sec, &reltype); -+ endsec = ptr + sec->size; -+ while (ptr < endsec) -+ { -+ unsigned char *cu_start = ptr; -+ -+ /* header size, version, unit_type, ptr_size. */ -+ if (ptr + 4 + 2 + 1 + 1 > endsec) -+ { -+ error (0, 0, "%s: %s CU header too small", -+ dso->filename, sec->name); -+ return 1; -+ } -+ -+ endcu = ptr + 4; -+ endcu += read_32 (ptr); -+ if (endcu == ptr + 0xffffffff) -+ { -+ error (0, 0, "%s: 64-bit DWARF not supported", dso->filename); -+ return 1; -+ } -+ -+ if (endcu > endsec) -+ { -+ error (0, 0, "%s: %s too small", dso->filename, sec->name); -+ return 1; -+ } -+ -+ cu_version = read_16 (ptr); -+ if (cu_version != 2 && cu_version != 3 && cu_version != 4 -+ && cu_version != 5) -+ { -+ error (0, 0, "%s: DWARF version %d unhandled", dso->filename, -+ cu_version); -+ return 1; -+ } -+ -+ int cu_ptr_size = 0; -+ -+ if (cu_version >= 5) -+ { -+ uint8_t unit_type = read_8 (ptr); -+ if (unit_type != DW_UT_compile && unit_type != DW_UT_partial) -+ { -+ error (0, 0, "%s: Unit type %u unhandled", dso->filename, -+ unit_type); -+ return 1; -+ } -+ -+ cu_ptr_size = read_8 (ptr); -+ } -+ -+ unsigned char *header_end = (cu_start + 23 + (cu_version < 5 ? 0 : 1)); -+ if (header_end > endsec) -+ { -+ error (0, 0, "%s: %s CU header too small", dso->filename, sec->name); -+ return 1; -+ } -+ -+ value = read_32_relocated (ptr); -+ if (value >= debug_sections[DEBUG_ABBREV].size) -+ { -+ if (debug_sections[DEBUG_ABBREV].data == NULL) -+ error (0, 0, "%s: .debug_abbrev not present", dso->filename); -+ else -+ error (0, 0, "%s: DWARF CU abbrev offset too large", -+ dso->filename); -+ return 1; -+ } -+ -+ if (cu_version < 5) -+ cu_ptr_size = read_8 (ptr); -+ -+ if (ptr_size == 0) -+ { -+ ptr_size = cu_ptr_size; -+ if (ptr_size != 4 && ptr_size != 8) -+ { -+ error (0, 0, "%s: Invalid DWARF pointer size %d", -+ dso->filename, ptr_size); -+ return 1; -+ } -+ } -+ else if (cu_ptr_size != ptr_size) -+ { -+ error (0, 0, "%s: DWARF pointer size differs between CUs", -+ dso->filename); -+ return 1; -+ } -+ -+ if (sec != &debug_sections[DEBUG_INFO]) -+ ptr += 12; /* Skip type_signature and type_offset. */ -+ -+ abbrev = read_abbrev (dso, -+ debug_sections[DEBUG_ABBREV].data + value); -+ if (abbrev == NULL) -+ return 1; -+ -+ while (ptr < endcu) -+ { -+ tag.entry = read_uleb128 (ptr); -+ if (tag.entry == 0) -+ continue; -+ t = htab_find_with_hash (abbrev, &tag, tag.entry); -+ if (t == NULL) -+ { -+ error (0, 0, "%s: Could not find DWARF abbreviation %d", -+ dso->filename, tag.entry); -+ htab_delete (abbrev); -+ return 1; -+ } -+ -+ ptr = edit_attributes (dso, ptr, t, phase); -+ if (ptr == NULL) -+ break; -+ } -+ -+ htab_delete (abbrev); -+ } -+ -+ return 0; -+} -+ -+/* Rebuild .debug_str. */ -+static void -+edit_dwarf2_any_str (DSO *dso, struct strings *strings, debug_section *secp) -+{ -+ Strtab *strtab = strings->str_tab; -+ Elf_Data *strdata = secp->elf_data; -+ int strndx = secp->sec; -+ Elf_Scn *strscn = dso->scn[strndx]; -+ -+ /* Out with the old. */ -+ strdata->d_size = 0; -+ /* In with the new. */ -+ strdata = elf_newdata (strscn); -+ -+ /* We really should check whether we had enough memory, -+ but the old ebl version will just abort on out of -+ memory... */ -+ strtab_finalize (strtab, strdata); -+ secp->size = strdata->d_size; -+ strings->str_buf = strdata->d_buf; -+} -+ -+static int - edit_dwarf2 (DSO *dso) - { - Elf_Data *data; -@@ -1995,7 +2559,7 @@ edit_dwarf2 (DSO *dso) - struct debug_section *debug_sec = &debug_sections[j]; - if (debug_sections[j].data) - { -- if (j != DEBUG_MACRO) -+ if (j != DEBUG_MACRO && j != DEBUG_TYPES) - { - error (0, 0, "%s: Found two copies of %s section", - dso->filename, name); -@@ -2003,22 +2567,21 @@ edit_dwarf2 (DSO *dso) - } - else - { -- /* In relocatable files .debug_macro might -- appear multiple times as COMDAT -- section. */ -+ /* In relocatable files .debug_macro and .debug_types -+ might appear multiple times as COMDAT section. */ - struct debug_section *sec; - sec = calloc (sizeof (struct debug_section), 1); - if (sec == NULL) - error (1, errno, -- "%s: Could not allocate more macro sections", -- dso->filename); -- sec->name = ".debug_macro"; -+ "%s: Could not allocate more %s sections", -+ dso->filename, name); -+ sec->name = name; - -- struct debug_section *macro_sec = debug_sec; -- while (macro_sec->next != NULL) -- macro_sec = macro_sec->next; -+ struct debug_section *multi_sec = debug_sec; -+ while (multi_sec->next != NULL) -+ multi_sec = multi_sec->next; - -- macro_sec->next = sec; -+ multi_sec->next = sec; - debug_sec = sec; - } - } -@@ -2055,23 +2618,23 @@ edit_dwarf2 (DSO *dso) - + (dso->shdr[i].sh_type == SHT_RELA), - debug_sections[j].name) == 0) - { -- if (j == DEBUG_MACRO) -+ if (j == DEBUG_MACRO || j == DEBUG_TYPES) - { - /* Pick the correct one. */ - int rel_target = dso->shdr[i].sh_info; -- struct debug_section *macro_sec = &debug_sections[j]; -- while (macro_sec != NULL) -+ struct debug_section *multi_sec = &debug_sections[j]; -+ while (multi_sec != NULL) - { -- if (macro_sec->sec == rel_target) -+ if (multi_sec->sec == rel_target) - { -- macro_sec->relsec = i; -+ multi_sec->relsec = i; - break; - } -- macro_sec = macro_sec->next; -+ multi_sec = multi_sec->next; - } -- if (macro_sec == NULL) -- error (0, 1, "No .debug_macro reloc section: %s", -- dso->filename); -+ if (multi_sec == NULL) -+ error (0, 1, "No %s reloc section: %s", -+ debug_sections[j].name, dso->filename); - } - else - debug_sections[j].relsec = i; -@@ -2100,388 +2663,338 @@ edit_dwarf2 (DSO *dso) - return 1; - } - -- if (debug_sections[DEBUG_INFO].data != NULL) -+ if (debug_sections[DEBUG_INFO].data == NULL) -+ return 0; -+ -+ unsigned char *ptr, *endsec; -+ int phase; -+ bool info_rel_updated = false; -+ bool types_rel_updated = false; -+ bool macro_rel_updated = false; -+ bool line_rel_updated = false; -+ -+ for (phase = 0; phase < 2; phase++) - { -- unsigned char *ptr, *endcu, *endsec; -- uint32_t value; -- htab_t abbrev; -- struct abbrev_tag tag, *t; -- int phase; -- bool info_rel_updated = false; -- bool macro_rel_updated = false; -+ /* If we don't need to update anyhing, skip phase 1. */ -+ if (phase == 1 -+ && !need_strp_update -+ && !need_line_strp_update -+ && !need_string_replacement -+ && !need_stmt_update) -+ break; - -- for (phase = 0; phase < 2; phase++) -- { -- /* If we don't need to update anyhing, skip phase 1. */ -- if (phase == 1 -- && !need_strp_update -- && !need_string_replacement -- && !need_stmt_update) -- break; -+ rel_updated = false; -+ if (edit_info (dso, phase, &debug_sections[DEBUG_INFO])) -+ return 1; - -- ptr = debug_sections[DEBUG_INFO].data; -- setup_relbuf(dso, &debug_sections[DEBUG_INFO], &reltype); -- rel_updated = false; -- endsec = ptr + debug_sections[DEBUG_INFO].size; -- while (ptr < endsec) -- { -- if (ptr + 11 > endsec) -- { -- error (0, 0, "%s: .debug_info CU header too small", -- dso->filename); -- return 1; -- } -+ /* Remember whether any .debug_info relocations might need -+ to be updated. */ -+ info_rel_updated = rel_updated; - -- endcu = ptr + 4; -- endcu += read_32 (ptr); -- if (endcu == ptr + 0xffffffff) -- { -- error (0, 0, "%s: 64-bit DWARF not supported", dso->filename); -- return 1; -- } -+ rel_updated = false; -+ struct debug_section *types_sec = &debug_sections[DEBUG_TYPES]; -+ while (types_sec != NULL) -+ { -+ if (edit_info (dso, phase, types_sec)) -+ return 1; -+ types_sec = types_sec->next; -+ } - -- if (endcu > endsec) -- { -- error (0, 0, "%s: .debug_info too small", dso->filename); -- return 1; -- } -+ /* Remember whether any .debug_types relocations might need -+ to be updated. */ -+ types_rel_updated = rel_updated; - -- cu_version = read_16 (ptr); -- if (cu_version != 2 && cu_version != 3 && cu_version != 4) -- { -- error (0, 0, "%s: DWARF version %d unhandled", dso->filename, -- cu_version); -- return 1; -- } -+ /* We might have to recalculate/rewrite the debug_line -+ section. We need to do that before going into phase one -+ so we have all new offsets. We do this separately from -+ scanning the dirs/file names because the DW_AT_stmt_lists -+ might not be in order or skip some padding we might have -+ to (re)move. */ -+ if (phase == 0 && need_stmt_update) -+ { -+ edit_dwarf2_line (dso); - -- value = read_32_relocated (ptr); -- if (value >= debug_sections[DEBUG_ABBREV].size) -- { -- if (debug_sections[DEBUG_ABBREV].data == NULL) -- error (0, 0, "%s: .debug_abbrev not present", dso->filename); -- else -- error (0, 0, "%s: DWARF CU abbrev offset too large", -- dso->filename); -- return 1; -- } -+ /* The line table programs will be moved -+ forward/backwards a bit in the new data. Update the -+ debug_line relocations to the new offsets. */ -+ int rndx = debug_sections[DEBUG_LINE].relsec; -+ if (rndx != 0) -+ { -+ LINE_REL *rbuf; -+ size_t rels; -+ Elf_Data *rdata = elf_getdata (dso->scn[rndx], NULL); -+ int rtype = dso->shdr[rndx].sh_type; -+ rels = dso->shdr[rndx].sh_size / dso->shdr[rndx].sh_entsize; -+ rbuf = malloc (rels * sizeof (LINE_REL)); -+ if (rbuf == NULL) -+ error (1, errno, "%s: Could not allocate line relocations", -+ dso->filename); - -- if (ptr_size == 0) -+ /* Sort them by offset into section. */ -+ for (size_t i = 0; i < rels; i++) - { -- ptr_size = read_8 (ptr); -- if (ptr_size != 4 && ptr_size != 8) -+ if (rtype == SHT_RELA) - { -- error (0, 0, "%s: Invalid DWARF pointer size %d", -- dso->filename, ptr_size); -- return 1; -+ GElf_Rela rela; -+ if (gelf_getrela (rdata, i, &rela) == NULL) -+ error (1, 0, "Couldn't get relocation: %s", -+ elf_errmsg (-1)); -+ rbuf[i].r_offset = rela.r_offset; -+ rbuf[i].ndx = i; - } -- } -- else if (read_8 (ptr) != ptr_size) -- { -- error (0, 0, "%s: DWARF pointer size differs between CUs", -- dso->filename); -- return 1; -- } -- -- abbrev = read_abbrev (dso, -- debug_sections[DEBUG_ABBREV].data + value); -- if (abbrev == NULL) -- return 1; -- -- while (ptr < endcu) -- { -- tag.entry = read_uleb128 (ptr); -- if (tag.entry == 0) -- continue; -- t = htab_find_with_hash (abbrev, &tag, tag.entry); -- if (t == NULL) -+ else - { -- error (0, 0, "%s: Could not find DWARF abbreviation %d", -- dso->filename, tag.entry); -- htab_delete (abbrev); -- return 1; -+ GElf_Rel rel; -+ if (gelf_getrel (rdata, i, &rel) == NULL) -+ error (1, 0, "Couldn't get relocation: %s", -+ elf_errmsg (-1)); -+ rbuf[i].r_offset = rel.r_offset; -+ rbuf[i].ndx = i; - } -- -- ptr = edit_attributes (dso, ptr, t, phase); -- if (ptr == NULL) -- break; - } -+ qsort (rbuf, rels, sizeof (LINE_REL), line_rel_cmp); - -- htab_delete (abbrev); -- } -- -- /* Remember whether any .debug_info relocations might need -- to be updated. */ -- info_rel_updated = rel_updated; -- -- /* We might have to recalculate/rewrite the debug_line -- section. We need to do that before going into phase one -- so we have all new offsets. We do this separately from -- scanning the dirs/file names because the DW_AT_stmt_lists -- might not be in order or skip some padding we might have -- to (re)move. */ -- if (phase == 0 && need_stmt_update) -- { -- edit_dwarf2_line (dso); -- -- /* The line table programs will be moved -- forward/backwards a bit in the new data. Update the -- debug_line relocations to the new offsets. */ -- int rndx = debug_sections[DEBUG_LINE].relsec; -- if (rndx != 0) -+ size_t lndx = 0; -+ for (size_t i = 0; i < rels; i++) - { -- LINE_REL *rbuf; -- size_t rels; -- Elf_Data *rdata = elf_getdata (dso->scn[rndx], NULL); -- int rtype = dso->shdr[rndx].sh_type; -- rels = dso->shdr[rndx].sh_size / dso->shdr[rndx].sh_entsize; -- rbuf = malloc (rels * sizeof (LINE_REL)); -- if (rbuf == NULL) -- error (1, errno, "%s: Could not allocate line relocations", -- dso->filename); -+ /* These relocations only happen in ET_REL files -+ and are section offsets. */ -+ GElf_Addr r_offset; -+ size_t ndx = rbuf[i].ndx; - -- /* Sort them by offset into section. */ -- for (size_t i = 0; i < rels; i++) -+ GElf_Rel rel; -+ GElf_Rela rela; -+ if (rtype == SHT_RELA) - { -- if (rtype == SHT_RELA) -- { -- GElf_Rela rela; -- if (gelf_getrela (rdata, i, &rela) == NULL) -- error (1, 0, "Couldn't get relocation: %s", -- elf_errmsg (-1)); -- rbuf[i].r_offset = rela.r_offset; -- rbuf[i].ndx = i; -- } -- else -- { -- GElf_Rel rel; -- if (gelf_getrel (rdata, i, &rel) == NULL) -- error (1, 0, "Couldn't get relocation: %s", -- elf_errmsg (-1)); -- rbuf[i].r_offset = rel.r_offset; -- rbuf[i].ndx = i; -- } -+ if (gelf_getrela (rdata, ndx, &rela) == NULL) -+ error (1, 0, "Couldn't get relocation: %s", -+ elf_errmsg (-1)); -+ r_offset = rela.r_offset; - } -- qsort (rbuf, rels, sizeof (LINE_REL), line_rel_cmp); -- -- size_t lndx = 0; -- for (size_t i = 0; i < rels; i++) -+ else - { -- /* These relocations only happen in ET_REL files -- and are section offsets. */ -- GElf_Addr r_offset; -- size_t ndx = rbuf[i].ndx; -- -- GElf_Rel rel; -- GElf_Rela rela; -- if (rtype == SHT_RELA) -- { -- if (gelf_getrela (rdata, ndx, &rela) == NULL) -- error (1, 0, "Couldn't get relocation: %s", -- elf_errmsg (-1)); -- r_offset = rela.r_offset; -- } -- else -- { -- if (gelf_getrel (rdata, ndx, &rel) == NULL) -- error (1, 0, "Couldn't get relocation: %s", -- elf_errmsg (-1)); -- r_offset = rel.r_offset; -- } -+ if (gelf_getrel (rdata, ndx, &rel) == NULL) -+ error (1, 0, "Couldn't get relocation: %s", -+ elf_errmsg (-1)); -+ r_offset = rel.r_offset; -+ } - -- while (lndx < dso->lines.used -- && r_offset > (dso->lines.table[lndx].old_idx -- + 4 -- + dso->lines.table[lndx].unit_length)) -- lndx++; -+ while (lndx < dso->lines.used -+ && r_offset > (dso->lines.table[lndx].old_idx -+ + 4 -+ + dso->lines.table[lndx].unit_length)) -+ lndx++; - -- if (lndx >= dso->lines.used) -- error (1, 0, -- ".debug_line relocation offset out of range"); -+ if (lndx >= dso->lines.used) -+ error (1, 0, -+ ".debug_line relocation offset out of range"); - -- /* Offset (pointing into the line program) moves -- from old to new index including the header -- size diff. */ -- r_offset += (ssize_t)((dso->lines.table[lndx].new_idx -- - dso->lines.table[lndx].old_idx) -- + dso->lines.table[lndx].size_diff); -+ /* Offset (pointing into the line program) moves -+ from old to new index including the header -+ size diff. */ -+ r_offset += (ssize_t)((dso->lines.table[lndx].new_idx -+ - dso->lines.table[lndx].old_idx) -+ + dso->lines.table[lndx].size_diff); - -- if (rtype == SHT_RELA) -- { -- rela.r_offset = r_offset; -- if (gelf_update_rela (rdata, ndx, &rela) == 0) -- error (1, 0, "Couldn't update relocation: %s", -- elf_errmsg (-1)); -- } -- else -- { -- rel.r_offset = r_offset; -- if (gelf_update_rel (rdata, ndx, &rel) == 0) -- error (1, 0, "Couldn't update relocation: %s", -- elf_errmsg (-1)); -- } -+ if (rtype == SHT_RELA) -+ { -+ rela.r_offset = r_offset; -+ if (gelf_update_rela (rdata, ndx, &rela) == 0) -+ error (1, 0, "Couldn't update relocation: %s", -+ elf_errmsg (-1)); -+ } -+ else -+ { -+ rel.r_offset = r_offset; -+ if (gelf_update_rel (rdata, ndx, &rel) == 0) -+ error (1, 0, "Couldn't update relocation: %s", -+ elf_errmsg (-1)); - } -- -- elf_flagdata (rdata, ELF_C_SET, ELF_F_DIRTY); -- free (rbuf); - } -+ -+ elf_flagdata (rdata, ELF_C_SET, ELF_F_DIRTY); -+ free (rbuf); - } -+ } - -- /* The .debug_macro section also contains offsets into the -- .debug_str section and references to the .debug_line -- tables, so we need to update those as well if we update -- the strings or the stmts. */ -- if ((need_strp_update || need_stmt_update) -- && debug_sections[DEBUG_MACRO].data) -+ /* The .debug_macro section also contains offsets into the -+ .debug_str section and references to the .debug_line -+ tables, so we need to update those as well if we update -+ the strings or the stmts. */ -+ if ((need_strp_update || need_stmt_update) -+ && debug_sections[DEBUG_MACRO].data) -+ { -+ /* There might be multiple (COMDAT) .debug_macro sections. */ -+ struct debug_section *macro_sec = &debug_sections[DEBUG_MACRO]; -+ while (macro_sec != NULL) - { -- /* There might be multiple (COMDAT) .debug_macro sections. */ -- struct debug_section *macro_sec = &debug_sections[DEBUG_MACRO]; -- while (macro_sec != NULL) -- { -- setup_relbuf(dso, macro_sec, &reltype); -- rel_updated = false; -+ setup_relbuf(dso, macro_sec, &reltype); -+ rel_updated = false; - -- ptr = macro_sec->data; -- endsec = ptr + macro_sec->size; -- int op = 0, macro_version, macro_flags; -- int offset_len = 4, line_offset = 0; -+ ptr = macro_sec->data; -+ endsec = ptr + macro_sec->size; -+ int op = 0, macro_version, macro_flags; -+ int offset_len = 4, line_offset = 0; - -- while (ptr < endsec) -+ while (ptr < endsec) -+ { -+ if (!op) - { -- if (!op) -- { -- macro_version = read_16 (ptr); -- macro_flags = read_8 (ptr); -- if (macro_version < 4 || macro_version > 5) -- error (1, 0, "unhandled .debug_macro version: %d", -- macro_version); -- if ((macro_flags & ~2) != 0) -- error (1, 0, "unhandled .debug_macro flags: 0x%x", -- macro_flags); -- -- offset_len = (macro_flags & 0x01) ? 8 : 4; -- line_offset = (macro_flags & 0x02) ? 1 : 0; -+ macro_version = read_16 (ptr); -+ macro_flags = read_8 (ptr); -+ if (macro_version < 4 || macro_version > 5) -+ error (1, 0, "unhandled .debug_macro version: %d", -+ macro_version); -+ if ((macro_flags & ~2) != 0) -+ error (1, 0, "unhandled .debug_macro flags: 0x%x", -+ macro_flags); - -- if (offset_len != 4) -- error (0, 1, -- "Cannot handle 8 byte macro offsets: %s", -- dso->filename); -+ offset_len = (macro_flags & 0x01) ? 8 : 4; -+ line_offset = (macro_flags & 0x02) ? 1 : 0; - -- /* Update the line_offset if it is there. */ -- if (line_offset) -- { -- if (phase == 0) -- ptr += offset_len; -- else -- { -- size_t idx, new_idx; -- idx = do_read_32_relocated (ptr); -- new_idx = find_new_list_offs (&dso->lines, -- idx); -- write_32_relocated (ptr, new_idx); -- } -- } -- } -+ if (offset_len != 4) -+ error (0, 1, -+ "Cannot handle 8 byte macro offsets: %s", -+ dso->filename); - -- op = read_8 (ptr); -- if (!op) -- continue; -- switch(op) -+ /* Update the line_offset if it is there. */ -+ if (line_offset) - { -- case DW_MACRO_GNU_define: -- case DW_MACRO_GNU_undef: -- read_uleb128 (ptr); -- ptr = ((unsigned char *) strchr ((char *) ptr, '\0') -- + 1); -- break; -- case DW_MACRO_GNU_start_file: -- read_uleb128 (ptr); -- read_uleb128 (ptr); -- break; -- case DW_MACRO_GNU_end_file: -- break; -- case DW_MACRO_GNU_define_indirect: -- case DW_MACRO_GNU_undef_indirect: -- read_uleb128 (ptr); - if (phase == 0) -- { -- size_t idx = read_32_relocated (ptr); -- record_existing_string_entry_idx (&dso->strings, -- idx); -- } -+ ptr += offset_len; - else - { -- struct stridxentry *entry; - size_t idx, new_idx; - idx = do_read_32_relocated (ptr); -- entry = string_find_entry (&dso->strings, idx); -- new_idx = strent_offset (entry->entry); -+ new_idx = find_new_list_offs (&dso->lines, -+ idx); - write_32_relocated (ptr, new_idx); - } -- break; -- case DW_MACRO_GNU_transparent_include: -- ptr += offset_len; -- break; -- default: -- error (1, 0, "Unhandled DW_MACRO op 0x%x", op); -- break; - } - } - -- if (rel_updated) -- macro_rel_updated = true; -- macro_sec = macro_sec->next; -+ op = read_8 (ptr); -+ if (!op) -+ continue; -+ switch(op) -+ { -+ case DW_MACRO_GNU_define: -+ case DW_MACRO_GNU_undef: -+ read_uleb128 (ptr); -+ ptr = ((unsigned char *) strchr ((char *) ptr, '\0') -+ + 1); -+ break; -+ case DW_MACRO_GNU_start_file: -+ read_uleb128 (ptr); -+ read_uleb128 (ptr); -+ break; -+ case DW_MACRO_GNU_end_file: -+ break; -+ case DW_MACRO_GNU_define_indirect: -+ case DW_MACRO_GNU_undef_indirect: -+ read_uleb128 (ptr); -+ if (phase == 0) -+ { -+ size_t idx = read_32_relocated (ptr); -+ record_existing_string_entry_idx (false, dso, idx); -+ } -+ else -+ { -+ struct stridxentry *entry; -+ size_t idx, new_idx; -+ idx = do_read_32_relocated (ptr); -+ entry = string_find_entry (&dso->debug_str, idx); -+ new_idx = strent_offset (entry->entry); -+ write_32_relocated (ptr, new_idx); -+ } -+ break; -+ case DW_MACRO_GNU_transparent_include: -+ ptr += offset_len; -+ break; -+ default: -+ error (1, 0, "Unhandled DW_MACRO op 0x%x", op); -+ break; -+ } - } -- } - -- /* Same for the debug_str section. Make sure everything is -- in place for phase 1 updating of debug_info -- references. */ -- if (phase == 0 && need_strp_update) -- { -- Strtab *strtab = dso->strings.str_tab; -- Elf_Data *strdata = debug_sections[DEBUG_STR].elf_data; -- int strndx = debug_sections[DEBUG_STR].sec; -- Elf_Scn *strscn = dso->scn[strndx]; -+ if (rel_updated) -+ macro_rel_updated = true; -+ macro_sec = macro_sec->next; -+ } -+ } - -- /* Out with the old. */ -- strdata->d_size = 0; -- /* In with the new. */ -- strdata = elf_newdata (strscn); - -- /* We really should check whether we had enough memory, -- but the old ebl version will just abort on out of -- memory... */ -- strtab_finalize (strtab, strdata); -- debug_sections[DEBUG_STR].size = strdata->d_size; -- dso->strings.str_buf = strdata->d_buf; -- } -+ /* Now handle all the DWARF5 line tables, they contain strp -+ and/or line_strp entries that need to be registered/rewritten. */ -+ setup_relbuf(dso, &debug_sections[DEBUG_LINE], &reltype); -+ rel_updated = false; - -+ /* edit_dwarf2_line will have set this up, unless there are no -+ moved/resized (DWARF4) lines. In which case we can just use -+ the original section data. new_idx will have been setup -+ correctly, even if it is the same as old_idx. */ -+ unsigned char *line_buf = (unsigned char *)dso->lines.line_buf; -+ if (line_buf == NULL) -+ line_buf = debug_sections[DEBUG_LINE].data; -+ for (int ldx = 0; ldx < dso->lines.used; ldx++) -+ { -+ struct line_table *t = &dso->lines.table[ldx]; -+ if (t->version >= 5) -+ read_dwarf5_line (dso, line_buf + t->new_idx, t, phase); - } -+ if (rel_updated) -+ line_rel_updated = true; - -- /* After phase 1 we might have rewritten the debug_info with -- new strp, strings and/or linep offsets. */ -- if (need_strp_update || need_string_replacement || need_stmt_update) -- dirty_section (DEBUG_INFO); -- if (need_strp_update || need_stmt_update) -- dirty_section (DEBUG_MACRO); -- if (need_stmt_update) -- dirty_section (DEBUG_LINE); -+ /* Same for the debug_str and debug_line_str sections. -+ Make sure everything is in place for phase 1 updating of debug_info -+ references. */ -+ if (phase == 0 && need_strp_update) -+ edit_dwarf2_any_str (dso, &dso->debug_str, -+ &debug_sections[DEBUG_STR]); -+ if (phase == 0 && need_line_strp_update) -+ edit_dwarf2_any_str (dso, &dso->debug_line_str, -+ &debug_sections[DEBUG_LINE_STR]); -+ } - -- /* Update any relocations addends we might have touched. */ -- if (info_rel_updated) -- update_rela_data (dso, &debug_sections[DEBUG_INFO]); -+ /* After phase 1 we might have rewritten the debug_info with -+ new strp, strings and/or linep offsets. */ -+ if (need_strp_update || need_line_strp_update -+ || need_string_replacement || need_stmt_update) { -+ dirty_section (DEBUG_INFO); -+ if (debug_sections[DEBUG_TYPES].data != NULL) -+ dirty_section (DEBUG_TYPES); -+ } -+ if (need_strp_update || need_stmt_update) -+ dirty_section (DEBUG_MACRO); -+ if (need_stmt_update || need_line_strp_update) -+ dirty_section (DEBUG_LINE); - -- if (macro_rel_updated) -+ /* Update any relocations addends we might have touched. */ -+ if (info_rel_updated) -+ update_rela_data (dso, &debug_sections[DEBUG_INFO]); -+ if (types_rel_updated) -+ { -+ struct debug_section *types_sec = &debug_sections[DEBUG_TYPES]; -+ while (types_sec != NULL) - { -- struct debug_section *macro_sec = &debug_sections[DEBUG_MACRO]; -- while (macro_sec != NULL) -- { -- update_rela_data (dso, macro_sec); -- macro_sec = macro_sec->next; -- } -+ update_rela_data (dso, types_sec); -+ types_sec = types_sec->next; - } - } - -+ if (macro_rel_updated) -+ { -+ struct debug_section *macro_sec = &debug_sections[DEBUG_MACRO]; -+ while (macro_sec != NULL) -+ { -+ update_rela_data (dso, macro_sec); -+ macro_sec = macro_sec->next; -+ } -+ } -+ -+ if (line_rel_updated) -+ update_rela_data (dso, &debug_sections[DEBUG_LINE]); -+ - return 0; - } - -@@ -2574,7 +3087,8 @@ fdopen_dso (int fd, const char *name) - } - - dso->filename = (const char *) strdup (name); -- setup_strings (&dso->strings); -+ setup_strings (&dso->debug_str); -+ setup_strings (&dso->debug_line_str); - setup_lines (&dso->lines); - return dso; - -@@ -2582,7 +3096,8 @@ error_out: - if (dso) - { - free ((char *) dso->filename); -- destroy_strings (&dso->strings); -+ destroy_strings (&dso->debug_str); -+ destroy_strings (&dso->debug_line_str); - destroy_lines (&dso->lines); - free (dso); - } -@@ -2862,7 +3377,9 @@ main (int argc, char *argv[]) - in elfutils before 0.169 we will have to update and write out all - section data if any data has changed (when ELF_F_LAYOUT was - set). https://sourceware.org/bugzilla/show_bug.cgi?id=21199 */ -- bool need_update = need_strp_update || need_stmt_update; -+ bool need_update = (need_strp_update -+ || need_line_strp_update -+ || need_stmt_update); - - #if !_ELFUTILS_PREREQ (0, 169) - /* string replacements or build_id updates don't change section size. */ -@@ -2934,10 +3451,12 @@ main (int argc, char *argv[]) - GElf_Xword sec_size = shdr->sh_size; - - /* We might have changed the size (and content) of the -- debug_str or debug_line section. */ -+ debug_str, debug_line_str or debug_line section. */ - size_t secnum = elf_ndxscn (scn); - if (secnum == debug_sections[DEBUG_STR].sec) - sec_size = debug_sections[DEBUG_STR].size; -+ if (secnum == debug_sections[DEBUG_LINE_STR].sec) -+ sec_size = debug_sections[DEBUG_LINE_STR].size; - if (secnum == debug_sections[DEBUG_LINE].sec) - sec_size = debug_sections[DEBUG_LINE].size; - -@@ -3007,7 +3526,8 @@ main (int argc, char *argv[]) - chmod (file, stat_buf.st_mode); - - free ((char *) dso->filename); -- destroy_strings (&dso->strings); -+ destroy_strings (&dso->debug_str); -+ destroy_strings (&dso->debug_line_str); - destroy_lines (&dso->lines); - free (dso); - -@@ -3022,6 +3542,17 @@ main (int argc, char *argv[]) - macro_sec = next; - } - -+ /* In case there were multiple (COMDAT) .debug_types sections, -+ free them. */ -+ struct debug_section *types_sec = &debug_sections[DEBUG_TYPES]; -+ types_sec = types_sec->next; -+ while (types_sec != NULL) -+ { -+ struct debug_section *next = types_sec->next; -+ free (types_sec); -+ types_sec = next; -+ } -+ - poptFreeContext (optCon); - - return 0; diff --git a/fileattrs.diff b/fileattrs.diff index 29038d7..7de7f61 100644 --- a/fileattrs.diff +++ b/fileattrs.diff @@ -1,39 +1,20 @@ ---- ./fileattrs/Makefile.am.orig 2019-10-02 11:39:56.095525981 +0000 -+++ ./fileattrs/Makefile.am 2019-10-02 11:40:20.695473538 +0000 -@@ -8,6 +8,6 @@ fattrsdir = $(rpmconfigdir)/fileattrs - fattrs_DATA = \ - debuginfo.attr desktop.attr elf.attr font.attr libtool.attr metainfo.attr \ - perl.attr perllib.attr pkgconfig.attr python.attr pythondist.attr ocaml.attr \ -- script.attr -+ script.attr elflib.attr - - EXTRA_DIST = $(fattrs_DATA) ---- ./fileattrs/elf.attr.orig 2019-06-26 14:17:31.404985707 +0000 -+++ ./fileattrs/elf.attr 2019-10-02 11:39:56.095525981 +0000 -@@ -1,4 +1,5 @@ - %__elf_provides %{_rpmconfigdir}/elfdeps --provides %{?__filter_GLIBC_PRIVATE:--filter-private} - %__elf_requires %{_rpmconfigdir}/elfdeps --requires %{?__filter_GLIBC_PRIVATE:--filter-private} --%__elf_magic ^(setuid,? )?(setgid,? )?(sticky )?ELF (32|64)-bit.*$ -+%__elf_magic ^(setuid,? )?(setgid,? )?(sticky )?ELF (32|64)-bit.*executable - %__elf_flags exeonly +--- ./fileattrs/elf.attr.orig 2021-09-23 19:29:51.474079693 +0000 ++++ ./fileattrs/elf.attr 2021-09-23 19:35:43.413332593 +0000 +@@ -1,3 +1,4 @@ + %__elf_provides %{_rpmconfigdir}/elfdeps --provides + %__elf_requires %{_rpmconfigdir}/elfdeps --requires + %__elf_magic ^(setuid,? )?(setgid,? )?(sticky )?ELF (32|64)-bit.*$ +%__elf_exclude_path ^/usr/lib/debug/ ---- ./fileattrs/elflib.attr.orig 2019-10-02 11:39:56.095525981 +0000 -+++ ./fileattrs/elflib.attr 2019-10-02 11:39:56.095525981 +0000 -@@ -0,0 +1,4 @@ -+%__elflib_provides %{_rpmconfigdir}/elfdeps --assume-exec --provides %{?__filter_GLIBC_PRIVATE:--filter-private} -+%__elflib_requires %{_rpmconfigdir}/elfdeps --assume-exec --requires %{?__filter_GLIBC_PRIVATE:--filter-private} -+%__elflib_magic ^(setuid )?(setgid )?(sticky )?ELF (32|64)-bit.*shared object -+%__elflib_exclude_path ^/usr/lib/debug/ ---- ./fileattrs/perl.attr.orig 2019-06-26 14:17:31.404985707 +0000 -+++ ./fileattrs/perl.attr 2019-10-02 11:39:56.095525981 +0000 +--- ./fileattrs/perl.attr.orig 2021-06-21 12:00:44.587611741 +0000 ++++ ./fileattrs/perl.attr 2021-09-23 19:29:51.474079693 +0000 @@ -1,3 +1,4 @@ -%__perl_requires %{_rpmconfigdir}/perl.req +# disabled for now +#%__perl_requires %{_rpmconfigdir}/perl.req %__perl_magic ^.*[Pp]erl .*$ %__perl_flags exeonly ---- ./fileattrs/perllib.attr.orig 2019-06-26 14:17:31.404985707 +0000 -+++ ./fileattrs/perllib.attr 2019-10-02 11:39:56.095525981 +0000 +--- ./fileattrs/perllib.attr.orig 2021-06-21 12:00:44.587611741 +0000 ++++ ./fileattrs/perllib.attr 2021-09-23 19:29:51.478079685 +0000 @@ -1,5 +1,6 @@ %__perllib_provides %{_rpmconfigdir}/perl.prov -%__perllib_requires %{_rpmconfigdir}/perl.req @@ -42,11 +23,3 @@ %__perllib_magic ^Perl[[:digit:]] module source.* %__perllib_path \\.pm$ %__perllib_flags magic_and_path ---- ./fileattrs/pythondist.attr.orig 2019-12-06 14:32:57.245328376 +0000 -+++ ./fileattrs/pythondist.attr 2019-12-06 14:33:35.345238073 +0000 -@@ -1,3 +1,4 @@ - %__pythondist_provides %{_rpmconfigdir}/pythondistdeps.py --provides --majorver-provides --%__pythondist_requires %{_rpmconfigdir}/pythondistdeps.py --requires -+#disabled for now -+#%__pythondist_requires %{_rpmconfigdir}/pythondistdeps.py --requires - %__pythondist_path /lib(64)?/python[[:digit:]]\\.[[:digit:]]+/site-packages/[^/]+\\.(dist-info|egg-info|egg-link)$ diff --git a/find-lang-qt-qm.patch b/find-lang-qt-qm.patch index 626bbb8..43de887 100644 --- a/find-lang-qt-qm.patch +++ b/find-lang-qt-qm.patch @@ -1,13 +1,13 @@ ---- ./scripts/find-lang.sh.orig 2017-12-01 16:07:23.339071251 +0000 -+++ ./scripts/find-lang.sh 2017-12-01 16:13:00.392088317 +0000 -@@ -296,7 +296,9 @@ s:%lang(C) :: +--- ./scripts/find-lang.sh.orig 2021-09-23 19:57:49.046595975 +0000 ++++ ./scripts/find-lang.sh 2021-09-23 19:59:36.182374732 +0000 +@@ -305,7 +305,9 @@ s:%lang(C) :: find "$TOP_DIR" -type f -o -type l|sed ' s:'"$TOP_DIR"':: --'"$NO_ALL_NAME$QT"'s:\(.*/'"$NAME"'_\([a-zA-Z]\{2\}\([_@].*\)\?\)\.qm$\):%lang(\2) \1: +-'"$NO_ALL_NAME$QT"'s:\(.*/'"$NAME"'_\([a-zA-Z]\+\([_@].*\)\?\)\.qm$\):%lang(\2) \1: +'"$ALL_NAME$QT"'s:\(.*/locale/\)\([^/]\+\)\(/.\+/\)\([^/]\+_qt\.qm$\):%lang(\2) \1\2\3\4: +'"$NO_ALL_NAME$QT"'s:\(.*/locale/\)\([^/]\+\)\(/.\+/\)\('"$NAME"'_qt\.qm$\):%lang(\2) \1\2\3\4: -+'"$NO_ALL_NAME$QT"'s:^\([^%].*/'"$NAME"'_\([a-zA-Z]\{2\}\([_@].*\)\?\)\.qm$\):%lang(\2) \1: - '"$ALL_NAME$QT"'s:^\([^%].*/\([a-zA-Z]\{2\}[_@].*\)\.qm$\):%lang(\2) \1: - '"$ALL_NAME$QT"'s:^\([^%].*/\([a-zA-Z]\{2\}\)\.qm$\):%lang(\2) \1: - '"$ALL_NAME$QT"'s:^\([^%].*/[^/_]\+_\([a-zA-Z]\{2\}[_@].*\)\.qm$\):%lang(\2) \1: ++'"$NO_ALL_NAME$QT"'s:^\([^%].*/'"$NAME"'_\([a-zA-Z]\+\([_@].*\)\?\)\.qm$\):%lang(\2) \1: + '"$ALL_NAME$QT"'s:^\([^%].*/\([a-zA-Z]\+[_@].*\)\.qm$\):%lang(\2) \1: + '"$ALL_NAME$QT"'s:^\([^%].*/\([a-zA-Z]\+\)\.qm$\):%lang(\2) \1: + '"$ALL_NAME$QT"'s:^\([^%].*/[^/_]\+_\([a-zA-Z]\+[_@].*\)\.qm$\):%lang(\2) \1: diff --git a/finddebuginfo-absolute-links.diff b/finddebuginfo-absolute-links.diff index 489c3cf..1eb6478 100644 --- a/finddebuginfo-absolute-links.diff +++ b/finddebuginfo-absolute-links.diff @@ -1,15 +1,6 @@ -From: Jan Blunck -Subject: Do the symbolic links right in the first place - -Since brp-symlink relinks symbolic links to enforce a certain policy we should -do it right in the first place. So this patch changes find-debuginfo.sh scripts -behavior to reflect that policy. - -Signed-off-by: Jan Blunck - ---- ./scripts/find-debuginfo.sh.orig 2017-12-01 15:26:21.939199791 +0000 -+++ ./scripts/find-debuginfo.sh 2017-12-01 15:27:03.153081225 +0000 -@@ -305,7 +305,17 @@ debug_link() +--- ./scripts/find-debuginfo.in.orig 2021-09-23 20:23:21.967469723 +0000 ++++ ./scripts/find-debuginfo.in 2021-09-23 20:24:51.623286108 +0000 +@@ -391,7 +391,17 @@ debug_link() local l="/usr/lib/debug$2" local t="$1" echo >> "$LINKSFILE" "$l $t" diff --git a/finddebuginfo.diff b/finddebuginfo.diff index d956166..a1b3993 100644 --- a/finddebuginfo.diff +++ b/finddebuginfo.diff @@ -1,6 +1,6 @@ ---- ./scripts/find-debuginfo.sh.orig 2019-09-09 07:56:53.377788842 +0000 -+++ ./scripts/find-debuginfo.sh 2019-10-02 11:11:56.878979662 +0000 -@@ -348,12 +348,18 @@ trap 'rm -rf "$temp"' EXIT +--- ./scripts/find-debuginfo.in.orig 2021-07-26 23:05:31.867817624 +0000 ++++ ./scripts/find-debuginfo.in 2021-09-23 20:20:03.763875636 +0000 +@@ -412,12 +412,18 @@ trap 'rm -rf "$temp"' EXIT # Build a list of unstripped ELF files and their hardlinks touch "$temp/primary" @@ -24,16 +24,16 @@ if [ $nlinks -gt 1 ]; then var=seen_$inum if test -n "${!var}"; then -@@ -386,6 +392,8 @@ do_file() +@@ -450,6 +456,8 @@ do_file() if [ "$no_recompute_build_id" = "true" ]; then no_recompute="-n" fi + mode=$(stat -c %a "$f") + chmod +w "$f" - id=$(${lib_rpm_dir}/debugedit -b "$debug_base_name" -d "$debug_dest_name" \ + id=$(${install_dir}/debugedit -b "$debug_base_name" -d "$debug_dest_name" \ $no_recompute -i \ ${build_id_seed:+--build-id-seed="$build_id_seed"} \ -@@ -413,17 +421,30 @@ do_file() +@@ -477,17 +485,30 @@ do_file() # just has its file names collected and adjusted. case "$dn" in /usr/lib/debug/*) @@ -71,7 +71,7 @@ # strip -g implies we have full symtab, don't add mini symtab in that case. # It only makes sense to add a minisymtab for executables and shared -@@ -581,12 +602,14 @@ if [ -s "$SOURCEFILE" ]; then +@@ -646,12 +667,14 @@ if [ -s "$SOURCEFILE" ]; then # and non-standard modes may be inherented from original directories, fixup find "${RPM_BUILD_ROOT}${debug_dest_name}" -type d -print0 | xargs --no-run-if-empty -0 chmod 0755 diff --git a/findlang.diff b/findlang.diff index 3ce28f5..89b444d 100644 --- a/findlang.diff +++ b/findlang.diff @@ -1,6 +1,6 @@ ---- ./scripts/find-lang.sh.orig 2019-09-09 07:56:53.377788842 +0000 -+++ ./scripts/find-lang.sh 2019-10-02 11:12:53.774861485 +0000 -@@ -22,11 +22,11 @@ the top of the tree containing the files +--- ./scripts/find-lang.sh.orig 2021-06-21 12:00:44.650612737 +0000 ++++ ./scripts/find-lang.sh 2021-09-23 19:12:01.428275661 +0000 +@@ -37,11 +37,11 @@ the top of the tree containing the files PACKAGE_NAME is the %{name} of the package. This should also be the basename of the .mo files. the output is written to PACKAGE_NAME.lang unless \$3 is given in which case output is written @@ -15,7 +15,7 @@ --with-qt find Qt translation files --with-html find HTML files --with-man find localized man pages -@@ -50,9 +50,9 @@ else NAMES[0]=$1 +@@ -65,9 +65,9 @@ else NAMES[0]=$1 fi shift @@ -27,7 +27,7 @@ QT=# MAN=# HTML=# -@@ -74,6 +74,14 @@ while test $# -gt 0 ; do +@@ -89,6 +89,14 @@ while test $# -gt 0 ; do KDE= shift ;; @@ -42,7 +42,7 @@ --with-qt ) QT= shift -@@ -103,11 +111,13 @@ while test $# -gt 0 ; do +@@ -118,11 +126,13 @@ while test $# -gt 0 ; do shift ;; esac @@ -59,7 +59,7 @@ for NAME in ${NAMES[@]}; do -@@ -117,7 +127,7 @@ s:'"$TOP_DIR"':: +@@ -132,7 +142,7 @@ s:'"$TOP_DIR"':: '"$NO_ALL_NAME$MO"'s:\(.*/locale/\)\([^/_]\+\)\(.*/'"$NAME"'\.mo$\):%lang(\2) \1\2\3: s:^\([^%].*\):: s:%lang(C) :: @@ -68,7 +68,7 @@ find "$TOP_DIR" -type d|sed ' s:'"$TOP_DIR"':: -@@ -125,27 +135,27 @@ s:'"$TOP_DIR"':: +@@ -140,27 +150,27 @@ s:'"$TOP_DIR"':: '"$ALL_NAME$GNOME"'s:\(.*/share/help/\)\([^/_]\+\)\([^/]*\)\(/[a-zA-Z0-9.\_\-]\+\)$:%lang(\2) %doc \1\2\3\4/: s:^\([^%].*\):: s:%lang(C) :: @@ -103,7 +103,7 @@ find "$TOP_DIR" -type f|sed ' s:'"$TOP_DIR"':: -@@ -153,7 +163,7 @@ s:'"$TOP_DIR"':: +@@ -168,7 +178,7 @@ s:'"$TOP_DIR"':: '"$ALL_NAME$GNOME"'s:\(.*/omf/[a-zA-Z0-9.\_\-]\+/[a-zA-Z0-9.\_\-]\+-\([^/.]\+\)\.omf\):%lang(\2) \1: s:^[^%].*:: s:%lang(C) :: @@ -112,7 +112,7 @@ find $TOP_DIR -type d|sed ' s:'"$TOP_DIR"':: -@@ -166,14 +176,14 @@ s:'"$TOP_DIR"':: +@@ -181,14 +191,14 @@ s:'"$TOP_DIR"':: s:%lang(.*) .*/mate/help/[a-zA-Z0-9.\_\-]\+/[a-zA-Z0-9.\_\-]\+/.*:: s:^\([^%].*\):: s:%lang(C) :: @@ -129,7 +129,7 @@ find "$TOP_DIR" -type f|sed ' s:'"$TOP_DIR"':: -@@ -181,7 +191,7 @@ s:'"$TOP_DIR"':: +@@ -196,7 +206,7 @@ s:'"$TOP_DIR"':: '"$ALL_NAME$MATE"'s:\(.*/omf/[a-zA-Z0-9.\_\-]\+/[a-zA-Z0-9.\_\-]\+-\([^/.]\+\)\.omf\):%lang(\2) \1: s:^[^%].*:: s:%lang(C) :: @@ -138,7 +138,7 @@ KDE3_HTML=`kde-config --expandvars --install html 2>/dev/null` if [ x"$KDE3_HTML" != x ] && [ -d "$TOP_DIR$KDE3_HTML" ]; then -@@ -193,7 +203,7 @@ s:'"$TOP_DIR"':: +@@ -208,7 +218,7 @@ s:'"$TOP_DIR"':: '"$ALL_NAME$KDE"'s:\(.*/HTML/\)\([^/_]\+\)\(.*/[a-zA-Z0-9.\_\-]\+$\):%lang(\2) \1\2\3: s:^\([^%].*\):: s:%lang(C) :: @@ -147,7 +147,7 @@ fi KDE4_HTML=`kde4-config --expandvars --install html 2>/dev/null` -@@ -206,7 +216,7 @@ s:'"$TOP_DIR"':: +@@ -221,7 +231,7 @@ s:'"$TOP_DIR"':: '"$ALL_NAME$KDE"'s:\(.*/HTML/\)\([^/_]\+\)\(.*/[a-zA-Z0-9.\_\-]\+$\):%lang(\2) \1\2\3: s:^\([^%].*\):: s:%lang(C) :: @@ -156,7 +156,7 @@ fi KF5_HTML=`kf5-config --expandvars --install html 2>/dev/null` -@@ -219,7 +229,7 @@ s:'"$TOP_DIR"':: +@@ -234,7 +244,7 @@ s:'"$TOP_DIR"':: '"$ALL_NAME$KDE"'s:\(.*/HTML/\)\([^/_]\+\)\(.*/[a-zA-Z0-9.\_\-]\+$\):%lang(\2) \1\2\3: s:^\([^%].*\):: s:%lang(C) :: @@ -165,7 +165,7 @@ fi find "$TOP_DIR" -type d|sed ' -@@ -230,7 +240,7 @@ s:'"$TOP_DIR"':: +@@ -245,7 +255,7 @@ s:'"$TOP_DIR"':: '"$ALL_NAME$HTML"'s:\(.*/doc/HTML/\)\([^/_]\+\)\(.*/[a-zA-Z0-9.\_\-]\+$\):%lang(\2) \1\2\3: s:^\([^%].*\):: s:%lang(C) :: @@ -174,8 +174,8 @@ find "$TOP_DIR" -type f -o -type l|sed ' s:'"$TOP_DIR"':: -@@ -243,7 +253,7 @@ s:'"$TOP_DIR"':: - '"$ALL_NAME$QT"'s:^\([^%].*/[^/]\+_\([a-zA-Z]\{2\}\)\.qm$\):%lang(\2) \1: +@@ -258,7 +268,7 @@ s:'"$TOP_DIR"':: + '"$ALL_NAME$QT"'s:^\([^%].*/[^/]\+_\([a-zA-Z]\+\)\.qm$\):%lang(\2) \1: s:^[^%].*:: s:%lang(C) :: -/^$/d' >> $MO_NAME @@ -183,7 +183,7 @@ find "$TOP_DIR" -type d|sed ' s:'"$TOP_DIR"':: -@@ -251,19 +261,24 @@ s:'"$TOP_DIR"':: +@@ -266,19 +276,24 @@ s:'"$TOP_DIR"':: '"$ALL_NAME$MAN"'s:\(.*/man/\([^/_]\+\).*/man[a-z0-9]\+$\):%lang(\2) \1*: s:^\([^%].*\):: s:%lang(C) :: diff --git a/findsupplements.diff b/findsupplements.diff index 272c93a..a0b7c52 100644 --- a/findsupplements.diff +++ b/findsupplements.diff @@ -1,25 +1,25 @@ ---- ./scripts/Makefile.am.orig 2020-05-28 10:04:25.075136894 +0000 -+++ ./scripts/Makefile.am 2020-09-30 13:11:48.626135765 +0000 -@@ -16,7 +16,7 @@ EXTRA_DIST = \ +--- ./scripts/Makefile.am.orig 2021-09-23 20:01:42.554113780 +0000 ++++ ./scripts/Makefile.am 2021-09-23 20:02:13.466049945 +0000 +@@ -17,7 +17,7 @@ EXTRA_DIST = \ rpmdb_dump rpmdb_load \ rpm.daily rpm.log rpm.supp rpm2cpio.sh \ tgpg vpkg-provides.sh \ - find-requires find-provides \ + find-requires find-provides find-supplements \ - find-requires.php find-provides.php \ ocamldeps.sh \ - pkgconfigdeps.sh libtooldeps.sh \ -@@ -28,7 +28,7 @@ rpmconfig_SCRIPTS = \ - brp-strip-shared brp-strip-static-archive \ + pkgconfigdeps.sh \ + fontconfig.prov script.req +@@ -29,7 +29,7 @@ rpmconfig_SCRIPTS = \ + brp-remove-la-files \ check-files check-prereqs \ check-buildroot check-rpaths check-rpaths-worker \ - find-lang.sh find-requires find-provides \ + find-lang.sh find-requires find-provides find-supplements \ - perl.prov perl.req pythondistdeps.py \ - pkgconfigdeps.sh libtooldeps.sh \ + perl.prov perl.req \ + pkgconfigdeps.sh \ ocamldeps.sh \ ---- ./scripts/find-supplements.orig 2020-09-30 13:10:46.546268477 +0000 -+++ ./scripts/find-supplements 2020-09-30 13:10:46.546268477 +0000 +--- ./scripts/find-supplements.orig 2021-09-23 20:01:42.554113780 +0000 ++++ ./scripts/find-supplements 2021-09-23 20:01:42.554113780 +0000 @@ -0,0 +1,3 @@ +#!/bin/sh + diff --git a/langnoc.diff b/langnoc.diff index bb8ee2e..8a70548 100644 --- a/langnoc.diff +++ b/langnoc.diff @@ -1,6 +1,6 @@ ---- ./macros.in.orig 2018-01-31 13:35:52.735593230 +0000 -+++ ./macros.in 2018-01-31 13:35:55.528585772 +0000 -@@ -1351,6 +1351,7 @@ EOF +--- ./macros.in.orig 2021-09-23 19:54:19.515028659 +0000 ++++ ./macros.in 2021-09-23 19:54:25.495016311 +0000 +@@ -1150,6 +1150,7 @@ package or when debugging this package.\ # %files -f %{name}.lang # %find_lang %{_rpmconfigdir}/find-lang.sh %{buildroot} @@ -8,9 +8,9 @@ # Commands + opts to use for retrieving remote files # Proxy opts can be set through --httpproxy/--httpport popt aliases, ---- ./scripts/find-lang.sh.orig 2018-01-31 13:35:52.726593254 +0000 -+++ ./scripts/find-lang.sh 2018-01-31 13:36:35.806478195 +0000 -@@ -60,6 +60,8 @@ MO= +--- ./scripts/find-lang.sh.orig 2021-09-23 19:54:19.507028675 +0000 ++++ ./scripts/find-lang.sh 2021-09-23 19:54:25.495016311 +0000 +@@ -75,6 +75,8 @@ MO= MO_NAME=${NAMES[0]}.lang ALL_NAME=# NO_ALL_NAME= @@ -19,7 +19,7 @@ while test $# -gt 0 ; do case "${1}" in --with-gnome ) -@@ -103,6 +105,14 @@ while test $# -gt 0 ; do +@@ -118,6 +120,14 @@ while test $# -gt 0 ; do NO_ALL_NAME=# shift ;; @@ -34,7 +34,7 @@ * ) if [ $MO_NAME != ${NAMES[$#]}.lang ]; then NAMES[${#NAMES[@]}]=$MO_NAME -@@ -143,6 +153,8 @@ s:'"$TOP_DIR"':: +@@ -158,6 +168,8 @@ s:'"$TOP_DIR"':: '"$ALL_NAME$MO"'s:\(.*/locale/\)\([^/_]\+\)\(.*\.mo$\):%lang(\2) \1\2\3: '"$NO_ALL_NAME$MO"'s:\(.*/locale/\)\([^/_]\+\)\(.*/'"$NAME"'\.mo$\):%lang(\2) \1\2\3: s:^\([^%].*\):: @@ -43,7 +43,7 @@ s:%lang(C) :: /^$/d' >> $MO_NAME_NEW -@@ -151,19 +163,23 @@ s:'"$TOP_DIR"':: +@@ -166,19 +178,23 @@ s:'"$TOP_DIR"':: '"$NO_ALL_NAME$GNOME"'s:\(.*/share/help/\)\([^/_]\+\)\([^/]*\)\(/'"$NAME"'\)$:%lang(\2) %doc \1\2\3\4/: '"$ALL_NAME$GNOME"'s:\(.*/share/help/\)\([^/_]\+\)\([^/]*\)\(/[a-zA-Z0-9.\_\-]\+\)$:%lang(\2) %doc \1\2\3\4/: s:^\([^%].*\):: @@ -69,7 +69,7 @@ s:%lang(C) :: /^$/d' >> $MO_NAME_NEW -@@ -179,6 +195,8 @@ s:'"$TOP_DIR"':: +@@ -194,6 +210,8 @@ s:'"$TOP_DIR"':: '"$NO_ALL_NAME$GNOME"'s:\(.*/omf/'"$NAME"'/'"$NAME"'-\([^/.]\+\)\.omf\):%lang(\2) \1: '"$ALL_NAME$GNOME"'s:\(.*/omf/[a-zA-Z0-9.\_\-]\+/[a-zA-Z0-9.\_\-]\+-\([^/.]\+\)\.omf\):%lang(\2) \1: s:^[^%].*:: @@ -78,7 +78,7 @@ s:%lang(C) :: /^$/d' >> $MO_NAME_NEW -@@ -219,6 +237,8 @@ s:'"$TOP_DIR"':: +@@ -234,6 +252,8 @@ s:'"$TOP_DIR"':: '"$ALL_NAME$KDE"'s:\(.*/HTML/\)\([^/_]\+\)\(.*/[a-zA-Z0-9.\_\-]\+/\):: '"$ALL_NAME$KDE"'s:\(.*/HTML/\)\([^/_]\+\)\(.*/[a-zA-Z0-9.\_\-]\+$\):%lang(\2) \1\2\3: s:^\([^%].*\):: @@ -87,7 +87,7 @@ s:%lang(C) :: /^$/d' >> $MO_NAME_NEW fi -@@ -232,6 +252,8 @@ s:'"$TOP_DIR"':: +@@ -247,6 +267,8 @@ s:'"$TOP_DIR"':: '"$ALL_NAME$KDE"'s:\(.*/HTML/\)\([^/_]\+\)\(.*/[a-zA-Z0-9.\_\-]\+/\):: '"$ALL_NAME$KDE"'s:\(.*/HTML/\)\([^/_]\+\)\(.*/[a-zA-Z0-9.\_\-]\+$\):%lang(\2) \1\2\3: s:^\([^%].*\):: @@ -96,16 +96,16 @@ s:%lang(C) :: /^$/d' >> $MO_NAME_NEW fi -@@ -269,6 +291,8 @@ s:'"$TOP_DIR"':: - '"$ALL_NAME$QT"'s:^\([^%].*/[^/]\+_\([a-zA-Z]\{2\}[_@].*\)\.qm$\):%lang(\2) \1: - '"$ALL_NAME$QT"'s:^\([^%].*/[^/]\+_\([a-zA-Z]\{2\}\)\.qm$\):%lang(\2) \1: +@@ -284,6 +306,8 @@ s:'"$TOP_DIR"':: + '"$ALL_NAME$QT"'s:^\([^%].*/[^/]\+_\([a-zA-Z]\+[_@].*\)\.qm$\):%lang(\2) \1: + '"$ALL_NAME$QT"'s:^\([^%].*/[^/]\+_\([a-zA-Z]\+\)\.qm$\):%lang(\2) \1: s:^[^%].*:: +'"$ONLY_C"'/%lang(C)/!d +'"$NO_C"'/%lang(C)/d s:%lang(C) :: /^$/d' >> $MO_NAME_NEW -@@ -277,6 +301,8 @@ s:'"$TOP_DIR"':: +@@ -292,6 +316,8 @@ s:'"$TOP_DIR"':: '"$ALL_NAME$MAN"'s:\(.*/man/\([^/_]\+\).*/man[a-z0-9]\+/\):: '"$ALL_NAME$MAN"'s:\(.*/man/\([^/_]\+\).*/man[a-z0-9]\+$\):%lang(\2) \1*: s:^\([^%].*\):: @@ -114,7 +114,7 @@ s:%lang(C) :: /^$/d' >> $MO_NAME_NEW -@@ -284,6 +310,8 @@ find "$TOP_DIR" -type f -o -type l|sed - +@@ -299,6 +325,8 @@ find "$TOP_DIR" -type f -o -type l|sed - s:'"$TOP_DIR"':: '"$NO_ALL_NAME$MAN"'s:\(.*/man/\([^/_]\+\).*/man[a-z0-9]\+/'"$NAME"'\.[a-z0-9].*\):%lang(\2) \1*: s:^\([^%].*\):: diff --git a/localetag.diff b/localetag.diff index 95d93f2..3f66163 100644 --- a/localetag.diff +++ b/localetag.diff @@ -1,8 +1,8 @@ Convert output to the current locale. Assumes utf8 input if the decoding works, otherwise iso-8859-1. ---- ./lib/tagexts.c.orig 2016-10-21 09:44:00.309962086 +0000 -+++ ./lib/tagexts.c 2017-01-19 10:27:57.243832208 +0000 +--- ./lib/tagexts.c.orig 2021-06-21 12:00:44.615612184 +0000 ++++ ./lib/tagexts.c 2021-09-23 18:58:58.461872258 +0000 @@ -2,6 +2,7 @@ * \file lib/formats.c */ @@ -167,7 +167,7 @@ decoding works, otherwise iso-8859-1. +/** * Retrieve summary text. * @param h header - * @retval td tag data container + * @param[out] td tag data container @@ -634,6 +774,16 @@ static int descriptionTag(Header h, rpmt return i18nTag(h, RPMTAG_DESCRIPTION, td, hgflags); } diff --git a/macrosin.diff b/macrosin.diff index 4747c52..f14ff8a 100644 --- a/macrosin.diff +++ b/macrosin.diff @@ -1,6 +1,6 @@ ---- ./macros.in.orig 2020-09-30 12:42:09.146057387 +0000 -+++ ./macros.in 2020-09-30 12:45:30.517611707 +0000 -@@ -168,6 +168,7 @@ +--- ./macros.in.orig 2021-09-23 19:13:54.532045005 +0000 ++++ ./macros.in 2021-09-23 19:13:59.592034687 +0000 +@@ -170,6 +170,7 @@ %{?_unique_debug_names:--unique-debug-suffix "-%{VERSION}-%{RELEASE}.%{_arch}"} \\\ %{?_unique_debug_srcs:--unique-debug-src-base "%{name}-%{VERSION}-%{RELEASE}.%{_arch}"} \\\ %{?_find_debuginfo_dwz_opts} \\\ @@ -8,7 +8,7 @@ %{?_find_debuginfo_opts} \\\ %{?_debugsource_packages:-S debugsourcefiles.list} \\\ "%{_builddir}/%{?buildsubdir}"\ -@@ -217,7 +217,8 @@ package or when debugging this package.\ +@@ -209,7 +210,8 @@ package or when debugging this package.\ %endif\ %{nil} @@ -18,7 +18,7 @@ %_defaultlicensedir %{_datadir}/licenses # Following macros for filtering auto deps must not be used in spec files. -@@ -280,7 +281,8 @@ package or when debugging this package.\ +@@ -269,7 +271,8 @@ package or when debugging this package.\ %_tmppath %{_var}/tmp # Path to top of build area. @@ -26,9 +26,9 @@ +%_topdir %{expand:%%global _topdir %{lua:if posix.access(rpm.expand("%{_usrsrc}/packages"), "w") then print "%{_usrsrc}/packages" else print "%{getenv:HOME}/rpmbuild" end} \ +}%_topdir - # The path to the unzip executable (legacy, use %{__unzip} instead). - %_unzipbin %{__unzip} -@@ -392,7 +394,7 @@ package or when debugging this package.\ + #============================================================================== + # ---- Optional rpmrc macros. +@@ -371,7 +374,7 @@ package or when debugging this package.\ # "w.ufdio" uncompressed # #%_source_payload w9.gzdio @@ -37,7 +37,7 @@ # Algorithm to use for generating file checksum digests on build. # If not specified or 0, MD5 is used. -@@ -499,6 +501,19 @@ package or when debugging this package.\ +@@ -481,6 +484,19 @@ package or when debugging this package.\ # #%_include_minidebuginfo 1 @@ -57,7 +57,7 @@ # # Include a .gdb_index section in the .debug files. # Requires _enable_debug_packages and gdb-add-index installed. -@@ -531,7 +546,7 @@ package or when debugging this package.\ +@@ -513,7 +529,7 @@ package or when debugging this package.\ # Same as for "separate" but if the __debug_package global is set then # the -debuginfo package will have a compatibility link for the main # ELF /usr/lib/debug/.build-id/xx/yyy -> /usr/lib/.build-id/xx/yyy @@ -66,7 +66,7 @@ # Whether build-ids should be made unique between package version/releases # when generating debuginfo packages. If set to 1 this will pass -@@ -560,10 +575,10 @@ package or when debugging this package.\ +@@ -542,10 +558,10 @@ package or when debugging this package.\ %_unique_debug_srcs 1 # Whether rpm should put debug source files into its own subpackage @@ -79,7 +79,7 @@ # # Use internal dependency generator rather than external helpers? -@@ -576,6 +591,10 @@ package or when debugging this package.\ +@@ -554,6 +570,10 @@ package or when debugging this package.\ # Directories whose contents should be considered as documentation. %__docdir_path %{_datadir}/doc:%{_datadir}/man:%{_datadir}/info:%{_datadir}/gtk-doc/html:%{_datadir}/gnome/help:%{?_docdir}:%{?_mandir}:%{?_infodir}:%{?_javadocdir}:/usr/doc:/usr/man:/usr/info:/usr/X11R6/man @@ -90,7 +90,7 @@ # # Path to scripts to autogenerate package dependencies, # -@@ -586,6 +605,7 @@ package or when debugging this package.\ +@@ -564,6 +584,7 @@ package or when debugging this package.\ %__find_requires %{_rpmconfigdir}/find-requires #%__find_conflicts ??? #%__find_obsoletes ??? @@ -98,20 +98,7 @@ # # Path to file attribute classifications for automatic dependency -@@ -665,10 +685,10 @@ package or when debugging this package.\ - # Misc BDB tuning options - %__dbi_other mp_mmapsize=128Mb mp_size=1Mb - --%_dbi_config %{?__dbi_other} -+%_dbi_config %{?__dbi_other} nofsync - - # "Packages" should have shared/exclusive fcntl(2) lock using "lockdbfd". --%_dbi_config_Packages %{?_dbi_config} lockdbfd -+%_dbi_config_Packages %{?__dbi_other} lockdbfd - - #============================================================================== - # ---- GPG/PGP/PGP5 signature macros. -@@ -1011,7 +1031,7 @@ package or when debugging this package.\ +@@ -948,7 +969,7 @@ package or when debugging this package.\ %_build_vendor %{_host_vendor} %_build_os %{_host_os} %_host @host@ @@ -120,7 +107,7 @@ %_host_cpu @host_cpu@ %_host_vendor @host_vendor@ %_host_os @host_os@ -@@ -1130,11 +1150,13 @@ package or when debugging this package.\ +@@ -1067,11 +1088,13 @@ package or when debugging this package.\ #------------------------------------------------------------------------------ # arch macro for all supported 32-bit ARM processors diff --git a/ndbglue.diff b/ndbglue.diff deleted file mode 100644 index 872ba4f..0000000 --- a/ndbglue.diff +++ /dev/null @@ -1,39 +0,0 @@ ---- ./lib/backend/ndb/glue.c.orig 2021-01-05 15:36:03.097744355 +0000 -+++ ./lib/backend/ndb/glue.c 2021-01-07 10:28:58.656228804 +0000 -@@ -311,12 +311,13 @@ static void setdata(dbiCursor dbc, unsi - - static rpmRC ndb_pkgdbPut(dbiIndex dbi, dbiCursor dbc, unsigned int *hdrNum, unsigned char *hdrBlob, unsigned int hdrLen) - { -+ struct ndbEnv_s *ndbenv = dbc->dbi->dbi_rpmdb->db_dbenv; - unsigned int hnum = *hdrNum; - int rc = RPMRC_OK; - - if (hnum == 0) { - rc = rpmpkgNextPkgIdx(dbc->dbi->dbi_db, &hnum); -- if (!rc) -+ if (!rc && ndbenv->hdrNum == hnum) - setdata(dbc, hnum, 0, 0); - } - -@@ -325,7 +326,8 @@ static rpmRC ndb_pkgdbPut(dbiIndex dbi, - - if (!rc) { - dbc->hdrNum = hnum; -- setdata(dbc, hnum, 0, 0); -+ if (ndbenv->hdrNum == hnum) -+ setdata(dbc, hnum, 0, 0); - *hdrNum = hnum; - } - return rc; -@@ -333,8 +335,10 @@ static rpmRC ndb_pkgdbPut(dbiIndex dbi, - - static rpmRC ndb_pkgdbDel(dbiIndex dbi, dbiCursor dbc, unsigned int hdrNum) - { -+ struct ndbEnv_s *ndbenv = dbc->dbi->dbi_rpmdb->db_dbenv; - dbc->hdrNum = 0; -- setdata(dbc, 0, 0, 0); -+ if (ndbenv->hdrNum == hdrNum) -+ setdata(dbc, 0, 0, 0); - return rpmpkgDel(dbc->dbi->dbi_db, hdrNum); - } - diff --git a/python-rpm-packaging.diff b/python-rpm-packaging.diff new file mode 100644 index 0000000..b5ebe1f --- /dev/null +++ b/python-rpm-packaging.diff @@ -0,0 +1,16 @@ +--- ./fileattrs/pythondist.attr.orig 2021-09-23 20:14:04.880605674 +0000 ++++ ./fileattrs/pythondist.attr 2021-09-23 20:15:23.392446317 +0000 +@@ -1,3 +1,4 @@ + %__pythondist_provides %{_rpmconfigdir}/pythondistdeps.py --provides --majorver-provides +-%__pythondist_requires %{_rpmconfigdir}/pythondistdeps.py --requires ++#disabled for now ++#%__pythondist_requires %{_rpmconfigdir}/pythondistdeps.py --requires + %__pythondist_path /lib(64)?/python[[:digit:]]\\.[[:digit:]]+/site-packages/[^/]+\\.(dist-info|egg-info|egg-link)$ +--- ./scripts/pythondistdeps.py.orig 2021-09-23 20:14:26.496561795 +0000 ++++ ./scripts/pythondistdeps.py 2021-09-23 20:14:30.748553177 +0000 +@@ -1,4 +1,4 @@ +-#!/usr/bin/python ++#!/usr/bin/python3 + # -*- coding: utf-8 -*- + # + # Copyright 2010 Per Øyvind Karlsen diff --git a/python-rpm-packaging.tar.bz2 b/python-rpm-packaging.tar.bz2 new file mode 120000 index 0000000..3962037 --- /dev/null +++ b/python-rpm-packaging.tar.bz2 @@ -0,0 +1 @@ +/ipfs/bafkreihye2e4i7wlvrvr5e5hdtp2wmfggznmkjs5ylfuqoa4nyvo77izh4 \ No newline at end of file diff --git a/python-rpm.changes b/python-rpm.changes index 4bba5c3..0b4f2ae 100644 --- a/python-rpm.changes +++ b/python-rpm.changes @@ -1,4 +1,9 @@ ------------------------------------------------------------------- +Thu Sep 23 20:57:45 CEST 2021 - mls@suse.de + +- update to rpm-4.17.0 + +------------------------------------------------------------------- Tue Mar 30 11:15:44 CEST 2021 - mls@suse.de - update to rpm-4.16.1.3 diff --git a/python-rpm.spec b/python-rpm.spec index 70911e7..fc2f35e 100644 --- a/python-rpm.spec +++ b/python-rpm.spec @@ -21,7 +21,7 @@ %global with_python 1 %{?!python_module:%define python_module() python-%{**} python3-%{**}} Name: python-rpm -Version: 4.16.1.3 +Version: 4.17.0 Release: 0 Summary: Python Bindings for Manipulating RPM Packages License: GPL-2.0-or-later diff --git a/pythondistdeps.diff b/pythondistdeps.diff deleted file mode 100644 index ca4d46e..0000000 --- a/pythondistdeps.diff +++ /dev/null @@ -1,8 +0,0 @@ ---- ./scripts/pythondistdeps.py.orig 2019-06-26 10:17:31.454985631 -0400 -+++ ./scripts/pythondistdeps.py 2019-10-31 16:30:37.685850605 -0400 -@@ -1,4 +1,4 @@ --#!/usr/bin/python -+#!/usr/bin/python3 - # -*- coding: utf-8 -*- - # - # Copyright 2010 Per Øyvind Karlsen diff --git a/remove-brp-strips.diff b/remove-brp-strips.diff index f6b871f..6c80857 100644 --- a/remove-brp-strips.diff +++ b/remove-brp-strips.diff @@ -3,14 +3,14 @@ Subject: remove references to removed brp scripts Some brp-scripts are not used in openSUSE, remove references to it ---- ./platform.in.orig 2018-10-16 09:22:16.004374524 +0000 -+++ ./platform.in 2018-10-16 09:24:58.891939175 +0000 -@@ -80,8 +80,6 @@ - %__os_install_post \ +--- ./platform.in.orig 2021-09-23 19:23:57.822814696 +0000 ++++ ./platform.in 2021-09-23 19:24:31.534745951 +0000 +@@ -96,8 +96,6 @@ %{?__brp_compress} \ + %{?__brp_elfperms} \ %{?__brp_strip} \ - %{?__brp_strip_static_archive} \ - %{?__brp_strip_comment_note} \ + %{?__brp_remove_la_files} \ %{nil} - %__spec_install_post\ diff --git a/rpm-4.16.1.3.tar.bz2 b/rpm-4.16.1.3.tar.bz2 deleted file mode 120000 index 384fbe7..0000000 --- a/rpm-4.16.1.3.tar.bz2 +++ /dev/null @@ -1 +0,0 @@ -/ipfs/bafybeiekpeiw3w24t4ly4jub44lzsebevdmixjn5fexpimmyyvlig7n4by \ No newline at end of file diff --git a/rpm-4.17.0.tar.bz2 b/rpm-4.17.0.tar.bz2 new file mode 120000 index 0000000..4c75ec6 --- /dev/null +++ b/rpm-4.17.0.tar.bz2 @@ -0,0 +1 @@ +/ipfs/bafybeignifxmlgmdzv3fjybgy2xxn5gwikpc3uofflhricei3eq2hyvxgu \ No newline at end of file diff --git a/rpm.changes b/rpm.changes index 487e992..1ff8bb2 100644 --- a/rpm.changes +++ b/rpm.changes @@ -1,4 +1,50 @@ ------------------------------------------------------------------- +Thu Sep 23 20:57:45 CEST 2021 - mls@suse.de + +- update to rpm-4.17.0 +- dropped support for berkeley db +- archive unpacking failures no longer leave garbage +- unified built-in and user-define macro syntax and calling conventions +- python generators and debuginfo extraction has been split into a + separate upstream project +- support for ed25519 signatures +- easier rpm macro access in lua +- new patches: + * python-rpm-packaging.diff + * singlefilemode.diff + * verbosearg.diff +- modified patches: + * usr-lib-sysimage-rpm.patch + * localetag.diff + * brp.diff + * findlang.diff + * macrosin.diff + * rpmqpack.diff + * build.diff + * whatrequires-doc.diff + * remove-brp-strips.diff + * fileattrs.diff + * langnoc.diff + * find-lang-qt-qm.patch + * findsupplements.diff + * finddebuginfo.diff + * finddebuginfo-absolute-links.diff + * debugsubpkg.diff + * debuglink.diff + * debuginfo-mono.patch +- dropped patches: + * db.diff + * dbfsync.diff + * dbprivate.diff + * dwarf5.diff + * ndbglue.diff + * pythondistdeps.diff + * suspendlock.diff + * taggedfileindex.diff + * waitlock.diff + * add-dwz-single-file-mode-option.patch + +------------------------------------------------------------------- Wed May 12 13:28:38 UTC 2021 - Andreas Schwab - auto-config-update-aarch64-ppc64le.diff: Treat missing timestamp as diff --git a/rpm.spec b/rpm.spec index 7738060..05c4620 100644 --- a/rpm.spec +++ b/rpm.spec @@ -20,7 +20,6 @@ %{?!_fillupdir:%define _fillupdir /var/adm/fillup-templates} %global librpmsover 9 -%global without_bdb 1 Name: rpm BuildRequires: binutils @@ -59,54 +58,44 @@ Requires: /usr/bin/awk Summary: The RPM Package Manager License: GPL-2.0-or-later Group: System/Packages -Version: 4.16.1.3 +Version: 4.17.0 Release: 0 URL: https://rpm.org/ #Git-Clone: https://github.com/rpm-software-management/rpm -Source: http://ftp.rpm.org/releases/rpm-4.16.x/rpm-%{version}.tar.bz2 +Source: http://ftp.rpm.org/releases/rpm-4.17.x/rpm-%{version}.tar.bz2 Source1: RPM-HOWTO.tar.bz2 +Source2: https://sourceware.org/ftp/debugedit/5.0/debugedit-5.0.tar.xz +Source3: python-rpm-packaging.tar.bz2 Source5: rpmsort Source8: rpmconfigcheck Source9: sysconfig.services-rpm -Source11: db-4.8.30.tar.bz2 Source12: baselibs.conf Source13: rpmconfigcheck.service -Patch2: db.diff -Patch5: usr-lib-sysimage-rpm.patch # quilt patches start here +Patch5: usr-lib-sysimage-rpm.patch Patch13: ignore-auxv.diff Patch12: localetag.diff -Patch15: dbfsync.diff Patch16: dbrointerruptable.diff Patch18: refreshtestarch.diff -Patch20: waitlock.diff -Patch21: suspendlock.diff Patch24: brp.diff Patch25: brpcompress.diff Patch26: checkfilesnoinfodir.diff -Patch27: finddebuginfo.diff Patch29: findlang.diff Patch30: macrosin.diff Patch32: platformin.diff Patch33: rpmpopt.diff Patch34: rpmrc.diff -Patch35: taggedfileindex.diff Patch36: rpmqpack.diff Patch38: build.diff Patch43: rpm-shorten-changelog.diff Patch45: whatrequires-doc.diff Patch46: remove-brp-strips.diff Patch47: requires-ge-macro.diff -Patch49: finddebuginfo-absolute-links.diff Patch51: specfilemacro.diff -Patch55: debugsubpkg.diff -Patch56: debuglink.diff -Patch57: debuginfo-mono.patch Patch60: safeugid.diff Patch61: noprereqdeprec.diff Patch66: remove-translations.diff Patch67: headeradddb.diff -Patch68: dbprivate.diff Patch69: nobuildcolor.diff Patch70: fileattrs.diff Patch71: nomagiccheck.diff @@ -121,14 +110,18 @@ Patch99: enable-postin-scripts-error.diff Patch100: rpm-findlang-inject-metainfo.patch Patch102: emptymanifest.diff Patch103: find-lang-qt-qm.patch -Patch109: pythondistdeps.diff Patch117: findsupplements.diff Patch122: db_conversion.diff Patch123: nextiteratorheaderblob.diff -Patch129: ndbglue.diff -Patch130: dwarf5.diff Patch131: posttrans.diff -Patch132: add-dwz-single-file-mode-option.patch +Patch132: verbosearg.diff +Patch200: finddebuginfo.diff +Patch201: finddebuginfo-absolute-links.diff +Patch202: debugsubpkg.diff +Patch203: debuglink.diff +Patch204: debuginfo-mono.patch +Patch205: singlefilemode.diff +Patch300: python-rpm-packaging.diff Patch6464: auto-config-update-aarch64-ppc64le.diff BuildRoot: %{_tmppath}/%{name}-%{version}-build # @@ -233,37 +226,38 @@ Provides and requires generator for .pl files and modules. %prep %setup -q -n rpm-%{version} +tar -xjf %{SOURCE1} +tar -xJf %{SOURCE2} +tar -xjf %{SOURCE3} + rm -rf sqlite -%if 0%{?!without_bdb:1} -tar xjf %{SOURCE11} -ln -s db-4.8.30 db -cd db -%patch2 -p1 -cd .. -chmod -R u+w db/* -rm -f rpmdb/db.h -cp build-aux/config.guess build-aux/config.sub db/dist/ -%endif -%patch5 -p1 -%patch -P 12 -P 13 -P 15 -P 16 -P 18 -%patch -P 20 -P 21 -P 24 -P 25 -P 26 -P 27 -P 29 -%patch -P 30 -P 32 -P 33 -P 34 -P 35 -P 36 -P 38 -%patch -P 43 -P 45 -P 46 -P 47 -P 49 -%patch -P 51 -P 55 -P 56 -P 57 -%patch -P 60 -P 61 -P 66 -P 67 -P 68 -P 69 +%patch -P 5 -P 12 -P 13 -P 16 -P 18 +%patch -P 24 -P 25 -P 26 -P 29 +%patch -P 30 -P 32 -P 33 -P 34 -P 36 -P 38 +%patch -P 43 -P 45 -P 46 -P 47 +%patch -P 51 +%patch -P 60 -P 61 -P 66 -P 67 -P 69 %patch -P 70 -P 71 -P 73 -P 75 -P 77 -P 78 %patch -P 85 %patch -P 93 -P 94 -P 99 %patch -P 100 -P 102 -P 103 -%patch -P 109 -P 117 -%patch -P 122 -P 123 -P 129 -P 130 -P 131 -%patch132 -p1 +%patch -P 117 +%patch -P 122 -P 123 -P 131 -P 132 + +# debugedit patches +pushd debugedit-5.0 +%patch -P 200 -P 201 -P 202 -P 203 -P 204 -P 205 +popd + +# python-rpm-packaging patches +pushd python-rpm-packaging +%patch -P 300 +popd %ifarch aarch64 ppc64le riscv64 %patch6464 %endif -tar -xjvf %{SOURCE1} rm -f m4/libtool.m4 rm -f m4/lt*.m4 @@ -279,6 +273,7 @@ BUILDTARGET="--build=%{_target_cpu}-suse-linux-gnueabi" %else BUILDTARGET="--build=%{_target_cpu}-suse-linux" %endif +export __FIND_DEBUGINFO=/usr/lib/rpm/find-debuginfo autoreconf -fi ./configure --disable-dependency-tracking --prefix=%{_prefix} --mandir=%{_mandir} --infodir=%{_infodir} \ @@ -295,13 +290,21 @@ autoreconf -fi --enable-ndb \ --enable-bdb-ro \ --enable-zstd \ -%{?without_bdb: --enable-bdb=no} \ +--enable-sqlite=no \ %{?with_python: --enable-python} \ $BUILDTARGET rm po/de.gmo make %{?_smp_mflags} +%if "%{NAME}" != "python-rpm" +pushd debugedit-5.0 +./configure --bindir=/usr/lib/rpm +touch find-debuginfo.1 +make +popd +%endif + %install mkdir -p %{buildroot}/usr/lib mkdir -p %{buildroot}/usr/share/locale @@ -311,9 +314,6 @@ mkdir -p %{buildroot}/bin %if !0%{?usrmerged} ln -s /usr/bin/rpm %{buildroot}/bin/rpm %endif -%if 0%{?!without_bdb:1} -install -m 644 db3/db.h %{buildroot}/usr/include/rpm -%endif # remove .la file and the static variant of libpopt # have to remove the dependency from other .la files as well for f in %{buildroot}/%{_libdir}/*.la; do @@ -341,8 +341,6 @@ export RPM_BUILD_ROOT %ifarch s390x [ -f scripts/brp-%_arch-linux ] && sh scripts/brp-%_arch-linux %endif -chmod 755 doc/manual -rm -rf doc/manual/Makefile* rm -f %{buildroot}/usr/lib/rpmpopt rm -rf %{buildroot}%{_mandir}/{fr,ja,ko,pl,ru,sk} rm -f %{buildroot}%{_prefix}/share/locale/de/LC_MESSAGES/rpm.mo @@ -383,11 +381,20 @@ sh %{buildroot}/usr/lib/rpm/find-lang.sh %{buildroot} rpm # so we need to enforce the platform here. echo -n "%{_target_cpu}-suse-linux-gnueabi" > %{buildroot}/etc/rpm/platform %endif -%if 0%{?without_bdb:1} + # make ndb the default database backend echo "setting the default database backend to 'ndb'" -sed -i -e '/_db_backend/s/bdb/ndb/' %{buildroot}/usr/lib/rpm/macros -%endif +sed -i -e '/_db_backend/s/sqlite/ndb/' %{buildroot}/usr/lib/rpm/macros + +# install debugedit files +pushd debugedit-5.0 +make install-exec DESTDIR="%{buildroot}" +popd + +# install python-rpm-packaging files +cp -a python-rpm-packaging/fileattrs/*.attr %{buildroot}/usr/lib/rpm/fileattrs +cp -a python-rpm-packaging/scripts/* %{buildroot}/usr/lib/rpm +chmod 755 %{buildroot}/usr/lib/rpm/brp-python-bytecompile %post %{fillup_only -an services} @@ -428,7 +435,7 @@ fi %files -f rpm.lang %defattr(-,root,root) %license COPYING -%doc doc/manual +%doc docs/manual %doc RPM-HOWTO /etc/rpm %if !0%{?usrmerged} @@ -481,7 +488,6 @@ fi %files build %defattr(-,root,root) /usr/bin/rpmbuild -/usr/lib/rpm/libtooldeps.sh /usr/lib/rpm/pkgconfigdeps.sh /usr/lib/rpm/ocamldeps.sh /usr/lib/rpm/elfdeps @@ -490,9 +496,12 @@ fi /usr/lib/rpm/sepdebugcrcfix /usr/bin/rpmspec /usr/lib/rpm/brp-* +%exclude /usr/lib/rpm/brp-python-hardlink +%exclude /usr/lib/rpm/brp-python-bytecompile /usr/lib/rpm/check-* /usr/lib/rpm/*find* /usr/lib/rpm/fileattrs/ +%exclude /usr/lib/rpm/fileattrs/python.attr %exclude /usr/lib/rpm/fileattrs/pythondist.attr %exclude /usr/lib/rpm/fileattrs/perl*.attr /usr/lib/rpm/*.prov @@ -506,8 +515,11 @@ fi %files build-python %defattr(-,root,root) +/usr/lib/rpm/fileattrs/python.attr /usr/lib/rpm/fileattrs/pythondist.attr /usr/lib/rpm/pythondistdeps.py +/usr/lib/rpm/brp-python-hardlink +/usr/lib/rpm/brp-python-bytecompile %files build-perl %defattr(-,root,root) diff --git a/rpmqpack.diff b/rpmqpack.diff index 02f9a40..be2cef3 100644 --- a/rpmqpack.diff +++ b/rpmqpack.diff @@ -1,6 +1,6 @@ ---- ./Makefile.am.orig 2020-09-30 12:47:19.181371209 +0000 -+++ ./Makefile.am 2020-09-30 12:47:25.797356566 +0000 -@@ -198,6 +198,10 @@ rpmgraph_LDADD = lib/librpm.la rpmio/lib +--- ./Makefile.am.orig 2021-06-21 12:00:44.552611187 +0000 ++++ ./Makefile.am 2021-09-23 19:17:54.619555392 +0000 +@@ -175,6 +175,10 @@ rpmgraph_LDADD = lib/librpm.la rpmio/lib dist_bin_SCRIPTS = scripts/gendiff @@ -11,19 +11,19 @@ rpmconfig_DATA = rpmrc rpmrc: $(top_srcdir)/rpmrc.in @$(SED) \ ---- ./doc/Makefile.am.orig 2020-09-30 12:47:25.797356566 +0000 -+++ ./doc/Makefile.am 2020-09-30 12:48:22.709230608 +0000 -@@ -8,7 +8,7 @@ EXTRA_DIST += $(man_man1_DATA) +--- ./docs/man/Makefile.am.orig 2021-08-20 08:44:56.263259000 +0000 ++++ ./docs/man/Makefile.am 2021-09-23 19:17:54.619555392 +0000 +@@ -9,7 +9,7 @@ EXTRA_DIST += gendiff.1.md man_man8dir = $(mandir)/man8 man_man8_DATA = rpm.8 rpm-misc.8 rpmbuild.8 rpmdeps.8 rpmgraph.8 rpm2cpio.8 -man_man8_DATA += rpmdb.8 rpmkeys.8 rpmsign.8 rpmspec.8 +man_man8_DATA += rpmdb.8 rpmkeys.8 rpmsign.8 rpmspec.8 rpmqpack.8 - EXTRA_DIST += $(man_man8_DATA) - ---- ./doc/rpmqpack.8.orig 2020-09-30 12:47:25.797356566 +0000 -+++ ./doc/rpmqpack.8 2020-09-30 12:47:25.797356566 +0000 + EXTRA_DIST += rpm.8.md rpm-misc.8.md rpmbuild.8.md rpmdeps.8.md rpmgraph.8.md + EXTRA_DIST += rpm2cpio.8.md rpmdb.8.md rpmkeys.8.md rpmsign.8.md rpmspec.8.md +--- ./docs/man/rpmqpack.8.orig 2021-09-23 19:17:54.619555392 +0000 ++++ ./docs/man/rpmqpack.8 2021-09-23 19:17:54.619555392 +0000 @@ -0,0 +1,25 @@ +.TH RPMQPACK 8 "Mar 2002" +.SH NAME @@ -50,8 +50,8 @@ + +.SH AUTHOR +Michael Schroeder ---- ./rpmqpack.c.orig 2020-09-30 12:47:25.797356566 +0000 -+++ ./rpmqpack.c 2020-09-30 12:47:25.797356566 +0000 +--- ./rpmqpack.c.orig 2021-09-23 19:17:54.619555392 +0000 ++++ ./rpmqpack.c 2021-09-23 19:17:54.619555392 +0000 @@ -0,0 +1,60 @@ +#include +#include diff --git a/singlefilemode.diff b/singlefilemode.diff new file mode 100644 index 0000000..2ef098a --- /dev/null +++ b/singlefilemode.diff @@ -0,0 +1,10 @@ +--- ./scripts/find-debuginfo.in.orig 2021-09-24 09:10:06.477724685 +0000 ++++ ./scripts/find-debuginfo.in 2021-09-24 09:10:26.557680705 +0000 +@@ -168,7 +168,6 @@ while [ $# -gt 0 ]; do + ;; + --dwz-single-file-mode) + dwz_single_file_mode=true +- shift + ;; + --build-id-seed) + build_id_seed=$2 diff --git a/suspendlock.diff b/suspendlock.diff deleted file mode 100644 index 3ac23cd..0000000 --- a/suspendlock.diff +++ /dev/null @@ -1,117 +0,0 @@ -Suspend exclusive database lock when scriptlets get called, allowing -read access in scriptlets. Only needed for DB_PRIVATE (aka global) -locking. - ---- ./lib/backend/db3.c.orig 2020-09-30 12:25:06.516375109 +0000 -+++ ./lib/backend/db3.c 2020-09-30 12:25:10.312366497 +0000 -@@ -549,6 +549,46 @@ static void db3_dbSetFSync(rpmdb rdb, in - - static int db3_Ctrl(rpmdb rdb, dbCtrlOp ctrl) - { -+ struct flock l; -+ int tries; -+ int fdno = -1; -+ dbiIndex dbi; -+ DB * db; -+ -+ switch (ctrl) { -+ case DB_CTRL_SUSPEND_DBLOCK: -+ case DB_CTRL_RESUME_DBLOCK: -+ dbi = rdb->db_pkgs; /* packages db only */ -+ if (!dbi) -+ return 1; -+ if (!dbi->cfg.dbi_lockdbfd || (dbi->dbi_flags & DBI_VERIFYONLY) != 0) -+ return 0; -+ if (!(dbi->dbi_rpmdb->db_mode & (O_RDWR|O_WRONLY))) -+ return 0; -+ if (_lockdbfd == 0) -+ return 0; -+ db = dbi->dbi_db; -+ if (!(db->fd(db, &fdno) == 0 && fdno >= 0)) -+ return 1; -+ for (tries = 0; tries < 2; tries++) { -+ memset(&l, 0, sizeof(l)); -+ l.l_whence = 0; -+ l.l_start = 0; -+ l.l_len = 0; -+ l.l_type = ctrl == DB_CTRL_SUSPEND_DBLOCK ? F_RDLCK : F_WRLCK; -+ if (!fcntl(fdno, tries ? F_SETLKW : F_SETLK, (void *)&l)) -+ return 0; -+ if (ctrl == DB_CTRL_SUSPEND_DBLOCK) { -+ rpmlog(RPMLOG_WARNING, _("could not suspend database lock\n")); -+ return 1; -+ } -+ if (tries == 0) -+ rpmlog(RPMLOG_WARNING, _("waiting to reestablish exclusive database lock\n")); -+ } -+ return 1; -+ default: -+ break; -+ } - return 0; - } - ---- ./lib/backend/dbi.h.orig 2020-09-30 12:25:06.516375109 +0000 -+++ ./lib/backend/dbi.h 2020-09-30 12:25:10.312366497 +0000 -@@ -18,7 +18,9 @@ typedef enum dbCtrlOp_e { - DB_CTRL_UNLOCK_RO = 2, - DB_CTRL_LOCK_RW = 3, - DB_CTRL_UNLOCK_RW = 4, -- DB_CTRL_INDEXSYNC = 5 -+ DB_CTRL_INDEXSYNC = 5, -+ DB_CTRL_SUSPEND_DBLOCK = 100, -+ DB_CTRL_RESUME_DBLOCK = 101 - } dbCtrlOp; - - typedef struct dbiIndex_s * dbiIndex; ---- ./lib/rpmdb.c.orig 2020-09-30 12:25:06.516375109 +0000 -+++ ./lib/rpmdb.c 2020-09-30 12:25:10.312366497 +0000 -@@ -2637,6 +2637,12 @@ int rpmdbCtrl(rpmdb db, rpmdbCtrlOp ctrl - case RPMDB_CTRL_INDEXSYNC: - dbctrl = DB_CTRL_INDEXSYNC; - break; -+ case RPMDB_CTRL_SUSPEND_DBLOCK: -+ dbctrl = DB_CTRL_SUSPEND_DBLOCK; -+ break; -+ case RPMDB_CTRL_RESUME_DBLOCK: -+ dbctrl = DB_CTRL_RESUME_DBLOCK; -+ break; - } - return dbctrl ? dbCtrl(db, dbctrl) : 1; - } ---- ./lib/rpmdb.h.orig 2020-05-28 10:04:25.037136686 +0000 -+++ ./lib/rpmdb.h 2020-09-30 12:25:10.312366497 +0000 -@@ -36,7 +36,9 @@ typedef enum rpmdbCtrlOp_e { - RPMDB_CTRL_UNLOCK_RO = 2, - RPMDB_CTRL_LOCK_RW = 3, - RPMDB_CTRL_UNLOCK_RW = 4, -- RPMDB_CTRL_INDEXSYNC = 5 -+ RPMDB_CTRL_INDEXSYNC = 5, -+ RPMDB_CTRL_SUSPEND_DBLOCK = 100, -+ RPMDB_CTRL_RESUME_DBLOCK = 101 - } rpmdbCtrlOp; - - /** \ingroup rpmdb ---- ./lib/transaction.c.orig 2020-09-30 07:48:01.215567727 +0000 -+++ ./lib/transaction.c 2020-09-30 12:25:10.312366497 +0000 -@@ -1692,6 +1692,7 @@ rpmRC runScript(rpmts ts, rpmte te, Head - rpmTagVal stag = rpmScriptTag(script); - FD_t sfd = NULL; - int warn_only = !(rpmScriptFlags(script) & RPMSCRIPT_FLAG_CRITICAL); -+ rpmdb rdb = rpmtsGetRdb(ts); - - if (rpmChrootIn()) - return RPMRC_FAIL; -@@ -1706,10 +1707,12 @@ rpmRC runScript(rpmts ts, rpmte te, Head - if (sfd == NULL) - sfd = rpmtsScriptFd(ts); - -+ rpmdbCtrl(rdb, RPMDB_CTRL_SUSPEND_DBLOCK); - rpmswEnter(rpmtsOp(ts, RPMTS_OP_SCRIPTLETS), 0); - rc = rpmScriptRun(script, arg1, arg2, sfd, - prefixes, rpmtsPlugins(ts)); - rpmswExit(rpmtsOp(ts, RPMTS_OP_SCRIPTLETS), 0); -+ rpmdbCtrl(rdb, RPMDB_CTRL_RESUME_DBLOCK); - - /* Map warn-only errors to "notfound" for script stop callback */ - stoprc = (rc != RPMRC_OK && warn_only) ? RPMRC_NOTFOUND : rc; diff --git a/taggedfileindex.diff b/taggedfileindex.diff deleted file mode 100644 index 0324a7f..0000000 --- a/taggedfileindex.diff +++ /dev/null @@ -1,15 +0,0 @@ -This used to be the taggedfileindex patch, but it's gone. -The remaining part just strips off the tag. - ---- ./lib/backend/db3.c.orig 2017-01-19 12:54:16.141112342 +0000 -+++ ./lib/backend/db3.c 2017-01-19 12:55:14.587945851 +0000 -@@ -1024,6 +1024,9 @@ static int dbt2set(dbiIndex dbi, DBT * d - _DBSWAP(hdrNum); - _DBSWAP(tagNum); - } -+ /* remove tagged directory info */ -+ if (tagNum.ui & 0x80000000) -+ tagNum.ui &= 0x0000ffff; - set->recs[i].hdrNum = hdrNum.ui; - set->recs[i].tagNum = tagNum.ui; - } diff --git a/usr-lib-sysimage-rpm.patch b/usr-lib-sysimage-rpm.patch index d844a77..bc6a2b8 100644 --- a/usr-lib-sysimage-rpm.patch +++ b/usr-lib-sysimage-rpm.patch @@ -1,7 +1,7 @@ ---- rpm-4.13.0.1/macros.in.orig 2017-10-04 17:05:17.198681581 +0200 -+++ rpm-4.13.0.1/macros.in 2017-10-04 17:07:37.122679969 +0200 -@@ -165,7 +165,7 @@ - %_bzip2bin %{__bzip2} +--- ./macros.in.orig 2021-08-20 08:44:56.264259007 +0000 ++++ ./macros.in 2021-09-23 18:57:26.654059458 +0000 +@@ -140,7 +140,7 @@ + %_buildshell /bin/sh # The location of the rpm database file(s). -%_dbpath %{_var}/lib/rpm diff --git a/verbosearg.diff b/verbosearg.diff new file mode 100644 index 0000000..87c3711 --- /dev/null +++ b/verbosearg.diff @@ -0,0 +1,32 @@ +--- ./rpmio/macro.c.orig ++++ ./rpmio/macro.c +@@ -1141,7 +1141,10 @@ static size_t doExpand(MacroBuf mb, rpmMacroEntry me, ARGV_t argv) + + static size_t doVerbose(MacroBuf mb, rpmMacroEntry me, ARGV_t argv) + { +- mbAppend(mb, rpmIsVerbose() ? '1' : '0'); ++ if (argv[1] != NULL) ++ mbAppendStr(mb, rpmIsVerbose() ? argv[1] : ""); ++ else ++ mbAppend(mb, rpmIsVerbose() ? '1' : '0'); + return 0; + } + +@@ -1282,7 +1285,7 @@ static struct builtins_s { + { "uncompress", doUncompress, 1, ME_FUNC }, + { "undefine", doUndefine, 1, ME_FUNC }, + { "url2path", doFoo, 1, ME_FUNC }, +- { "verbose", doVerbose, 0, ME_FUNC }, ++ { "verbose", doVerbose, -1, ME_FUNC }, + { "warn", doOutput, 1, ME_FUNC }, + { NULL, NULL, 0 } + }; +@@ -1347,7 +1350,7 @@ doExpandThisMacro(MacroBuf mb, rpmMacroEntry me, ARGV_t args, size_t *parsed) + int nargs = argvCount(args) - 1; + int needarg = (me->nargs != 0); + int havearg = (nargs > 0); +- if (needarg != havearg) { ++ if (((me->flags & ME_PARSE) || me->nargs >= 0) && needarg != havearg) { + mbErr(mb, 1, "%%%s: %s\n", me->name, needarg ? + _("argument expected") : _("unexpected argument")); + goto exit; diff --git a/waitlock.diff b/waitlock.diff deleted file mode 100644 index d565a77..0000000 --- a/waitlock.diff +++ /dev/null @@ -1,111 +0,0 @@ -Fix global (DB_PRIVATE) lock code: fix recursion counter, retry -failed lock operations for up to 3 minutes. - ---- ./lib/backend/db3.c.orig 2017-01-19 14:59:01.432807649 +0000 -+++ ./lib/backend/db3.c 2017-01-19 15:13:18.034716068 +0000 -@@ -33,6 +33,8 @@ struct dbiCursor_s { - static struct dbiConfig_s staticdbicfg; - static struct dbConfig_s staticcfg; - -+static int _lockdbfd = 0; -+ - /** \ingroup dbi - */ - static const struct poptOption rdbOptions[] = { -@@ -744,6 +746,8 @@ static int db3_dbiClose(dbiIndex dbi, un - - rpmlog(RPMLOG_DEBUG, "closed db index %s/%s\n", - dbhome, dbi->dbi_file); -+ if (dbi->cfg.dbi_lockdbfd && !(dbi->dbi_flags & DBI_VERIFYONLY) && _lockdbfd) -+ _lockdbfd--; - } - - db_fini(rdb, dbhome ? dbhome : ""); -@@ -783,6 +787,7 @@ static int dbiFlock(dbiIndex dbi, int mo - rc = 1; - } else { - const char *dbhome = rpmdbHome(dbi->dbi_rpmdb); -+ int tries; - struct flock l; - memset(&l, 0, sizeof(l)); - l.l_whence = 0; -@@ -792,20 +797,38 @@ static int dbiFlock(dbiIndex dbi, int mo - ? F_RDLCK : F_WRLCK; - l.l_pid = 0; - -- rc = fcntl(fdno, F_SETLK, (void *) &l); -- if (rc) { -- uint32_t eflags = db_envflags(db); -- /* Warning iff using non-private CDB locking. */ -- rc = (((eflags & DB_INIT_CDB) && !(eflags & DB_PRIVATE)) ? 0 : 1); -- rpmlog( (rc ? RPMLOG_ERR : RPMLOG_WARNING), -- _("cannot get %s lock on %s/%s\n"), -- ((mode & O_ACCMODE) == O_RDONLY) -- ? _("shared") : _("exclusive"), -- dbhome, dbi->dbi_file); -- } else { -- rpmlog(RPMLOG_DEBUG, -- "locked db index %s/%s\n", -- dbhome, dbi->dbi_file); -+ for (tries = 0; ; tries++) { -+ rc = fcntl(fdno, F_SETLK, (void *) &l); -+ if (rc) { -+ uint32_t eflags = db_envflags(db); -+ /* Warning iff using non-private CDB locking. */ -+ rc = (((eflags & DB_INIT_CDB) && !(eflags & DB_PRIVATE)) ? 0 : 1); -+ if (errno == EAGAIN && rc) { -+ struct timespec ts; -+ if (tries == 0) -+ rpmlog(RPMLOG_WARNING, -+ _("waiting for %s lock on %s/%s\n"), -+ ((mode & O_ACCMODE) == O_RDONLY) -+ ? _("shared") : _("exclusive"), -+ dbhome, dbi->dbi_file); -+ ts.tv_sec = (time_t)0; -+ ts.tv_nsec = 100000000; /* .1 seconds */ -+ if (tries < 10*60*3) { /* 3 minutes */ -+ nanosleep(&ts, (struct timespec *)0); -+ continue; -+ } -+ } -+ rpmlog( (rc ? RPMLOG_ERR : RPMLOG_WARNING), -+ _("cannot get %s lock on %s/%s\n"), -+ ((mode & O_ACCMODE) == O_RDONLY) -+ ? _("shared") : _("exclusive"), -+ dbhome, dbi->dbi_file); -+ } else { -+ rpmlog(RPMLOG_DEBUG, -+ "locked db index %s/%s\n", -+ dbhome, dbi->dbi_file); -+ } -+ break; - } - } - return rc; -@@ -822,7 +845,6 @@ static int db3_dbiOpen(rpmdb rdb, rpmDbi - DB * db = NULL; - DBTYPE dbtype = DB_UNKNOWN; - uint32_t oflags; -- static int _lockdbfd = 0; - - if (dbip) - *dbip = NULL; -@@ -902,6 +924,8 @@ static int db3_dbiOpen(rpmdb rdb, rpmDbi - dbi->dbi_flags |= DBI_CREATED; - if (oflags & DB_RDONLY) - dbi->dbi_flags |= DBI_RDONLY; -+ if (verifyonly) -+ dbi->dbi_flags |= DBI_VERIFYONLY; - - if (!verifyonly && rc == 0 && dbi->cfg.dbi_lockdbfd && _lockdbfd++ == 0) { - rc = dbiFlock(dbi, rdb->db_mode); ---- ./lib/backend/dbi.h.orig 2017-01-19 15:12:26.833899257 +0000 -+++ ./lib/backend/dbi.h 2017-01-19 15:05:43.958347554 +0000 -@@ -83,6 +83,7 @@ enum dbiFlags_e { - DBI_NONE = 0, - DBI_CREATED = (1 << 0), - DBI_RDONLY = (1 << 1), -+ DBI_VERIFYONLY = (1 << 2), - }; - - enum dbcFlags_e { diff --git a/whatrequires-doc.diff b/whatrequires-doc.diff index 035d0e1..95fa8c2 100644 --- a/whatrequires-doc.diff +++ b/whatrequires-doc.diff @@ -1,14 +1,14 @@ ---- ./doc/rpm.8.orig 2018-08-21 10:38:02.035078442 +0000 -+++ ./doc/rpm.8 2018-10-16 09:21:26.948505637 +0000 -@@ -632,6 +632,11 @@ Query all packages that provide the \fIC - .TP - \fB--whatrequires \fICAPABILITY\fB\fR - Query all packages that require \fICAPABILITY\fR for proper functioning. +--- ./docs/man/rpm.8.orig 2021-09-23 19:20:46.991203867 +0000 ++++ ./docs/man/rpm.8 2021-09-23 19:22:45.918961340 +0000 +@@ -601,6 +601,11 @@ Query all packages that provide the \f[I + \f[B]--whatrequires \f[R]\f[I]CAPABILITY\f[R] + Query all packages that require \f[I]CAPABILITY\f[R] for proper + functioning. +.br +Note that this does not return what requires a given package. +A package usually provides multiple capabilities and file-names on which +other packages may depend. To see the complete dependencies -+for a package, use \fB-e --test \fIPACKAGE_NAME\fB\fR ++for a package, use \f[B]-e --test \f[R]\f[I]PACKAGE_NAME\f[R] .TP - \fB--whatconflicts \fICAPABILITY\fB\fR - Query all packages that conflict with \fICAPABILITY\fR. + \f[B]--whatconflicts \f[R]\f[I]CAPABILITY\f[R] + Query all packages that conflict with \f[I]CAPABILITY\f[R].