chiark / gitweb /
dpkg: Work around symbolic link size issue
[termux-packages] / packages / dpkg / src-configure.c.patch
1 diff -u -r ../dpkg-1.18.15/src/configure.c ./src/configure.c
2 --- ../dpkg-1.18.15/src/configure.c     2016-11-11 22:18:40.000000000 -0500
3 +++ ./src/configure.c   2016-12-03 16:32:43.719508056 -0500
4 @@ -497,8 +497,10 @@
5                                 pkg_name(pkg, pnaw_nonambig), cdr2.buf,
6                                 strerror(errno));
7                 if (!(what & CFOF_USER_DEL))
8 -                       if (link(cdr.buf, cdr2.buf))
9 -                               warning(_("%s: failed to link '%.250s' to '%.250s': %s"),
10 +                       /** Termux modification: Use rename(2) instead of link(2), to avoid hard
11 +                           links which does not work on Android 6.0 or later. */
12 +                       if (rename(cdr.buf, cdr2.buf))
13 +                               warning(_("%s: failed to rename '%.250s' to '%.250s': %s"),
14                                         pkg_name(pkg, pnaw_nonambig), cdr.buf,
15                                         cdr2.buf, strerror(errno));
16                 /* Fall through. */
17 @@ -757,7 +759,9 @@
18                                         pkg_name(pkg, pnaw_nonambig), in,
19                                         result->buf, strerror(errno));
20                                 return -1;
21 -                       } else if (r != stab.st_size) {
22 +                       } else if (r > stab.st_size) {
23 +                               /* Termux patch: In some cases st_size is too large, ignore that.
24 +                                  See https://github.com/corbinlc/GNURootDebian/issues/103 */
25                                 warning(_("symbolic link '%.250s' size has "
26                                           "changed from %jd to %zd"),
27                                         result->buf, (intmax_t)stab.st_size, r);