tar: fix reproducibility issue
[openwrt/openwrt.git] / tools / tar / patches / 100-symlink-force-root-name.patch
1 Force root/root as names for uid0/gid0 instead of using the system
2 names. This helps make packed download tarballs more reproducible
3
4 Signed-off-by: Felix Fietkau <nbd@nbd.name>
5 ---
6 --- a/src/create.c
7 +++ b/src/create.c
8 @@ -545,12 +545,8 @@ write_gnu_long_link (struct tar_stat_inf
9 char *tmpname;
10
11 header = start_private_header ("././@LongLink", size, 0);
12 - uid_to_uname (0, &tmpname);
13 - UNAME_TO_CHARS (tmpname, header->header.uname);
14 - free (tmpname);
15 - gid_to_gname (0, &tmpname);
16 - GNAME_TO_CHARS (tmpname, header->header.gname);
17 - free (tmpname);
18 + UNAME_TO_CHARS ("root", header->header.uname);
19 + GNAME_TO_CHARS ("root", header->header.gname);
20
21 strcpy (header->buffer + offsetof (struct posix_header, magic),
22 OLDGNU_MAGIC);