Gentoo Archives: gentoo-commits

From: "Mike Frysinger (vapier)" <vapier@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] gentoo-x86 commit in app-arch/cpio/files: cpio-2.9-restore-perms-owners.patch
Date: Sun, 01 Jun 2008 23:04:38
Message-Id: E1K2wbI-0007BK-P6@stork.gentoo.org
1 vapier 08/06/01 23:04:32
2
3 Added: cpio-2.9-restore-perms-owners.patch
4 Log:
5 Add fix from upstream for restoring perms/owners properly #218040 by alexsaa.
6 (Portage version: 2.2_pre5.spank.spunk)
7
8 Revision Changes Path
9 1.1 app-arch/cpio/files/cpio-2.9-restore-perms-owners.patch
10
11 file : http://sources.gentoo.org/viewcvs.py/gentoo-x86/app-arch/cpio/files/cpio-2.9-restore-perms-owners.patch?rev=1.1&view=markup
12 plain: http://sources.gentoo.org/viewcvs.py/gentoo-x86/app-arch/cpio/files/cpio-2.9-restore-perms-owners.patch?rev=1.1&content-type=text/plain
13
14 Index: cpio-2.9-restore-perms-owners.patch
15 ===================================================================
16 http://bugs.gentoo.org/218040
17
18 fix from upstream to restore owners/perms in some situations
19
20 --- cpio-2.9/src/extern.h
21 +++ cpio-2.9/src/extern.h
22 @@ -211,7 +211,7 @@ uintmax_t from_ascii (char const *where,
23
24 void delay_set_stat (char const *file_name, struct stat *st,
25 mode_t invert_permissions);
26 -void repair_delayed_set_stat (char const *dir,
27 +int repair_delayed_set_stat (char const *dir,
28 struct stat *dir_stat_info);
29 void apply_delayed_set_stat (void);
30
31 --- cpio-2.9/src/copyin.c
32 +++ cpio-2.9/src/copyin.c
33 @@ -570,6 +570,7 @@ static void
34 copyin_directory (struct cpio_file_stat *file_hdr, int existing_dir)
35 {
36 int res; /* Result of various function calls. */
37 + struct stat file_stat;
38 #ifdef HPUX_CDF
39 int cdf_flag; /* True if file is a CDF. */
40 int cdf_char; /* Index of `+' char indicating a CDF. */
41 @@ -626,7 +627,6 @@ copyin_directory (struct cpio_file_stat
42 create_all_directories(), so the mkdir will fail
43 because the directory exists. If that's the case,
44 don't complain about it. */
45 - struct stat file_stat;
46 if (errno != EEXIST)
47 {
48 mkdir_error (file_hdr->c_name);
49 @@ -645,7 +645,11 @@ copyin_directory (struct cpio_file_stat
50 }
51 }
52
53 - set_perms (-1, file_hdr);
54 + /* if the directory is queued for delayed_set_stat,
55 + fix permissions in the queue, otherwise set the permissions now */
56 + void cpio_to_stat (struct cpio_file_stat *hdr, struct stat *st); cpio_to_stat(file_hdr, &file_stat);
57 + if (repair_delayed_set_stat(file_hdr->c_name, &file_stat))
58 + set_perms (-1, file_hdr);
59 }
60
61 static void
62 --- cpio-2.9/src/util.c
63 +++ cpio-2.9/src/util.c
64 @@ -1265,6 +1265,16 @@ stat_to_cpio (struct cpio_file_stat *hdr
65 hdr->c_tar_linkname = NULL;
66 }
67
68 +void
69 +cpio_to_stat (struct cpio_file_stat *hdr, struct stat *st)
70 +{
71 + stat (hdr->c_name, st);
72 + st->st_mode = hdr->c_mode;
73 + st->st_uid = CPIO_UID(hdr->c_uid);
74 + st->st_gid = CPIO_GID(hdr->c_gid);
75 + st->st_mtime = hdr->c_mtime;
76 +}
77 +
78 #ifndef HAVE_FCHOWN
79 # define fchown(fd, uid, gid) (-1)
80 #endif
81 @@ -1389,7 +1399,7 @@ delay_set_stat (char const *file_name, s
82 created within the file name of DIR. The intermediate directory turned
83 out to be the same as this directory, e.g. due to ".." or symbolic
84 links. *DIR_STAT_INFO is the status of the directory. */
85 -void
86 +int
87 repair_delayed_set_stat (char const *dir,
88 struct stat *dir_stat_info)
89 {
90 @@ -1400,22 +1410,19 @@ repair_delayed_set_stat (char const *dir
91 if (stat (data->stat.c_name, &st) != 0)
92 {
93 stat_error (data->stat.c_name);
94 - return;
95 + return 0;
96 }
97
98 if (st.st_dev == dir_stat_info->st_dev
99 && st.st_ino == dir_stat_info->st_ino)
100 {
101 stat_to_cpio (&data->stat, dir_stat_info);
102 - data->invert_permissions =
103 - ((dir_stat_info->st_mode ^ st.st_mode)
104 - & MODE_RWX & ~ newdir_umask);
105 - return;
106 + data->invert_permissions = 0;
107 + return 0;
108 }
109 }
110
111 - ERROR ((0, 0, _("%s: Unexpected inconsistency when making directory"),
112 - quotearg_colon (dir)));
113 + return -1;
114 }
115
116 void
117
118
119
120 --
121 gentoo-commits@l.g.o mailing list