# --- T2-COPYRIGHT-NOTE-BEGIN --- # T2 SDE: package/*/mine/short-reads.patch # Copyright (C) 2021 The T2 SDE Project # # This Copyright note is generated by scripts/Create-CopyPatch, # more information can be found in the files COPYING and README. # # This patch file is dual-licensed. It is available under the license the # patched project is licensed under, as long as it is an OpenSource license # as defined at http://www.opensource.org/ (e.g. BSD, X11) or under the terms # of the GNU General Public License version 2 as used by the T2 SDE. # --- T2-COPYRIGHT-NOTE-END --- Musl returns short reads for pipes, so deal with that. Also increase the buffer size to 4k for a little better performance while at it. --- mine-0.23/install.c.vanilla 2021-10-15 22:38:22.519423662 +0200 +++ mine-0.23/install.c 2021-10-15 22:51:39.237464764 +0200 @@ -60,7 +60,7 @@ char *filename = 0; char *decompressor = 0; - char buffer[1024]; + char buffer[4*1024]; char buffer2[1024]; char buffer3[1024]; TAR *t = NULL; @@ -183,7 +183,7 @@ if ( ! mode_force ) md5sum_initdb(root, mode_verbose); - if (tar_fdopen(&t, bunzip2tar[0], "pipe", NULL, + if (tar_fdopen(&t, bunzip2tar[0], "-", NULL, O_RDONLY, 0, 0) == -1) goto error_errno; if ( mode_test && mode_verbose ) printf("-- %s --\n", pname); --- mine-0.23/libtar-1.2.11/lib/handle.c.vanilla 2021-10-15 23:47:57.270639034 +0200 +++ mine-0.23/libtar-1.2.11/lib/handle.c 2021-10-15 23:55:00.511660869 +0200 @@ -27,7 +27,23 @@ const char libtar_version[] = PACKAGE_VERSION; -static tartype_t default_type = { open, close, read, write }; +ssize_t readfn(int fd, void* _buf, size_t n) { + char* buf = (char*)_buf; + ssize_t off = 0, ret; + while (off < n) { + ret = read(fd, buf + off, n - off); + if (ret > 0) { + off += ret; + } else { + if (off == 0) + off = ret; + break; + } + } + return off; +} + +static tartype_t default_type = { open, close, readfn, write }; static int