Commit | Line | Data |
---|---|---|
fee16138 FF |
1 | diff -u -r ../dpkg-1.18.15/src/archives.c ./src/archives.c |
2 | --- ../dpkg-1.18.15/src/archives.c 2016-11-11 22:18:40.000000000 -0500 | |
3 | +++ ./src/archives.c 2016-12-03 16:28:53.922977673 -0500 | |
2fd44a0f | 4 | @@ -393,8 +393,10 @@ |
59f0d218 FF |
5 | namenode->statoverride->uid, |
6 | namenode->statoverride->gid, | |
7 | namenode->statoverride->mode); | |
8 | +#ifndef __ANDROID__ | |
9 | if (fchown(fd, st->uid, st->gid)) | |
99c3da2c | 10 | ohshite(_("error setting ownership of '%.255s'"), te->name); |
59f0d218 FF |
11 | +#endif |
12 | if (fchmod(fd, st->mode & ~S_IFMT)) | |
99c3da2c | 13 | ohshite(_("error setting permissions of '%.255s'"), te->name); |
59f0d218 | 14 | |
2fd44a0f | 15 | @@ -506,11 +508,15 @@ |
59f0d218 FF |
16 | return; /* Already handled using the file descriptor. */ |
17 | ||
18 | if (te->type == TAR_FILETYPE_SYMLINK) { | |
19 | +#ifndef __ANDROID__ | |
20 | if (lchown(path, st->uid, st->gid)) | |
99c3da2c | 21 | ohshite(_("error setting ownership of symlink '%.255s'"), path); |
59f0d218 FF |
22 | +#endif |
23 | } else { | |
24 | +#ifndef __ANDROID__ | |
25 | if (chown(path, st->uid, st->gid)) | |
99c3da2c | 26 | ohshite(_("error setting ownership of '%.255s'"), path); |
59f0d218 FF |
27 | +#endif |
28 | if (chmod(path, st->mode & ~S_IFMT)) | |
99c3da2c | 29 | ohshite(_("error setting permissions of '%.255s'"), path); |
59f0d218 | 30 | } |
fee16138 FF |
31 | @@ -546,7 +552,9 @@ |
32 | linksize = readlink(fn_old, linkname, stab->st_size + 1); | |
33 | if (linksize < 0) | |
34 | ohshite(_("unable to read link '%.255s'"), fn_old); | |
35 | - else if (linksize != stab->st_size) | |
36 | + else if (linksize > stab->st_size) | |
37 | + /* Termux patch: In some cases st_size is too large, ignore that. | |
38 | + See https://github.com/corbinlc/GNURootDebian/issues/103 */ | |
39 | ohshit(_("symbolic link '%.250s' size has changed from %jd to %zd"), | |
40 | fn_old, (intmax_t)stab->st_size, linksize); | |
41 | linkname[linksize] = '\0'; | |
42 | @@ -1033,19 +1041,28 @@ | |
43 | r = readlink(fnamevb.buf, symlinkfn.buf, symlinkfn.size); | |
44 | if (r < 0) | |
45 | ohshite(_("unable to read link '%.255s'"), ti->name); | |
46 | - else if (r != stab.st_size) | |
47 | + else if (r > stab.st_size) | |
48 | + /* Termux patch: In some cases st_size is too large, ignore that. | |
49 | + See https://github.com/corbinlc/GNURootDebian/issues/103 */ | |
50 | ohshit(_("symbolic link '%.250s' size has changed from %jd to %zd"), | |
51 | fnamevb.buf, (intmax_t)stab.st_size, r); | |
52 | varbuf_trunc(&symlinkfn, r); | |
59f0d218 FF |
53 | varbuf_end_str(&symlinkfn); |
54 | if (symlink(symlinkfn.buf,fnametmpvb.buf)) | |
99c3da2c | 55 | ohshite(_("unable to make backup symlink for '%.255s'"), ti->name); |
59f0d218 FF |
56 | +#ifndef __ANDROID__ |
57 | if (lchown(fnametmpvb.buf,stab.st_uid,stab.st_gid)) | |
99c3da2c | 58 | ohshite(_("unable to chown backup symlink for '%.255s'"), ti->name); |
59f0d218 FF |
59 | +#endif |
60 | tarobject_set_se_context(fnamevb.buf, fnametmpvb.buf, stab.st_mode); | |
61 | } else { | |
62 | debug(dbg_eachfiledetail, "tarobject nondirectory, 'link' backup"); | |
2fd44a0f FF |
63 | +#ifdef __ANDROID__ |
64 | + /* Android does not support hardlinks. */ | |
65 | + if (rename(fnamevb.buf,fnametmpvb.buf)) | |
66 | +#else | |
9fbdefb9 | 67 | if (link(fnamevb.buf,fnametmpvb.buf)) |
2fd44a0f FF |
68 | +#endif |
69 | ohshite(_("unable to make backup link of '%.255s' before installing new version"), | |
70 | ti->name); | |
9fbdefb9 | 71 | } |