change the uid and gid of directories newly created when run with --change-files

(cherry picked from commit 6e844c2d505c49b6e67eb16f46ba938d8e8cdc62)
This commit is contained in:
dongyuzhen 2022-10-18 17:15:54 +08:00 committed by openeuler-sync-bot
parent 37abbeb86a
commit de8068ea1c
2 changed files with 37 additions and 1 deletions

View File

@ -0,0 +1,29 @@
From 7f15e07b7a94765459d51dfa315562187cc14161 Mon Sep 17 00:00:00 2001
From: xujing <xujing125@huawei.com>
Date: Fri, 30 Sep 2022 09:19:10 +0800
Subject: [PATCH] fix -k may not keep uid or gid
when rpmrebuild run with -k and --change-files, some files may not keep uid or
gid. when use --change-files, remrebuild will mkdir a tmp dir and copy files to
tmp dir, and when use -k, files will be installed by %attr(-,-,-), which will
inherit permissions of tmp dir. However, --change-files only set permission.
---
rpmrebuild_buildroot.sh | 2 ++
1 file changed, 2 insertions(+)
diff --git a/rpmrebuild_buildroot.sh b/rpmrebuild_buildroot.sh
index c83f6eb..1cd119f 100755
--- a/rpmrebuild_buildroot.sh
+++ b/rpmrebuild_buildroot.sh
@@ -74,6 +74,8 @@ while :; do
file_perm="${file_perm#${not_perm}}"
Mkdir_p $BuildRoot/$file || Critical "$MY_BASENAME Mkdir_p $BuildRoot/$file"
chmod $file_perm $BuildRoot/$file || Critical "$MY_BASENAME chmod $file_perm $BuildRoot/$file"
+ chown $file_user $BuildRoot/$file || Critical "$MY_BASENAME chown $file_user $BuildRoot/$file"
+ chgrp $file_group $BuildRoot/$file || Critical "$MY_BASENAME chgrp $file_group $BuildRoot/$file"
;;
*)
--
2.23.0

View File

@ -1,12 +1,13 @@
Name: rpmrebuild
Version: 2.15
Release: 2
Release: 3
Summary: A tool to build a rpm file from the rpm database
License: GPLv2+
URL: http://rpmrebuild.sourceforge.net
Source0: https://downloads.sourceforge.net/rpmrebuild/%{name}-%{version}.tar.gz
Patch9000: bugfix-reset-defattr-when-users-want-to-keep-files-permissi.patch
Patch9001: fix-k-may-not-keep-uid-or-gid.patch
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
BuildArch: noarch
@ -58,6 +59,12 @@ rm -rf $RPM_BUILD_ROOT%{_mandir}/fr_FR.UTF-8/man1/
%{_mandir}/fr/man1/*.gz
%changelog
* Tue Oct 18 2022 dongyuzhen <dongyuzhen@h-partners.com> - 2.15-3
- Type:bugfix
- CVE:NA
- SUG:NA
- DESC:change the uid and gid of directories newly created when run with --change-files
* Mon Mar 28 2022 yuanxin <yuanxin24@h-partners.com> - 2.15-2
- Type:bugfix
- ID:NA