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

(cherry picked from commit 2e44100dc9c3eaba5965c566f87845d3428019c3)
This commit is contained in:
dongyuzhen 2022-10-18 17:09:55 +08:00 committed by openeuler-sync-bot
parent d32792f433
commit 094bb5b258
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 4af3c0a..4014ff8 100755
--- a/rpmrebuild_buildroot.sh
+++ b/rpmrebuild_buildroot.sh
@@ -75,6 +75,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.33.0

View File

@ -1,6 +1,6 @@
Name: rpmrebuild
Version: 2.16
Release: 3
Release: 4
Summary: A tool to build a rpm file from the rpm database
License: GPLv2+
URL: http://rpmrebuild.sourceforge.net
@ -8,6 +8,7 @@ Source0: https://downloads.sourceforge.net/rpmrebuild/%{name}-%{version}.
Patch9000: bugfix-reset-defattr-when-users-want-to-keep-files-permissi.patch
Patch9001: openEuler-fix-the-CreateBuildRoot-error-when-using-rpmrebuild-command.patch
Patch9002: fix-k-may-not-keep-uid-or-gid.patch
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
BuildArch: noarch
@ -59,6 +60,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.16-4
- Type:bugfix
- CVE:NA
- SUG:NA
- DESC:change the uid and gid of directories newly created when run with --change-files
* Tue Jun 28 2022 dongyuzhen <dongyuzhen@h-partners.com> - 2.16-3
- Type:bugfix
- CVE:NA