2016-12-03 22:55:45 +01:00
|
|
|
diff -u -r ../dpkg-1.18.15/src/archives.c ./src/archives.c
|
|
|
|
--- ../dpkg-1.18.15/src/archives.c 2016-11-11 22:18:40.000000000 -0500
|
|
|
|
+++ ./src/archives.c 2016-12-03 16:28:53.922977673 -0500
|
2016-11-26 01:56:24 +01:00
|
|
|
@@ -393,8 +393,10 @@
|
2015-06-13 01:03:31 +02:00
|
|
|
namenode->statoverride->uid,
|
|
|
|
namenode->statoverride->gid,
|
|
|
|
namenode->statoverride->mode);
|
|
|
|
+#ifndef __ANDROID__
|
|
|
|
if (fchown(fd, st->uid, st->gid))
|
2015-08-26 00:25:24 +02:00
|
|
|
ohshite(_("error setting ownership of '%.255s'"), te->name);
|
2015-06-13 01:03:31 +02:00
|
|
|
+#endif
|
|
|
|
if (fchmod(fd, st->mode & ~S_IFMT))
|
2015-08-26 00:25:24 +02:00
|
|
|
ohshite(_("error setting permissions of '%.255s'"), te->name);
|
2015-06-13 01:03:31 +02:00
|
|
|
|
2016-11-26 01:56:24 +01:00
|
|
|
@@ -506,11 +508,15 @@
|
2015-06-13 01:03:31 +02:00
|
|
|
return; /* Already handled using the file descriptor. */
|
|
|
|
|
|
|
|
if (te->type == TAR_FILETYPE_SYMLINK) {
|
|
|
|
+#ifndef __ANDROID__
|
|
|
|
if (lchown(path, st->uid, st->gid))
|
2015-08-26 00:25:24 +02:00
|
|
|
ohshite(_("error setting ownership of symlink '%.255s'"), path);
|
2015-06-13 01:03:31 +02:00
|
|
|
+#endif
|
|
|
|
} else {
|
|
|
|
+#ifndef __ANDROID__
|
|
|
|
if (chown(path, st->uid, st->gid))
|
2015-08-26 00:25:24 +02:00
|
|
|
ohshite(_("error setting ownership of '%.255s'"), path);
|
2015-06-13 01:03:31 +02:00
|
|
|
+#endif
|
|
|
|
if (chmod(path, st->mode & ~S_IFMT))
|
2015-08-26 00:25:24 +02:00
|
|
|
ohshite(_("error setting permissions of '%.255s'"), path);
|
2015-06-13 01:03:31 +02:00
|
|
|
}
|
2016-12-03 22:55:45 +01:00
|
|
|
@@ -546,7 +552,9 @@
|
|
|
|
linksize = readlink(fn_old, linkname, stab->st_size + 1);
|
|
|
|
if (linksize < 0)
|
|
|
|
ohshite(_("unable to read link '%.255s'"), fn_old);
|
|
|
|
- else if (linksize != stab->st_size)
|
|
|
|
+ else if (linksize > stab->st_size)
|
|
|
|
+ /* Termux patch: In some cases st_size is too large, ignore that.
|
|
|
|
+ See https://github.com/corbinlc/GNURootDebian/issues/103 */
|
|
|
|
ohshit(_("symbolic link '%.250s' size has changed from %jd to %zd"),
|
|
|
|
fn_old, (intmax_t)stab->st_size, linksize);
|
|
|
|
linkname[linksize] = '\0';
|
|
|
|
@@ -1033,19 +1041,28 @@
|
|
|
|
r = readlink(fnamevb.buf, symlinkfn.buf, symlinkfn.size);
|
|
|
|
if (r < 0)
|
|
|
|
ohshite(_("unable to read link '%.255s'"), ti->name);
|
|
|
|
- else if (r != stab.st_size)
|
|
|
|
+ else if (r > stab.st_size)
|
|
|
|
+ /* Termux patch: In some cases st_size is too large, ignore that.
|
|
|
|
+ See https://github.com/corbinlc/GNURootDebian/issues/103 */
|
|
|
|
ohshit(_("symbolic link '%.250s' size has changed from %jd to %zd"),
|
|
|
|
fnamevb.buf, (intmax_t)stab.st_size, r);
|
|
|
|
varbuf_trunc(&symlinkfn, r);
|
2015-06-13 01:03:31 +02:00
|
|
|
varbuf_end_str(&symlinkfn);
|
|
|
|
if (symlink(symlinkfn.buf,fnametmpvb.buf))
|
2015-08-26 00:25:24 +02:00
|
|
|
ohshite(_("unable to make backup symlink for '%.255s'"), ti->name);
|
2015-06-13 01:03:31 +02:00
|
|
|
+#ifndef __ANDROID__
|
|
|
|
if (lchown(fnametmpvb.buf,stab.st_uid,stab.st_gid))
|
2015-08-26 00:25:24 +02:00
|
|
|
ohshite(_("unable to chown backup symlink for '%.255s'"), ti->name);
|
2015-06-13 01:03:31 +02:00
|
|
|
+#endif
|
|
|
|
tarobject_set_se_context(fnamevb.buf, fnametmpvb.buf, stab.st_mode);
|
|
|
|
} else {
|
|
|
|
debug(dbg_eachfiledetail, "tarobject nondirectory, 'link' backup");
|
2016-11-26 01:56:24 +01:00
|
|
|
+#ifdef __ANDROID__
|
|
|
|
+ /* Android does not support hardlinks. */
|
|
|
|
+ if (rename(fnamevb.buf,fnametmpvb.buf))
|
|
|
|
+#else
|
2015-07-10 03:04:45 +02:00
|
|
|
if (link(fnamevb.buf,fnametmpvb.buf))
|
2016-11-26 01:56:24 +01:00
|
|
|
+#endif
|
|
|
|
ohshite(_("unable to make backup link of '%.255s' before installing new version"),
|
|
|
|
ti->name);
|
2015-07-10 03:04:45 +02:00
|
|
|
}
|