From 7a839c1a47d7a42294a12e6f3031581d8f39a8771b14686053ed6620dace056e Mon Sep 17 00:00:00 2001 From: Dirk Mueller Date: Wed, 1 Mar 2017 11:09:17 +0000 Subject: [PATCH] Accepting request 460704 from home:rguenther:branches:Base:System - Fix debugedit-canon-fix.diff to handle directory table size shrinking by 1 byte correctly. OBS-URL: https://build.opensuse.org/request/show/460704 OBS-URL: https://build.opensuse.org/package/show/Base:System/rpm?expand=0&rev=381 --- debugedit-canon-fix.diff | 29 +++++++++++++++++++---------- rpm.changes | 6 ++++++ 2 files changed, 25 insertions(+), 10 deletions(-) diff --git a/debugedit-canon-fix.diff b/debugedit-canon-fix.diff index 3140b96..fd8d857 100644 --- a/debugedit-canon-fix.diff +++ b/debugedit-canon-fix.diff @@ -1,5 +1,7 @@ ---- ./tools/debugedit.c.orig 2017-01-19 12:59:37.848194305 +0000 -+++ ./tools/debugedit.c 2017-01-19 12:59:45.236173176 +0000 +Index: tools/debugedit.c +=================================================================== +--- tools/debugedit.c.orig 2017-02-27 13:35:18.727800856 +0100 ++++ tools/debugedit.c 2017-02-27 14:22:33.975985617 +0100 @@ -162,7 +162,7 @@ strptr (DSO *dso, int sec, off_t offset) { if (data->d_buf @@ -71,22 +73,29 @@ char *orig = strdup ((const char *) srcptr); -@@ -730,10 +735,13 @@ edit_dwarf2_line (DSO *dso, uint32_t off +@@ -730,11 +735,18 @@ edit_dwarf2_line (DSO *dso, uint32_t off if (shrank > 0) { - if (--shrank == 0) -+ --shrank; -+#if 0 -+ if (shrank == 0) - error (EXIT_FAILURE, 0, - "canonicalization unexpectedly shrank by one character"); +- error (EXIT_FAILURE, 0, +- "canonicalization unexpectedly shrank by one character"); ++ if (shrank == 1) ++ { ++ /* For size 1 we can't append a dummy entry as a '\0' tells ++ it the directory table ends prematurely and thus the file ++ table will end up empty. Simply append a / to the last ++ directory entry in this case. */ ++ *(ptr - 1) = '/'; ++ *ptr++ = '\0'; ++ } else -+#endif { ++ --shrank; memset (ptr, 'X', shrank); ptr += shrank; -@@ -769,21 +777,26 @@ edit_dwarf2_line (DSO *dso, uint32_t off + *ptr++ = '\0'; +@@ -769,21 +781,26 @@ edit_dwarf2_line (DSO *dso, uint32_t off } dirty_section (DEBUG_STR); } diff --git a/rpm.changes b/rpm.changes index 19b8bb4..739e4da 100644 --- a/rpm.changes +++ b/rpm.changes @@ -1,3 +1,9 @@ +------------------------------------------------------------------- +Mon Feb 27 13:24:26 UTC 2017 - rguenther@suse.com + +- Fix debugedit-canon-fix.diff to handle directory table size shrinking + by 1 byte correctly. + ------------------------------------------------------------------- Mon Feb 20 14:17:26 CET 2017 - mls@suse.de