Browse Source

dpkg: Do not even try hardlinking

Avoiding the hardlink try reduces log spam.
android-5
Fredrik Fornwall 8 years ago
parent
commit
2fd44a0f30
  1. 28
      packages/dpkg/src-archives.c.patch

28
packages/dpkg/src-archives.c.patch

@ -1,7 +1,7 @@
diff -u -r ../dpkg-1.18.2/src/archives.c ./src/archives.c diff -u -r ../dpkg-1.18.10/src/archives.c ./src/archives.c
--- ../dpkg-1.18.2/src/archives.c 2015-07-13 09:53:37.000000000 -0400 --- ../dpkg-1.18.10/src/archives.c 2016-07-07 19:36:47.000000000 -0400
+++ ./src/archives.c 2015-08-25 17:59:35.594992908 -0400 +++ ./src/archives.c 2016-11-25 18:32:58.505875297 -0500
@@ -352,8 +352,10 @@ @@ -393,8 +393,10 @@
namenode->statoverride->uid, namenode->statoverride->uid,
namenode->statoverride->gid, namenode->statoverride->gid,
namenode->statoverride->mode); namenode->statoverride->mode);
@ -12,7 +12,7 @@ diff -u -r ../dpkg-1.18.2/src/archives.c ./src/archives.c
if (fchmod(fd, st->mode & ~S_IFMT)) if (fchmod(fd, st->mode & ~S_IFMT))
ohshite(_("error setting permissions of '%.255s'"), te->name); ohshite(_("error setting permissions of '%.255s'"), te->name);
@@ -465,11 +467,15 @@ @@ -506,11 +508,15 @@
return; /* Already handled using the file descriptor. */ return; /* Already handled using the file descriptor. */
if (te->type == TAR_FILETYPE_SYMLINK) { if (te->type == TAR_FILETYPE_SYMLINK) {
@ -28,7 +28,7 @@ diff -u -r ../dpkg-1.18.2/src/archives.c ./src/archives.c
if (chmod(path, st->mode & ~S_IFMT)) if (chmod(path, st->mode & ~S_IFMT))
ohshite(_("error setting permissions of '%.255s'"), path); ohshite(_("error setting permissions of '%.255s'"), path);
} }
@@ -1022,14 +1028,19 @@ @@ -1040,12 +1051,19 @@
varbuf_end_str(&symlinkfn); varbuf_end_str(&symlinkfn);
if (symlink(symlinkfn.buf,fnametmpvb.buf)) if (symlink(symlinkfn.buf,fnametmpvb.buf))
ohshite(_("unable to make backup symlink for '%.255s'"), ti->name); ohshite(_("unable to make backup symlink for '%.255s'"), ti->name);
@ -39,14 +39,12 @@ diff -u -r ../dpkg-1.18.2/src/archives.c ./src/archives.c
tarobject_set_se_context(fnamevb.buf, fnametmpvb.buf, stab.st_mode); tarobject_set_se_context(fnamevb.buf, fnametmpvb.buf, stab.st_mode);
} else { } else {
debug(dbg_eachfiledetail, "tarobject nondirectory, 'link' backup"); debug(dbg_eachfiledetail, "tarobject nondirectory, 'link' backup");
+ /* Termux modification: Try with rename(2) for systems not supporting hardlinks. */ +#ifdef __ANDROID__
+ /* Android does not support hardlinks. */
+ if (rename(fnamevb.buf,fnametmpvb.buf))
+#else
if (link(fnamevb.buf,fnametmpvb.buf)) if (link(fnamevb.buf,fnametmpvb.buf))
- ohshite(_("unable to make backup link of '%.255s' before installing new version"), +#endif
- ti->name); ohshite(_("unable to make backup link of '%.255s' before installing new version"),
+ if (rename(fnamevb.buf,fnametmpvb.buf)) { ti->name);
+ ohshite(_("unable to make backup link of '%.255s' before installing new version"),
+ ti->name);
+ }
} }
}

Loading…
Cancel
Save