]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
Merge branch 'evelu-epyc' of https://github.com/ErwanAliasr1/util-linux
authorKarel Zak <kzak@redhat.com>
Mon, 4 Mar 2019 10:46:16 +0000 (11:46 +0100)
committerKarel Zak <kzak@redhat.com>
Mon, 4 Mar 2019 10:46:16 +0000 (11:46 +0100)
* 'evelu-epyc' of https://github.com/ErwanAliasr1/util-linux:
  test: Adding AMD EPYC 7451 24-Core Processor

20 files changed:
disk-utils/blockdev.8
libmount/src/utils.c
login-utils/last.c
term-utils/agetty.c
tests/expected/fdisk/mbr-nondos-mode [deleted file]
tests/expected/fdisk/mbr-nondos-mode-1nd-primary-delete [new file with mode: 0644]
tests/expected/fdisk/mbr-nondos-mode-1st-active [new file with mode: 0644]
tests/expected/fdisk/mbr-nondos-mode-1st-primary [new file with mode: 0644]
tests/expected/fdisk/mbr-nondos-mode-1st-primary-delete [new file with mode: 0644]
tests/expected/fdisk/mbr-nondos-mode-1st-primary-recreate [new file with mode: 0644]
tests/expected/fdisk/mbr-nondos-mode-2nd-primary [new file with mode: 0644]
tests/expected/fdisk/mbr-nondos-mode-empty-pt [new file with mode: 0644]
tests/expected/fdisk/mbr-nondos-mode-extended [new file with mode: 0644]
tests/expected/fdisk/mbr-nondos-mode-extended-delete [new file with mode: 0644]
tests/expected/fdisk/mbr-nondos-mode-first-sector-at-end [new file with mode: 0644]
tests/expected/fdisk/mbr-nondos-mode-logical [new file with mode: 0644]
tests/expected/fdisk/mbr-nondos-mode-logical-delete [new file with mode: 0644]
tests/expected/fdisk/mbr-nondos-mode-logical-recreate [new file with mode: 0644]
tests/ts/fdisk/mbr-nondos-mode
tests/ts/misc/mbsencode

index fb0060638204a249dd7a38390b2dd8ca4c66d7d5..5d85c01b791aec97e5a2b6d0873f16254054d792 100644 (file)
@@ -44,7 +44,9 @@ Flush buffers.
 .IP "\fB\-\-getalignoff\fP"
 Get alignment offset.
 .IP "\fB\-\-getbsz\fP"
-Print blocksize in bytes.
+Print blocksize in bytes.  This size does not describe device topology.  It's
+size used internally by kernel and it maybe modified (for example) by
+filesystem driver on mount.
 .IP "\fB\-\-getdiscardzeroes\fP"
 Get discard zeroes support status.
 .IP "\fB\-\-getfra\fP"
index 6d88717176e06d30c49afd169239405721b6edb8..7f6cc1405d0cfb2b2e579369ba44810d696a67e3 100644 (file)
@@ -283,7 +283,14 @@ int mnt_fstype_is_pseudofs(const char *type)
                "devtmpfs",
                "dlmfs",
                "efivarfs",
-               "fuse.gvfs-fuse-daemon",
+               "fuse", /* Fallback name of fuse used by many poorly written drivers. */
+               "fuse.archivemount", /* Not a true pseudofs (has source), but source is not reported. */
+               "fuse.dumpfs", /* In fact, it is a netfs, but source is not reported. */
+               "fuse.encfs", /* Not a true pseudofs (has source), but source is not reported. */
+               "fuse.gvfs-fuse-daemon", /* Old name, not used by gvfs any more. */
+               "fuse.gvfsd-fuse",
+               "fuse.rofiles-fuse",
+               "fuse.xwmfs",
                "fusectl",
                "hugetlbfs",
                "mqueue",
@@ -323,6 +330,8 @@ int mnt_fstype_is_netfs(const char *type)
            strncmp(type,"nfs", 3) == 0 ||
            strcmp(type, "afs")    == 0 ||
            strcmp(type, "ncpfs")  == 0 ||
+           strcmp(type, "fuse.curlftpfs") == 0 ||
+           strcmp(type, "fuse.sshfs") == 0 ||
            strncmp(type,"9p", 2)  == 0)
                return 1;
        return 0;
index be744b079198ecf11ba05eed990c5f942bca18c0..303adeacd8988255ebf1275cf40de0d4bdd8561f 100644 (file)
@@ -600,7 +600,7 @@ static int is_phantom(const struct last_control *ctl, struct utmpx *ut)
 
        if (ut->ut_tv.tv_sec < ctl->boot_time.tv_sec)
                return 1;
