RPM Package Manager, CVS Repository http://rpm5.org/cvs/ ____________________________________________________________________________
Server: rpm5.org Name: Jeff Johnson Root: /v/rpm/cvs Email: j...@rpm5.org Module: rpm Date: 05-Mar-2017 19:06:24 Branch: rpm-5_4 Handle: 2017030518062400 Modified files: (Branch: rpm-5_4) rpm CHANGES rpm/tools debugedit.c Log: - debugedit: sync changes before upgrading. Summary: Revision Changes Path 1.3501.2.524+1 -0 rpm/CHANGES 2.23.2.19 +34 -14 rpm/tools/debugedit.c ____________________________________________________________________________ patch -p0 <<'@@ .' Index: rpm/CHANGES ============================================================================ $ cvs diff -u -r1.3501.2.523 -r1.3501.2.524 CHANGES --- rpm/CHANGES 4 Mar 2017 19:13:59 -0000 1.3501.2.523 +++ rpm/CHANGES 5 Mar 2017 18:06:24 -0000 1.3501.2.524 @@ -1,4 +1,5 @@ 5.4.17 -> 5.4.18: + - jbj: debugedit: sync changes before upgrading. - jbj: header: fix: test args before immutable region trailer memcpy (PLD). - jbj: fix: filter EEXIST and use rpmlog on tmpdir creation (ticket #97). - jbj: flatcc: AutoFU added. @@ . patch -p0 <<'@@ .' Index: rpm/tools/debugedit.c ============================================================================ $ cvs diff -u -r2.23.2.18 -r2.23.2.19 debugedit.c --- rpm/tools/debugedit.c 19 Jun 2016 08:53:47 -0000 2.23.2.18 +++ rpm/tools/debugedit.c 5 Mar 2017 18:06:24 -0000 2.23.2.19 @@ -1,4 +1,4 @@ -/* Copyright (C) 2001, 2002, 2003, 2005, 2007, 2009, 2010, 2011 Red Hat, Inc. +/* Copyright (C) 2001-2003, 2005, 2007, 2009-2011, 2016 Red Hat, Inc. Written by Alexander Larsson <al...@redhat.com>, 2002 Based on code by Jakub Jelinek <ja...@redhat.com>, 2001. @@ -75,7 +75,6 @@ #include <beecrypt/beecrypt.h> #include "hashtab.h" -#include <rpmtag.h> #define DW_TAG_partial_unit 0x3c #define DW_FORM_sec_offset 0x17 @@ -88,6 +87,7 @@ char *list_file = NULL; int list_file_fd = -1; int do_build_id = 0; +char *build_id_seed = NULL; typedef struct { @@ -514,7 +514,7 @@ unsigned char *endcu, *endprol; unsigned char opcode_base; uint32_t value, dirt_cnt; - size_t comp_dir_len = strlen (comp_dir); + size_t comp_dir_len = comp_dir ? strlen (comp_dir) : 0; size_t abs_file_cnt = 0, abs_dir_cnt = 0; if (phase != 0) @@ -1322,16 +1322,19 @@ } static struct poptOption optionsTable[] = { - { "base-dir", 'b', POPT_ARG_STRING, &base_dir, 0, - "base build directory of objects", NULL }, - { "dest-dir", 'd', POPT_ARG_STRING, &dest_dir, 0, - "directory to rewrite base-dir into", NULL }, - { "list-file", 'l', POPT_ARG_STRING, &list_file, 0, - "file where to put list of source and header file names", NULL }, - { "build-id", 'i', POPT_ARG_NONE, &do_build_id, 0, - "recompute build ID note and print ID on stdout", NULL }, - POPT_AUTOHELP - { NULL, 0, 0, NULL, 0, NULL, NULL } + { "base-dir", 'b', POPT_ARG_STRING, &base_dir, 0, + N_("base build DIRECTORY of objects"), N_("DIRECTORY") }, + { "dest-dir", 'd', POPT_ARG_STRING, &dest_dir, 0, + N_("DIRECTORY to rewrite base-dir into"), N_("DIRECTORY") }, + { "list-file", 'l', POPT_ARG_STRING, &list_file, 0, + N_("FILE where to put list of source and header file names"), N_("FILE") }, + { "build-id", 'i', POPT_ARG_NONE, &do_build_id, 0, + N_("recompute build-id note and print on stdout"), NULL }, + { "build-id-seed", 's', POPT_ARG_STRING, &build_id_seed, 0, + N_("if recomputing the build-id note, use this string as hash SEED"), N_("SEED") }, + + POPT_AUTOHELP + { NULL, 0, 0, NULL, 0, NULL, NULL } }; static DSO * @@ -1437,7 +1440,7 @@ exit (1); } - if (!dirty_elf) + if (!dirty_elf && build_id_seed == NULL) goto print; if (elf_update (dso->elf, ELF_C_NULL) < 0) @@ -1452,6 +1455,10 @@ hashFunctionContextInit (&ctx, hf); + /* If a seed string was given use it to prime the hash. */ + if (build_id_seed != NULL) + process(&ctx, build_id_seed, strlen(build_id_seed)); + /* Slurp the relevant header bits and section contents and feed them into the hash function. The only bits we ignore are the offset fields in ehdr and shdrs, since the semantically identical ELF file @@ -1609,6 +1616,19 @@ } } + if (build_id_seed != NULL && do_build_id == 0) + { + fprintf (stderr, "--build-id-seed (-s) needs --build-id (-i)\n"); + exit (1); + } + + if (build_id_seed != NULL && strlen (build_id_seed) < 1) + { + fprintf (stderr, + "--build-id-seed (-s) string should be at least 1 char\n"); + exit (1); + } + /* Ensure clean paths, users can muck with these */ if (base_dir) canonicalize_path(base_dir, base_dir); @@ . ______________________________________________________________________ RPM Package Manager http://rpm5.org CVS Sources Repository rpm-cvs@rpm5.org