!44 【Mainline】Fix issue of moving files by ar or br

From: @yixiangzhike 
Reviewed-by: @xiezhipeng1 
Signed-off-by: @xiezhipeng1
This commit is contained in:
openeuler-ci-bot 2022-08-25 01:50:51 +00:00 committed by Gitee
commit 158859b991
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
2 changed files with 33 additions and 1 deletions

View File

@ -0,0 +1,28 @@
From e155af3cf1ed9a215459ee161f7632b8b8b62e52 Mon Sep 17 00:00:00 2001
From: yixiangzhike <yixiangzhike007@163.com>
Date: Wed, 17 Aug 2022 16:44:03 +0800
Subject: [PATCH] fix issue of moving files by ar or br
When eu-ar uses the combination of br or ar parameters to move the exist files,
it forgets to add the files to the new linked list. As a result, the files are lost.
---
src/ar.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/src/ar.c b/src/ar.c
index 42126aa..56fb9ed 100644
--- a/src/ar.c
+++ b/src/ar.c
@@ -1342,7 +1342,8 @@ do_oper_insert (int oper, const char *arfname, char **argv, int argc,
struct armem *last_added = after_memberelem;
for (int cnt = 0; cnt < argc; ++cnt)
- if (oper != oper_replace || found[cnt]->old_off == -1)
+ if (((oper == oper_replace) && (ipos != ipos_none) && (found[cnt]->old_off != -1)) || \
+ oper != oper_replace || found[cnt]->old_off == -1)
{
if (last_added == NULL)
{
--
2.27.0

View File

@ -1,7 +1,7 @@
# -*- rpm-spec from http://elfutils.org/ -*-
Name: elfutils
Version: 0.187
Release: 3
Release: 4
Summary: A collection of utilities and DSOs to handle ELF files and DWARF data
URL: http://elfutils.org/
License: GPLv3+ and (GPLv2+ or LGPLv3+)
@ -9,6 +9,7 @@ Source: ftp://sourceware.org/pub/elfutils/%{version}/elfutils-%{version}.tar.bz2
Patch0: Fix-segfault-in-eu-ar-m.patch
Patch1: Fix-error-of-parsing-object-file-perms.patch
Patch2: Fix-issue-of-moving-files-by-ar-or-br.patch
Requires: elfutils-libelf = %{version}-%{release}
Requires: elfutils-libs = %{version}-%{release}
@ -304,6 +305,9 @@ exit 0
%systemd_postun_with_restart debuginfod.service
%changelog
* Wed Aug 24 2022 yixiangzhike <yixiangzhike007@163.com> - 0.187-4
- Fix issue of moving files by ar or br
* Tue Aug 16 2022 yixiangzhike <yixiangzhike007@163.com> - 0.187-3
- Fix error of parsing object file perms