-       ut->ut_user[__UT_NAMESIZE - 1] = '\0';
+       ut->ut_user[sizeof(ut->ut_user) - 1] = '\0';
        pw = getpwnam(ut->ut_user);
        if (!pw)
                return 1;
index 1a3ebc308f4ef2bf7314980b24971b137d348c98..43dbd6deadb64d07f380bf0bc43a118a90aebd7d 100644 (file)
@@ -2059,7 +2059,7 @@ static char *get_logname(struct issue *ie, struct options *op, struct termios *t
                sleep(1);
        tcflush(STDIN_FILENO, TCIFLUSH);
 
-       eightbit = (op->flags & F_EIGHTBITS);
+       eightbit = (op->flags & (F_EIGHTBITS|F_UTF8));
        bp = logname;
        *bp = '\0';
 
@@ -2175,8 +2175,6 @@ static char *get_logname(struct issue *ie, struct options *op, struct termios *t
                        case CTL('D'):
                                exit(EXIT_SUCCESS);
                        default:
-                               if (!isascii(ascval) || !isprint(ascval))
-                                       break;
                                if ((size_t)(bp - logname) >= sizeof(logname) - 1)
                                        log_err(_("%s: input overrun"), op->tty);
                                if ((tp->c_lflag & ECHO) == 0)
diff --git a/tests/expected/fdisk/mbr-nondos-mode b/tests/expected/fdisk/mbr-nondos-mode
deleted file mode 100644 (file)
index 8833baa..0000000
+++ /dev/null
@@ -1,203 +0,0 @@
-Initialize empty image
-8f4e33f3dc3e414ff94e5fb6905cba8c mbr-nondos-mode.img
-Create new DOS partition table
-4e23561dcb81678bb1bd678722c7cbb7 mbr-nondos-mode.img
-
----layout----------
-Disk <removed>: 20 MiB, 20971520 bytes, 40960 sectors
-Units: sectors of 1 * 512 = 512 bytes
-Sector size (logical/physical): 512 bytes / 512 bytes
-I/O size (minimum/optimal): 512 bytes / <removed> bytes
-Disklabel type: dos
-Disk identifier: <removed>
--------------------
-
-Create 1st primary partition
-e21e16b7452d82e2a2810a1de8c3db05 mbr-nondos-mode.img
-
----layout----------
-Disk <removed>: 20 MiB, 20971520 bytes, 40960 sectors
-Units: sectors of 1 * 512 = 512 bytes
-Sector size (logical/physical): 512 bytes / 512 bytes
-I/O size (minimum/optimal): 512 bytes / <removed> bytes
-Disklabel type: dos
-Disk identifier: <removed>
-
-Device     Boot Start   End Sectors Size Id Type
-<removed>1       2048  8191    6144   3M 83 Linux
--------------------
-
-Set primary partition active
-47f024f3b406598a0159400af7382e2c mbr-nondos-mode.img
-
----layout----------
-Disk <removed>: 20 MiB, 20971520 bytes, 40960 sectors
-Units: sectors of 1 * 512 = 512 bytes
-Sector size (logical/physical): 512 bytes / 512 bytes
-I/O size (minimum/optimal): 512 bytes / <removed> bytes
-Disklabel type: dos
-Disk identifier: <removed>
-
-Device     Boot Start   End Sectors Size Id Type
-<removed>1 *     2048  8191    6144   3M 83 Linux
--------------------
-
-Re-create 1st primary partition
-a5543ee1e3d2cf79913a56bae893a0f0 mbr-nondos-mode.img
-
----layout----------
-Disk <removed>: 20 MiB, 20971520 bytes, 40960 sectors
-Units: sectors of 1 * 512 = 512 bytes
-Sector size (logical/physical): 512 bytes / 512 bytes
-I/O size (minimum/optimal): 512 bytes / <removed> bytes
-Disklabel type: dos
-Disk identifier: <removed>
-
-Device     Boot Start   End Sectors Size Id Type
-<removed>1       2048  8191    6144   3M 83 Linux
--------------------
-
-Create 2nd primary partition
-9d31ee977e26e72ebce78e8e543cd4ce mbr-nondos-mode.img
-
----layout----------
-Disk <removed>: 20 MiB, 20971520 bytes, 40960 sectors
-Units: sectors of 1 * 512 = 512 bytes
-Sector size (logical/physical): 512 bytes / 512 bytes
-I/O size (minimum/optimal): 512 bytes / <removed> bytes
-Disklabel type: dos
-Disk identifier: <removed>
-
-Device     Boot Start   End Sectors Size Id Type
-<removed>1       2048  8191    6144   3M 83 Linux
-<removed>2       8192 12287    4096   2M 83 Linux
--------------------
-
-Create extended partition
-9528631b198e44564f67f8ca97fa51b8 mbr-nondos-mode.img
-
----layout----------
-Disk <removed>: 20 MiB, 20971520 bytes, 40960 sectors
-Units: sectors of 1 * 512 = 512 bytes
-Sector size (logical/physical): 512 bytes / 512 bytes
-I/O size (minimum/optimal): 512 bytes / <removed> bytes
-Disklabel type: dos
-Disk identifier: <removed>
-
-Device     Boot Start   End Sectors Size Id Type
-<removed>1       2048  8191    6144   3M 83 Linux
-<removed>2       8192 12287    4096   2M 83 Linux
-<removed>3      12288 40959   28672  14M  5 Extended
--------------------
-
-Create logical partitions
-db4406e7bc0773f234fd1db1b58b5997 mbr-nondos-mode.img
-
----layout----------
-Disk <removed>: 20 MiB, 20971520 bytes, 40960 sectors
-Units: sectors of 1 * 512 = 512 bytes
-Sector size (logical/physical): 512 bytes / 512 bytes
-I/O size (minimum/optimal): 512 bytes / <removed> bytes
-Disklabel type: dos
-Disk identifier: <removed>
-
-Device     Boot Start   End Sectors Size Id Type
-<removed>1       2048  8191    6144   3M 83 Linux
-<removed>2       8192 12287    4096   2M 83 Linux
-<removed>3      12288 40959   28672  14M  5 Extended
-<removed>5      14336 18431    4096   2M 83 Linux
-<removed>6      20480 24575    4096   2M 83 Linux
-<removed>7      26624 30719    4096   2M 83 Linux
-<removed>8      32768 36863    4096   2M 83 Linux
--------------------
-
-Delete logical partitions
-de85b8d74f52f307b9467ea4c33438cb mbr-nondos-mode.img
-
----layout----------
-Disk <removed>: 20 MiB, 20971520 bytes, 40960 sectors
-Units: sectors of 1 * 512 = 512 bytes
-Sector size (logical/physical): 512 bytes / 512 bytes
-I/O size (minimum/optimal): 512 bytes / <removed> bytes
-Disklabel type: dos
-Disk identifier: <removed>
-
-Device     Boot Start   End Sectors Size Id Type
-<removed>1       2048  8191    6144   3M 83 Linux
-<removed>2       8192 12287    4096   2M 83 Linux
-<removed>3      12288 40959   28672  14M  5 Extended
-<removed>5      26624 30719    4096   2M 83 Linux
--------------------
-
-Create another logical partition
-28d0cbe795535ee025dc7a4781516965 mbr-nondos-mode.img
-
----layout----------
-Disk <removed>: 20 MiB, 20971520 bytes, 40960 sectors
-Units: sectors of 1 * 512 = 512 bytes
-Sector size (logical/physical): 512 bytes / 512 bytes
-I/O size (minimum/optimal): 512 bytes / <removed> bytes
-Disklabel type: dos
-Disk identifier: <removed>
-
-Device     Boot Start   End Sectors Size Id Type
-<removed>1       2048  8191    6144   3M 83 Linux
-<removed>2       8192 12287    4096   2M 83 Linux
-<removed>3      12288 40959   28672  14M  5 Extended
-<removed>5      26624 30719    4096   2M 83 Linux
-<removed>6      14336 18431    4096   2M 83 Linux
-
-Partition table entries are not in disk order.
--------------------
-
-Delete primary partition
-6f1b62718cf8d83602d51de8944cee51 mbr-nondos-mode.img
-
----layout----------
-Disk <removed>: 20 MiB, 20971520 bytes, 40960 sectors
-Units: sectors of 1 * 512 = 512 bytes
-Sector size (logical/physical): 512 bytes / 512 bytes
-I/O size (minimum/optimal): 512 bytes / <removed> bytes
-Disklabel type: dos
-Disk identifier: <removed>
-
-Device     Boot Start   End Sectors Size Id Type
-<removed>2       8192 12287    4096   2M 83 Linux
-<removed>3      12288 40959   28672  14M  5 Extended
-<removed>5      26624 30719    4096   2M 83 Linux
-<removed>6      14336 18431    4096   2M 83 Linux
-
-Partition table entries are not in disk order.
--------------------
-
-Delete primary partition
-7b29a3cda33e990e8a7877b81988b933 mbr-nondos-mode.img
-
----layout----------
-Disk <removed>: 20 MiB, 20971520 bytes, 40960 sectors
-Units: sectors of 1 * 512 = 512 bytes
-Sector size (logical/physical): 512 bytes / 512 bytes
-I/O size (minimum/optimal): 512 bytes / <removed> bytes
-Disklabel type: dos
-Disk identifier: <removed>
-
-Device     Boot Start   End Sectors Size Id Type
-<removed>3      12288 40959   28672  14M  5 Extended
-<removed>5      26624 30719    4096   2M 83 Linux
-<removed>6      14336 18431    4096   2M 83 Linux
-
-Partition table entries are not in disk order.
--------------------
-
-Delete extended partition
-e1ef48d3d42f4ebcfd5bf4baf5e370e9 mbr-nondos-mode.img
-
----layout----------
-Disk <removed>: 20 MiB, 20971520 bytes, 40960 sectors
-Units: sectors of 1 * 512 = 512 bytes
-Sector size (logical/physical): 512 bytes / 512 bytes
-I/O size (minimum/optimal): 512 bytes / <removed> bytes
-Disklabel type: dos
-Disk identifier: <removed>
--------------------
-
diff --git a/tests/expected/fdisk/mbr-nondos-mode-1nd-primary-delete b/tests/expected/fdisk/mbr-nondos-mode-1nd-primary-delete
new file mode 100644 (file)
index 0000000..cc5e1f0
--- /dev/null
@@ -0,0 +1,19 @@
+Delete primary partition
+7b29a3cda33e990e8a7877b81988b933 mbr-nondos-mode.img
+
+---layout----------
+Disk <removed>: 20 MiB, 20971520 bytes, 40960 sectors
+Units: sectors of 1 * 512 = 512 bytes
+Sector size (logical/physical): 512 bytes / 512 bytes
+I/O size (minimum/optimal): 512 bytes / <removed> bytes
+Disklabel type: dos
+Disk identifier: <removed>
+
+Device     Boot Start   End Sectors Size Id Type
+<removed>3      12288 40959   28672  14M  5 Extended
+<removed>5      26624 30719    4096   2M 83 Linux
+<removed>6      14336 18431    4096   2M 83 Linux
+
+Partition table entries are not in disk order.
+-------------------
+
diff --git a/tests/expected/fdisk/mbr-nondos-mode-1st-active b/tests/expected/fdisk/mbr-nondos-mode-1st-active
new file mode 100644 (file)
index 0000000..76b761a
--- /dev/null
@@ -0,0 +1,15 @@
+Set primary partition active
+47f024f3b406598a0159400af7382e2c mbr-nondos-mode.img
+
+---layout----------
+Disk <removed>: 20 MiB, 20971520 bytes, 40960 sectors
+Units: sectors of 1 * 512 = 512 bytes
+Sector size (logical/physical): 512 bytes / 512 bytes
+I/O size (minimum/optimal): 512 bytes / <removed> bytes
+Disklabel type: dos
+Disk identifier: <removed>
+
+Device     Boot Start   End Sectors Size Id Type
+<removed>1 *     2048  8191    6144   3M 83 Linux
+-------------------
+
diff --git a/tests/expected/fdisk/mbr-nondos-mode-1st-primary b/tests/expected/fdisk/mbr-nondos-mode-1st-primary
new file mode 100644 (file)
index 0000000..df4bf2e
--- /dev/null
@@ -0,0 +1,15 @@
+Create 1st primary partition
+e21e16b7452d82e2a2810a1de8c3db05 mbr-nondos-mode.img
+
+---layout----------
+Disk <removed>: 20 MiB, 20971520 bytes, 40960 sectors
+Units: sectors of 1 * 512 = 512 bytes
+Sector size (logical/physical): 512 bytes / 512 bytes
+I/O size (minimum/optimal): 512 bytes / <removed> bytes
+Disklabel type: dos
+Disk identifier: <removed>
+
+Device     Boot Start   End Sectors Size Id Type
+<removed>1       2048  8191    6144   3M 83 Linux
+-------------------
+
diff --git a/tests/expected/fdisk/mbr-nondos-mode-1st-primary-delete b/tests/expected/fdisk/mbr-nondos-mode-1st-primary-delete
new file mode 100644 (file)
index 0000000..7fce4e4
--- /dev/null
@@ -0,0 +1,20 @@
+Delete primary partition
+6f1b62718cf8d83602d51de8944cee51 mbr-nondos-mode.img
+
+---layout----------
+Disk <removed>: 20 MiB, 20971520 bytes, 40960 sectors
+Units: sectors of 1 * 512 = 512 bytes
+Sector size (logical/physical): 512 bytes / 512 bytes
+I/O size (minimum/optimal): 512 bytes / <removed> bytes
+Disklabel type: dos
+Disk identifier: <removed>
+
+Device     Boot Start   End Sectors Size Id Type
+<removed>2       8192 12287    4096   2M 83 Linux
+<removed>3      12288 40959   28672  14M  5 Extended
+<removed>5      26624 30719    4096   2M 83 Linux
+<removed>6      14336 18431    4096   2M 83 Linux
+
+Partition table entries are not in disk order.
+-------------------
+
diff --git a/tests/expected/fdisk/mbr-nondos-mode-1st-primary-recreate b/tests/expected/fdisk/mbr-nondos-mode-1st-primary-recreate
new file mode 100644 (file)
index 0000000..80e0079
--- /dev/null
@@ -0,0 +1,15 @@
+Re-create 1st primary partition
+a5543ee1e3d2cf79913a56bae893a0f0 mbr-nondos-mode.img
+
+---layout----------
+Disk <removed>: 20 MiB, 20971520 bytes, 40960 sectors
+Units: sectors of 1 * 512 = 512 bytes
+Sector size (logical/physical): 512 bytes / 512 bytes
+I/O size (minimum/optimal): 512 bytes / <removed> bytes
+Disklabel type: dos
+Disk identifier: <removed>
+
+Device     Boot Start   End Sectors Size Id Type
+<removed>1       2048  8191    6144   3M 83 Linux
+-------------------
+
diff --git a/tests/expected/fdisk/mbr-nondos-mode-2nd-primary b/tests/expected/fdisk/mbr-nondos-mode-2nd-primary
new file mode 100644 (file)
index 0000000..0b24808
--- /dev/null
@@ -0,0 +1,16 @@
+Create 2nd primary partition
+9d31ee977e26e72ebce78e8e543cd4ce mbr-nondos-mode.img
+
+---layout----------
+Disk <removed>: 20 MiB, 20971520 bytes, 40960 sectors
+Units: sectors of 1 * 512 = 512 bytes
+Sector size (logical/physical): 512 bytes / 512 bytes
+I/O size (minimum/optimal): 512 bytes / <removed> bytes
+Disklabel type: dos
+Disk identifier: <removed>
+
+Device     Boot Start   End Sectors Size Id Type
+<removed>1       2048  8191    6144   3M 83 Linux
+<removed>2       8192 12287    4096   2M 83 Linux
+-------------------
+
diff --git a/tests/expected/fdisk/mbr-nondos-mode-empty-pt b/tests/expected/fdisk/mbr-nondos-mode-empty-pt
new file mode 100644 (file)
index 0000000..bc18a70
--- /dev/null
@@ -0,0 +1,14 @@
+Initialize empty image
+8f4e33f3dc3e414ff94e5fb6905cba8c mbr-nondos-mode.img
+Create new DOS partition table
+4e23561dcb81678bb1bd678722c7cbb7 mbr-nondos-mode.img
+
+---layout----------
+Disk <removed>: 20 MiB, 20971520 bytes, 40960 sectors
+Units: sectors of 1 * 512 = 512 bytes
+Sector size (logical/physical): 512 bytes / 512 bytes
+I/O size (minimum/optimal): 512 bytes / <removed> bytes
+Disklabel type: dos
+Disk identifier: <removed>
+-------------------
+
diff --git a/tests/expected/fdisk/mbr-nondos-mode-extended b/tests/expected/fdisk/mbr-nondos-mode-extended
new file mode 100644 (file)
index 0000000..3b8c736
--- /dev/null
@@ -0,0 +1,17 @@
+Create extended partition
+9528631b198e44564f67f8ca97fa51b8 mbr-nondos-mode.img
+
+---layout----------
+Disk <removed>: 20 MiB, 20971520 bytes, 40960 sectors
+Units: sectors of 1 * 512 = 512 bytes
+Sector size (logical/physical): 512 bytes / 512 bytes
+I/O size (minimum/optimal): 512 bytes / <removed> bytes
+Disklabel type: dos
+Disk identifier: <removed>
+
+Device     Boot Start   End Sectors Size Id Type
+<removed>1       2048  8191    6144   3M 83 Linux
+<removed>2       8192 12287    4096   2M 83 Linux
+<removed>3      12288 40959   28672  14M  5 Extended
+-------------------
+
diff --git a/tests/expected/fdisk/mbr-nondos-mode-extended-delete b/tests/expected/fdisk/mbr-nondos-mode-extended-delete
new file mode 100644 (file)
index 0000000..b467274
--- /dev/null
@@ -0,0 +1,12 @@
+Delete extended partition
+e1ef48d3d42f4ebcfd5bf4baf5e370e9 mbr-nondos-mode.img
+
+---layout----------
+Disk <removed>: 20 MiB, 20971520 bytes, 40960 sectors
+Units: sectors of 1 * 512 = 512 bytes
+Sector size (logical/physical): 512 bytes / 512 bytes
+I/O size (minimum/optimal): 512 bytes / <removed> bytes
+Disklabel type: dos
+Disk identifier: <removed>
+-------------------
+
diff --git a/tests/expected/fdisk/mbr-nondos-mode-first-sector-at-end b/tests/expected/fdisk/mbr-nondos-mode-first-sector-at-end
new file mode 100644 (file)
index 0000000..4efd2a2
--- /dev/null
@@ -0,0 +1,47 @@
+Create new DOS partition table (again)
+Create 1st primary at the end of device
+
+---layout----------
+Disk <removed>: 20 MiB, 20971520 bytes, 40960 sectors
+Units: sectors of 1 * 512 = 512 bytes
+Sector size (logical/physical): 512 bytes / 512 bytes
+I/O size (minimum/optimal): 512 bytes / <removed> bytes
+Disklabel type: dos
+Disk identifier: <removed>
+
+Device     Boot Start   End Sectors  Size Id Type
+<removed>1      20000 40959   20960 10.2M 83 Linux
+-------------------
+
+Create 2nd primary at the begin of device
+
+Welcome to fdisk <removed>.
+Changes will remain in memory only, until you decide to write them.
+Be careful before using the write command.
+
+
+Command (m for help): Partition type
+   p   primary (1 primary, 0 extended, 3 free)
+   e   extended (container for logical partitions)
+Select (default p): Partition number (2-4, default 2): First sector (2048-19999, default 2048): Last sector, +/-sectors or +/-size{K,M,G,T,P} (2048-19999, default 19999): 
+Created a new <removed>.
+
+Command (m for help): The partition table has been altered.
+Syncing disks.
+
+
+---layout----------
+Disk <removed>: 20 MiB, 20971520 bytes, 40960 sectors
+Units: sectors of 1 * 512 = 512 bytes
+Sector size (logical/physical): 512 bytes / 512 bytes
+I/O size (minimum/optimal): 512 bytes / <removed> bytes
+Disklabel type: dos
+Disk identifier: <removed>
+
+Device     Boot Start   End Sectors  Size Id Type
+<removed>1      20000 40959   20960 10.2M 83 Linux
+<removed>2       2048 19999   17952  8.8M 83 Linux
+
+Partition table entries are not in disk order.
+-------------------
+
diff --git a/tests/expected/fdisk/mbr-nondos-mode-logical b/tests/expected/fdisk/mbr-nondos-mode-logical
new file mode 100644 (file)
index 0000000..ee98105
--- /dev/null
@@ -0,0 +1,21 @@
+Create logical partitions
+db4406e7bc0773f234fd1db1b58b5997 mbr-nondos-mode.img
+
+---layout----------
+Disk <removed>: 20 MiB, 20971520 bytes, 40960 sectors
+Units: sectors of 1 * 512 = 512 bytes
+Sector size (logical/physical): 512 bytes / 512 bytes
+I/O size (minimum/optimal): 512 bytes / <removed> bytes
+Disklabel type: dos
+Disk identifier: <removed>
+
+Device     Boot Start   End Sectors Size Id Type
+<removed>1       2048  8191    6144   3M 83 Linux
+<removed>2       8192 12287    4096   2M 83 Linux
+<removed>3      12288 40959   28672  14M  5 Extended
+<removed>5      14336 18431    4096   2M 83 Linux
+<removed>6      20480 24575    4096   2M 83 Linux
+<removed>7      26624 30719    4096   2M 83 Linux
+<removed>8      32768 36863    4096   2M 83 Linux
+-------------------
+
diff --git a/tests/expected/fdisk/mbr-nondos-mode-logical-delete b/tests/expected/fdisk/mbr-nondos-mode-logical-delete
new file mode 100644 (file)
index 0000000..ca9cd49
--- /dev/null
@@ -0,0 +1,18 @@
+Delete logical partitions
+de85b8d74f52f307b9467ea4c33438cb mbr-nondos-mode.img
+
+---layout----------
+Disk <removed>: 20 MiB, 20971520 bytes, 40960 sectors
+Units: sectors of 1 * 512 = 512 bytes
+Sector size (logical/physical): 512 bytes / 512 bytes
+I/O size (minimum/optimal): 512 bytes / <removed> bytes
+Disklabel type: dos
+Disk identifier: <removed>
+
+Device     Boot Start   End Sectors Size Id Type
+<removed>1       2048  8191    6144   3M 83 Linux
+<removed>2       8192 12287    4096   2M 83 Linux
+<removed>3      12288 40959   28672  14M  5 Extended
+<removed>5      26624 30719    4096   2M 83 Linux
+-------------------
+
diff --git a/tests/expected/fdisk/mbr-nondos-mode-logical-recreate b/tests/expected/fdisk/mbr-nondos-mode-logical-recreate
new file mode 100644 (file)
index 0000000..3b16015
--- /dev/null
@@ -0,0 +1,21 @@
+Create another logical partition
+28d0cbe795535ee025dc7a4781516965 mbr-nondos-mode.img
+
+---layout----------
+Disk <removed>: 20 MiB, 20971520 bytes, 40960 sectors
+Units: sectors of 1 * 512 = 512 bytes
+Sector size (logical/physical): 512 bytes / 512 bytes
+I/O size (minimum/optimal): 512 bytes / <removed> bytes
+Disklabel type: dos
+Disk identifier: <removed>
+
+Device     Boot Start   End Sectors Size Id Type
+<removed>1       2048  8191    6144   3M 83 Linux
+<removed>2       8192 12287    4096   2M 83 Linux
+<removed>3      12288 40959   28672  14M  5 Extended
+<removed>5      26624 30719    4096   2M 83 Linux
+<removed>6      14336 18431    4096   2M 83 Linux
+
+Partition table entries are not in disk order.
+-------------------
+
index 7ac5dae1bdf8909835bef891f7885bc35b35daff..d3b35fa3938f39e2b9efacb29557f13daf086aea 100755 (executable)
@@ -54,10 +54,13 @@ function print_layout {
        echo -ne "\n---layout----------\n" >> $TS_OUTPUT
        $TS_CMD_FDISK -l ${TEST_IMAGE_NAME} >> $TS_OUTPUT
        echo -ne   "-------------------\n\n" >> $TS_OUTPUT
+
+       ts_fdisk_clean ${TEST_IMAGE_NAME}
 }
 
 #set -x
 
+ts_init_subtest "empty-pt"
 ts_log "Initialize empty image"
 TEST_IMAGE_NAME=$(ts_image_init 20)    # 20 MiB
 ts_image_md5sum >> $TS_OUTPUT 2>&1
@@ -68,87 +71,123 @@ ts_log "Create new DOS partition table"
 echo -e "${FDISK_CMD_INIT}${FDISK_CMD_CREATE_DOSLABEL}${FDISK_CMD_INIT}${FDISK_CMD_WRITE_CLOSE}" \
         | $TS_CMD_FDISK ${TEST_IMAGE_NAME} &> /dev/null
 ts_image_md5sum >> $TS_OUTPUT 2>&1
-
 print_layout
+ts_finalize_subtest
 
+
+ts_init_subtest "1st-primary"
 ts_log "Create 1st primary partition"
 echo -e "${FDISK_CMD_CREATE_1PRIMARY}${FDISK_CMD_WRITE_CLOSE}" | \
        $TS_CMD_FDISK ${TEST_IMAGE_NAME} &> /dev/null
 ts_image_md5sum >> $TS_OUTPUT 2>&1
-
 print_layout
+ts_finalize_subtest
 
+
+ts_init_subtest "1st-active"
 ts_log "Set primary partition active"
 echo -e "${FDISK_CMD_SET_ACTIVE}${FDISK_CMD_WRITE_CLOSE}" | \
        $TS_CMD_FDISK ${TEST_IMAGE_NAME} &> /dev/null
 ts_image_md5sum >> $TS_OUTPUT 2>&1
-
 print_layout
+ts_finalize_subtest
 
+
+ts_init_subtest "1st-primary-recreate"
 ts_log "Re-create 1st primary partition"
 echo -e "d\n${FDISK_CMD_CREATE_1PRIMARY}${FDISK_CMD_WRITE_CLOSE}" | \
        $TS_CMD_FDISK ${TEST_IMAGE_NAME} &> /dev/null
 ts_image_md5sum >> $TS_OUTPUT 2>&1
-
 print_layout
+ts_finalize_subtest
 
+
+ts_init_subtest "2nd-primary"
 ts_log "Create 2nd primary partition"
 echo -e "${FDISK_CMD_CREATE_2PRIMARY}${FDISK_CMD_WRITE_CLOSE}" | \
        $TS_CMD_FDISK ${TEST_IMAGE_NAME} &> /dev/null
 ts_image_md5sum >> $TS_OUTPUT 2>&1
-
 print_layout
+ts_finalize_subtest
 
+
+ts_init_subtest "extended"
 ts_log "Create extended partition"
 echo -e "${FDISK_CMD_CREATE_EXTENDED}${FDISK_CMD_WRITE_CLOSE}" | \
        $TS_CMD_FDISK  ${TEST_IMAGE_NAME} &> /dev/null
 ts_image_md5sum >> $TS_OUTPUT 2>&1
-
 print_layout
+ts_finalize_subtest
 
+
+ts_init_subtest "logical"
 ts_log "Create logical partitions"
 echo -e "${FDISK_CMD_CREATE_LOGICAL}${FDISK_CMD_CREATE_LOGICAL}${FDISK_CMD_CREATE_LOGICAL}${FDISK_CMD_CREATE_LOGICAL}${FDISK_CMD_WRITE_CLOSE}" \
        | $TS_CMD_FDISK ${TEST_IMAGE_NAME} &> /dev/null
 ts_image_md5sum >> $TS_OUTPUT 2>&1
-
 print_layout
+ts_finalize_subtest
+
 
+ts_init_subtest "logical-delete"
 ts_log "Delete logical partitions"
 echo -e "${FDISK_CMD_DELETE_LOGICALS}${FDISK_CMD_WRITE_CLOSE}" \
        | $TS_CMD_FDISK ${TEST_IMAGE_NAME} &> /dev/null
 ts_image_md5sum >> $TS_OUTPUT 2>&1
-
 print_layout
+ts_finalize_subtest
 
 
+ts_init_subtest "logical-recreate"
 ts_log "Create another logical partition"
 echo -e "${FDISK_CMD_CREATE_LOGICAL}${FDISK_CMD_WRITE_CLOSE}" \
        | $TS_CMD_FDISK ${TEST_IMAGE_NAME} &> /dev/null
 ts_image_md5sum >> $TS_OUTPUT 2>&1
-
 print_layout
+ts_finalize_subtest
 
+
+ts_init_subtest "1st-primary-delete"
 ts_log "Delete primary partition"
 echo -e "${FDISK_CMD_DELETE_1PRIMARY}${FDISK_CMD_WRITE_CLOSE}" \
        | $TS_CMD_FDISK ${TEST_IMAGE_NAME} &> /dev/null
 ts_image_md5sum >> $TS_OUTPUT 2>&1
-
 print_layout
+ts_finalize_subtest
 
+
+ts_init_subtest "1nd-primary-delete"
 ts_log "Delete primary partition"
 echo -e "${FDISK_CMD_DELETE_2PRIMARY}${FDISK_CMD_WRITE_CLOSE}" \
        | $TS_CMD_FDISK ${TEST_IMAGE_NAME} &> /dev/null
 ts_image_md5sum >> $TS_OUTPUT 2>&1
-
 print_layout
+ts_finalize_subtest
+
 
+ts_init_subtest "extended-delete"
 ts_log "Delete extended partition"
 echo -e "${FDISK_CMD_DELETE_EXTENDED}${FDISK_CMD_WRITE_CLOSE}" \
        | $TS_CMD_FDISK -c=dos -u=cylinders ${TEST_IMAGE_NAME} &> /dev/null
 ts_image_md5sum >> $TS_OUTPUT 2>&1
+print_layout
+ts_finalize_subtest
+
+
+ts_init_subtest "first-sector-at-end"
+ts_log "Create new DOS partition table (again)"
+echo -e "${FDISK_CMD_INIT}${FDISK_CMD_CREATE_DOSLABEL}${FDISK_CMD_INIT}${FDISK_CMD_WRITE_CLOSE}" \
+        | $TS_CMD_FDISK ${TEST_IMAGE_NAME} &> /dev/null
+ts_log "Create 1st primary at the end of device"
+echo -e "n\np\n1\n20000\n\n${FDISK_CMD_WRITE_CLOSE}" | \
+       $TS_CMD_FDISK ${TEST_IMAGE_NAME} &> /dev/null
+print_layout
 
+ts_log "Create 2nd primary at the begin of device"
+echo -e "n\np\n2\n\n\n${FDISK_CMD_WRITE_CLOSE}" | \
+       $TS_CMD_FDISK ${TEST_IMAGE_NAME} >> $TS_OUTPUT
 print_layout
+ts_finalize_subtest
 
-ts_fdisk_clean ${TEST_IMAGE_NAME}
 
 ts_finalize
index 405d34c5615b4f72795aaf436b4aa584a7ccbebe..2dea772e5a96512736f9dc2142fffd07491d3c3b 100755 (executable)
@@ -22,6 +22,8 @@ TS_DESC="mbsencode"
 . $TS_TOPDIR/functions.sh
 ts_init "$*"
 
+ts_check_test_command $TS_HELPER_MBSENCODE
+
 # These test may fail on some machines (locales, other libc...)
 TS_KNOWN_FAIL="yes"