util-linux: fix utility 'losetup'

On Android loop devices located under /dev/block/.
This commit is contained in:
Leonid Pliushch 2019-07-23 19:30:29 +03:00
parent 766e9ca178
commit 09c93a5257
2 changed files with 100 additions and 43 deletions

View File

@ -2,6 +2,7 @@ TERMUX_PKG_HOMEPAGE=https://en.wikipedia.org/wiki/Util-linux
TERMUX_PKG_DESCRIPTION="Miscellaneous system utilities"
TERMUX_PKG_LICENSE="GPL-2.0"
TERMUX_PKG_VERSION=2.34
TERMUX_PKG_REVISION=1
TERMUX_PKG_SRCURL=https://www.kernel.org/pub/linux/utils/util-linux/v${TERMUX_PKG_VERSION:0:4}/util-linux-${TERMUX_PKG_VERSION}.tar.xz
TERMUX_PKG_SHA256=743f9d0c7252b6db246b659c1e1ce0bd45d8d4508b4dfa427bbb4a3e9b9f62b5
TERMUX_PKG_DEPENDS="ncurses, libcrypt, zlib"

View File

@ -1,6 +1,6 @@
diff -uNr util-linux-2.34/include/pathnames.h util-linux-2.34.mod/include/pathnames.h
--- util-linux-2.34/include/pathnames.h 2019-06-06 13:38:50.260626816 +0300
+++ util-linux-2.34.mod/include/pathnames.h 2019-07-23 17:41:33.987363668 +0300
+++ util-linux-2.34.mod/include/pathnames.h 2019-07-23 19:16:35.307804770 +0300
@@ -198,4 +198,105 @@
#define _PATH_DEV_RFKILL "/dev/rfkill"
#define _PATH_SYS_RFKILL "/sys/class/rfkill"
@ -109,7 +109,7 @@ diff -uNr util-linux-2.34/include/pathnames.h util-linux-2.34.mod/include/pathna
#endif /* PATHNAMES_H */
diff -uNr util-linux-2.34/lib/exec_shell.c util-linux-2.34.mod/lib/exec_shell.c
--- util-linux-2.34/lib/exec_shell.c 2018-09-20 15:38:55.851404915 +0300
+++ util-linux-2.34.mod/lib/exec_shell.c 2019-07-23 16:55:28.498453815 +0300
+++ util-linux-2.34.mod/lib/exec_shell.c 2019-07-23 19:16:35.311138086 +0300
@@ -28,7 +28,7 @@
#include "exec_shell.h"
@ -119,9 +119,29 @@ diff -uNr util-linux-2.34/lib/exec_shell.c util-linux-2.34.mod/lib/exec_shell.c
void __attribute__((__noreturn__)) exec_shell(void)
{
diff -uNr util-linux-2.34/lib/loopdev.c util-linux-2.34.mod/lib/loopdev.c
--- util-linux-2.34/lib/loopdev.c 2019-05-20 13:45:59.297373891 +0300
+++ util-linux-2.34.mod/lib/loopdev.c 2019-07-23 19:24:27.259011794 +0300
@@ -105,13 +105,13 @@
/* set new */
if (device) {
if (*device != '/') {
- const char *dir = _PATH_DEV;
+ const char *dir = _PATH_DEV "block/";
/* compose device name for /dev/loop<n> or /dev/loop/<n> */
if (lc->flags & LOOPDEV_FL_DEVSUBDIR) {
- if (strlen(device) < 5)
+ if (strlen(device) < 11)
return -1;
- device += 4;
+ device += 10;
dir = _PATH_DEV_LOOP "/"; /* _PATH_DEV uses tailing slash */
}
snprintf(lc->device, sizeof(lc->device), "%s%s",
diff -uNr util-linux-2.34/libblkid/src/blkidP.h util-linux-2.34.mod/libblkid/src/blkidP.h
--- util-linux-2.34/libblkid/src/blkidP.h 2019-04-10 14:28:20.589837335 +0300
+++ util-linux-2.34.mod/libblkid/src/blkidP.h 2019-07-23 16:55:28.498453815 +0300
+++ util-linux-2.34.mod/libblkid/src/blkidP.h 2019-07-23 19:16:35.311138086 +0300
@@ -286,7 +286,7 @@
#define BLKID_BIC_FL_CHANGED 0x0004 /* Cache has changed from disk */
@ -142,7 +162,7 @@ diff -uNr util-linux-2.34/libblkid/src/blkidP.h util-linux-2.34.mod/libblkid/src
#define BLKID_PROBE_NONE 1
diff -uNr util-linux-2.34/libblkid/src/topology/dm.c util-linux-2.34.mod/libblkid/src/topology/dm.c
--- util-linux-2.34/libblkid/src/topology/dm.c 2019-02-22 12:17:43.709854171 +0200
+++ util-linux-2.34.mod/libblkid/src/topology/dm.c 2019-07-23 16:55:28.498453815 +0300
+++ util-linux-2.34.mod/libblkid/src/topology/dm.c 2019-07-23 19:16:35.311138086 +0300
@@ -30,9 +30,8 @@
const struct blkid_idmag *mag __attribute__((__unused__)))
{
@ -157,7 +177,7 @@ diff -uNr util-linux-2.34/libblkid/src/topology/dm.c util-linux-2.34.mod/libblki
const char *cmd = NULL;
diff -uNr util-linux-2.34/libblkid/src/topology/lvm.c util-linux-2.34.mod/libblkid/src/topology/lvm.c
--- util-linux-2.34/libblkid/src/topology/lvm.c 2017-09-18 12:48:03.563891490 +0300
+++ util-linux-2.34.mod/libblkid/src/topology/lvm.c 2019-07-23 16:55:28.498453815 +0300
+++ util-linux-2.34.mod/libblkid/src/topology/lvm.c 2019-07-23 19:16:35.311138086 +0300
@@ -36,9 +36,8 @@
const struct blkid_idmag *mag __attribute__((__unused__)))
{
@ -170,9 +190,45 @@ diff -uNr util-linux-2.34/libblkid/src/topology/lvm.c util-linux-2.34.mod/libblk
};
int lvpipe[] = { -1, -1 }, stripes = 0, stripesize = 0;
FILE *stream = NULL;
diff -uNr util-linux-2.34/libmount/src/cache.c util-linux-2.34.mod/libmount/src/cache.c
--- util-linux-2.34/libmount/src/cache.c 2019-02-22 12:17:43.714854129 +0200
+++ util-linux-2.34.mod/libmount/src/cache.c 2019-07-23 19:21:32.059762352 +0300
@@ -632,7 +632,7 @@
/* users assume backing file name rather than /dev/loopN in
* output if the device has been initialized by mount(8).
*/
- if (strncmp(pretty, "/dev/loop", 9) == 0) {
+ if (strncmp(pretty, "/dev/block/loop", 15) == 0) {
struct loopdev_cxt lc;
if (loopcxt_init(&lc, 0) || loopcxt_set_device(&lc, pretty))
diff -uNr util-linux-2.34/libmount/src/context_loopdev.c util-linux-2.34.mod/libmount/src/context_loopdev.c
--- util-linux-2.34/libmount/src/context_loopdev.c 2019-02-22 12:17:43.715854121 +0200
+++ util-linux-2.34.mod/libmount/src/context_loopdev.c 2019-07-23 19:19:49.540220036 +0300
@@ -129,7 +129,7 @@
rc = 0;
- if (strncmp(src, "/dev/loop", 9) == 0) {
+ if (strncmp(src, "/dev/block/loop", 15) == 0) {
rc = loopdev_is_used((char *) src, bf, offset, 0, LOOPDEV_FL_OFFSET);
} else if (opts && (cxt->user_mountflags & MNT_MS_LOOP) &&
diff -uNr util-linux-2.34/libmount/src/tab.c util-linux-2.34.mod/libmount/src/tab.c
--- util-linux-2.34/libmount/src/tab.c 2019-06-13 14:26:04.945525193 +0300
+++ util-linux-2.34.mod/libmount/src/tab.c 2019-07-23 19:20:49.923281905 +0300
@@ -1758,7 +1758,7 @@
int flags = 0;
if (!mnt_fs_get_srcpath(fs) ||
- !startswith(mnt_fs_get_srcpath(fs), "/dev/loop"))
+ !startswith(mnt_fs_get_srcpath(fs), "/dev/block/loop"))
continue; /* does not look like loopdev */
if (mnt_fs_get_option(fstab_fs, "offset", &val, &len) == 0) {
diff -uNr util-linux-2.34/libuuid/src/uuidd.h util-linux-2.34.mod/libuuid/src/uuidd.h
--- util-linux-2.34/libuuid/src/uuidd.h 2018-06-04 10:57:02.806445781 +0300
+++ util-linux-2.34.mod/libuuid/src/uuidd.h 2019-07-23 16:55:28.498453815 +0300
+++ util-linux-2.34.mod/libuuid/src/uuidd.h 2019-07-23 19:16:35.311138086 +0300
@@ -38,7 +38,7 @@
#define UUIDD_DIR _PATH_RUNSTATEDIR "/uuidd"
#define UUIDD_SOCKET_PATH UUIDD_DIR "/request"
@ -184,7 +240,7 @@ diff -uNr util-linux-2.34/libuuid/src/uuidd.h util-linux-2.34.mod/libuuid/src/uu
#define UUIDD_OP_GET_MAXOP 1
diff -uNr util-linux-2.34/libuuid/src/uuidP.h util-linux-2.34.mod/libuuid/src/uuidP.h
--- util-linux-2.34/libuuid/src/uuidP.h 2019-02-22 12:17:43.722854062 +0200
+++ util-linux-2.34.mod/libuuid/src/uuidP.h 2019-07-23 16:55:28.498453815 +0300
+++ util-linux-2.34.mod/libuuid/src/uuidP.h 2019-07-23 19:16:35.311138086 +0300
@@ -37,7 +37,7 @@
#include "uuid.h"
@ -196,7 +252,7 @@ diff -uNr util-linux-2.34/libuuid/src/uuidP.h util-linux-2.34.mod/libuuid/src/uu
* Offset between 15-Oct-1582 and 1-Jan-70
diff -uNr util-linux-2.34/login-utils/login.c util-linux-2.34.mod/login-utils/login.c
--- util-linux-2.34/login-utils/login.c 2019-05-27 12:53:09.756205982 +0300
+++ util-linux-2.34.mod/login-utils/login.c 2019-07-23 16:55:28.501787205 +0300
+++ util-linux-2.34.mod/login-utils/login.c 2019-07-23 19:16:35.311138086 +0300
@@ -1359,7 +1359,7 @@
strcpy(buff, "exec ");
@ -217,7 +273,7 @@ diff -uNr util-linux-2.34/login-utils/login.c util-linux-2.34.mod/login-utils/lo
warn(_("no shell"));
diff -uNr util-linux-2.34/login-utils/su-common.c util-linux-2.34.mod/login-utils/su-common.c
--- util-linux-2.34/login-utils/su-common.c 2019-04-24 13:44:31.858967658 +0300
+++ util-linux-2.34.mod/login-utils/su-common.c 2019-07-23 16:55:28.501787205 +0300
+++ util-linux-2.34.mod/login-utils/su-common.c 2019-07-23 19:16:35.314471404 +0300
@@ -96,7 +96,7 @@
#define is_pam_failure(_rc) ((_rc) != PAM_SUCCESS)
@ -229,7 +285,7 @@ diff -uNr util-linux-2.34/login-utils/su-common.c util-linux-2.34.mod/login-util
#define DEFAULT_USER "root"
diff -uNr util-linux-2.34/login-utils/sulogin.c util-linux-2.34.mod/login-utils/sulogin.c
--- util-linux-2.34/login-utils/sulogin.c 2019-05-20 13:35:38.631791539 +0300
+++ util-linux-2.34.mod/login-utils/sulogin.c 2019-07-23 16:55:28.501787205 +0300
+++ util-linux-2.34.mod/login-utils/sulogin.c 2019-07-23 19:16:35.314471404 +0300
@@ -743,7 +743,7 @@
if (pwd->pw_shell[0])
su_shell = pwd->pw_shell;
@ -254,7 +310,7 @@ diff -uNr util-linux-2.34/login-utils/sulogin.c util-linux-2.34.mod/login-utils/
static void usage(void)
diff -uNr util-linux-2.34/misc-utils/whereis.c util-linux-2.34.mod/misc-utils/whereis.c
--- util-linux-2.34/misc-utils/whereis.c 2019-05-23 14:51:09.593338063 +0300
+++ util-linux-2.34.mod/misc-utils/whereis.c 2019-07-23 16:55:28.501787205 +0300
+++ util-linux-2.34.mod/misc-utils/whereis.c 2019-07-23 19:16:35.314471404 +0300
@@ -97,82 +97,21 @@
};
@ -347,7 +403,7 @@ diff -uNr util-linux-2.34/misc-utils/whereis.c util-linux-2.34.mod/misc-utils/wh
diff -uNr util-linux-2.34/sys-utils/setarch.c util-linux-2.34.mod/sys-utils/setarch.c
--- util-linux-2.34/sys-utils/setarch.c 2019-05-28 14:07:37.094903856 +0300
+++ util-linux-2.34.mod/sys-utils/setarch.c 2019-07-23 16:55:28.501787205 +0300
+++ util-linux-2.34.mod/sys-utils/setarch.c 2019-07-23 19:16:35.314471404 +0300
@@ -328,7 +328,7 @@
/* Don't use ifdef sparc here, we get "Unrecognized architecture"
* error message later if necessary */
@ -368,7 +424,7 @@ diff -uNr util-linux-2.34/sys-utils/setarch.c util-linux-2.34.mod/sys-utils/seta
if (verbose) {
diff -uNr util-linux-2.34/sys-utils/setpriv.c util-linux-2.34.mod/sys-utils/setpriv.c
--- util-linux-2.34/sys-utils/setpriv.c 2019-05-28 14:10:54.998680500 +0300
+++ util-linux-2.34.mod/sys-utils/setpriv.c 2019-07-23 16:55:28.505120594 +0300
+++ util-linux-2.34.mod/sys-utils/setpriv.c 2019-07-23 19:16:35.314471404 +0300
@@ -58,7 +58,7 @@
#define SETPRIV_EXIT_PRIVERR 127 /* how we exit when we fail to set privs */
@ -380,7 +436,7 @@ diff -uNr util-linux-2.34/sys-utils/setpriv.c util-linux-2.34.mod/sys-utils/setp
diff -uNr util-linux-2.34/text-utils/more.c util-linux-2.34.mod/text-utils/more.c
--- util-linux-2.34/text-utils/more.c 2019-04-24 12:02:03.133448736 +0300
+++ util-linux-2.34.mod/text-utils/more.c 2019-07-23 16:55:28.505120594 +0300
+++ util-linux-2.34.mod/text-utils/more.c 2019-07-23 19:16:35.314471404 +0300
@@ -1877,7 +1877,7 @@
}
@ -392,7 +448,7 @@ diff -uNr util-linux-2.34/text-utils/more.c util-linux-2.34.mod/text-utils/more.
tcgetattr(STDERR_FILENO, &ctl->output_tty);
diff -uNr util-linux-2.34/text-utils/pg.c util-linux-2.34.mod/text-utils/pg.c
--- util-linux-2.34/text-utils/pg.c 2019-04-24 12:02:03.133448736 +0300
+++ util-linux-2.34.mod/text-utils/pg.c 2019-07-23 16:55:28.505120594 +0300
+++ util-linux-2.34.mod/text-utils/pg.c 2019-07-23 19:16:35.317804721 +0300
@@ -1365,7 +1365,7 @@
{
const char *sh = getenv("SHELL");