[arch-commits] Commit in util-linux/repos (20 files)

Felix Yan felixonmars at archlinux.org
Sat Dec 24 10:59:22 UTC 2016


    Date: Saturday, December 24, 2016 @ 10:59:21
  Author: felixonmars
Revision: 284580

archrelease: copy trunk to staging-i686, staging-x86_64

Added:
  util-linux/repos/staging-i686/
  util-linux/repos/staging-i686/0001-chrt-default-to-SCHED_RR-policy.patch
    (from rev 284579, util-linux/trunk/0001-chrt-default-to-SCHED_RR-policy.patch)
  util-linux/repos/staging-i686/0001-lsns-Fix-parser-for-proc-pid-stat-which-is-including.patch
    (from rev 284579, util-linux/trunk/0001-lsns-Fix-parser-for-proc-pid-stat-which-is-including.patch)
  util-linux/repos/staging-i686/0001-sfdisk-cleanup-dump-error-messages.patch
    (from rev 284579, util-linux/trunk/0001-sfdisk-cleanup-dump-error-messages.patch)
  util-linux/repos/staging-i686/0001-sfdisk-don-t-be-silent-when-list-non-existing-device.patch
    (from rev 284579, util-linux/trunk/0001-sfdisk-don-t-be-silent-when-list-non-existing-device.patch)
  util-linux/repos/staging-i686/0001-sfdisk-support-empty-label-use-case.patch
    (from rev 284579, util-linux/trunk/0001-sfdisk-support-empty-label-use-case.patch)
  util-linux/repos/staging-i686/PKGBUILD
    (from rev 284579, util-linux/trunk/PKGBUILD)
  util-linux/repos/staging-i686/pam-common
    (from rev 284579, util-linux/trunk/pam-common)
  util-linux/repos/staging-i686/pam-login
    (from rev 284579, util-linux/trunk/pam-login)
  util-linux/repos/staging-i686/pam-su
    (from rev 284579, util-linux/trunk/pam-su)
  util-linux/repos/staging-x86_64/
  util-linux/repos/staging-x86_64/0001-chrt-default-to-SCHED_RR-policy.patch
    (from rev 284579, util-linux/trunk/0001-chrt-default-to-SCHED_RR-policy.patch)
  util-linux/repos/staging-x86_64/0001-lsns-Fix-parser-for-proc-pid-stat-which-is-including.patch
    (from rev 284579, util-linux/trunk/0001-lsns-Fix-parser-for-proc-pid-stat-which-is-including.patch)
  util-linux/repos/staging-x86_64/0001-sfdisk-cleanup-dump-error-messages.patch
    (from rev 284579, util-linux/trunk/0001-sfdisk-cleanup-dump-error-messages.patch)
  util-linux/repos/staging-x86_64/0001-sfdisk-don-t-be-silent-when-list-non-existing-device.patch
    (from rev 284579, util-linux/trunk/0001-sfdisk-don-t-be-silent-when-list-non-existing-device.patch)
  util-linux/repos/staging-x86_64/0001-sfdisk-support-empty-label-use-case.patch
    (from rev 284579, util-linux/trunk/0001-sfdisk-support-empty-label-use-case.patch)
  util-linux/repos/staging-x86_64/PKGBUILD
    (from rev 284579, util-linux/trunk/PKGBUILD)
  util-linux/repos/staging-x86_64/pam-common
    (from rev 284579, util-linux/trunk/pam-common)
  util-linux/repos/staging-x86_64/pam-login
    (from rev 284579, util-linux/trunk/pam-login)
  util-linux/repos/staging-x86_64/pam-su
    (from rev 284579, util-linux/trunk/pam-su)

--------------------------------------------------------------------------------+
 staging-i686/0001-chrt-default-to-SCHED_RR-policy.patch                        |   39 +
 staging-i686/0001-lsns-Fix-parser-for-proc-pid-stat-which-is-including.patch   |   79 +++
 staging-i686/0001-sfdisk-cleanup-dump-error-messages.patch                     |   44 +
 staging-i686/0001-sfdisk-don-t-be-silent-when-list-non-existing-device.patch   |   70 +++
 staging-i686/0001-sfdisk-support-empty-label-use-case.patch                    |  223 ++++++++++
 staging-i686/PKGBUILD                                                          |  117 +++++
 staging-i686/pam-common                                                        |    6 
 staging-i686/pam-login                                                         |    7 
 staging-i686/pam-su                                                            |    9 
 staging-x86_64/0001-chrt-default-to-SCHED_RR-policy.patch                      |   39 +
 staging-x86_64/0001-lsns-Fix-parser-for-proc-pid-stat-which-is-including.patch |   79 +++
 staging-x86_64/0001-sfdisk-cleanup-dump-error-messages.patch                   |   44 +
 staging-x86_64/0001-sfdisk-don-t-be-silent-when-list-non-existing-device.patch |   70 +++
 staging-x86_64/0001-sfdisk-support-empty-label-use-case.patch                  |  223 ++++++++++
 staging-x86_64/PKGBUILD                                                        |  117 +++++
 staging-x86_64/pam-common                                                      |    6 
 staging-x86_64/pam-login                                                       |    7 
 staging-x86_64/pam-su                                                          |    9 
 18 files changed, 1188 insertions(+)

Copied: util-linux/repos/staging-i686/0001-chrt-default-to-SCHED_RR-policy.patch (from rev 284579, util-linux/trunk/0001-chrt-default-to-SCHED_RR-policy.patch)
===================================================================
--- staging-i686/0001-chrt-default-to-SCHED_RR-policy.patch	                        (rev 0)
+++ staging-i686/0001-chrt-default-to-SCHED_RR-policy.patch	2016-12-24 10:59:21 UTC (rev 284580)
@@ -0,0 +1,39 @@
+From c7adc2f204f19167f781fa2ee739e0ca386fc4f5 Mon Sep 17 00:00:00 2001
+From: Andreas Henriksson <andreas at fatal.se>
+Date: Fri, 2 Dec 2016 15:10:18 +0100
+Subject: [PATCH] chrt: default to SCHED_RR policy
+
+This fixes a regression introduced in:
+
+commit 7a4ea5664edba98bff28adec3a9c3cfb5763a495
+"chrt: add control struct"
+
+Previously (and as documented in the manpage) the default policy
+was SCHED_RR. Now it's implicitly SCHED_OTHER (0) as the value
+is not initialized explicitly anymore.
+
+Test-command: chrt 90 echo hello
+
+Reported-by: Patrick Pelissier <patrick.pelissier at gmail.com>
+Addresses: http://bugs.debian.org/846572
+Signed-off-by: Andreas Henriksson <andreas at fatal.se>
+---
+ schedutils/chrt.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/schedutils/chrt.c b/schedutils/chrt.c
+index a861d9f..73d1ffa 100644
+--- a/schedutils/chrt.c
++++ b/schedutils/chrt.c
+@@ -409,7 +409,7 @@ static void set_sched(struct chrt_ctl *ctl)
+ 
+ int main(int argc, char **argv)
+ {
+-	struct chrt_ctl _ctl = { .pid = -1 }, *ctl = &_ctl;
++	struct chrt_ctl _ctl = { .pid = -1, .policy = SCHED_RR }, *ctl = &_ctl;
+ 	int c;
+ 
+ 	static const struct option longopts[] = {
+-- 
+2.10.2
+

Copied: util-linux/repos/staging-i686/0001-lsns-Fix-parser-for-proc-pid-stat-which-is-including.patch (from rev 284579, util-linux/trunk/0001-lsns-Fix-parser-for-proc-pid-stat-which-is-including.patch)
===================================================================
--- staging-i686/0001-lsns-Fix-parser-for-proc-pid-stat-which-is-including.patch	                        (rev 0)
+++ staging-i686/0001-lsns-Fix-parser-for-proc-pid-stat-which-is-including.patch	2016-12-24 10:59:21 UTC (rev 284580)
@@ -0,0 +1,79 @@
+From 3fcbd7978980dc1a29c626b701333e27599e506d Mon Sep 17 00:00:00 2001
+From: OGAWA Hirofumi <hirofumi at mail.parknet.co.jp>
+Date: Wed, 23 Nov 2016 14:13:34 +0900
+Subject: [PATCH] lsns: Fix parser for /proc/<pid>/stat which is including
+ space in comm
+
+For example, child process of spamd has
+
+    32031 (spamd child) S 32026 32026 32026 0 -1 4210752 338 0 0 0 ...
+
+fscanf("%d %*s %c %d*[^\n]") in read_process() can't parse above as we
+expected, because %s only skips non-whitespace. I.e. it parses like
+following,
+
+    32031 (spamd child) S 32026 32026 32026 0 -1 4210752 338 0 0 0 ...
+    +---+ +----+ +
+      %d    %*s  %c
+
+and returns 2 (pid=32031, state=c).
+
+This fixes it by skipping task->comm part manually.
+
+Signed-off-by: OGAWA Hirofumi <hirofumi at mail.parknet.co.jp>
+---
+ sys-utils/lsns.c | 30 ++++++++++++++++++++++++++----
+ 1 file changed, 26 insertions(+), 4 deletions(-)
+
+diff --git a/sys-utils/lsns.c b/sys-utils/lsns.c
+index e4fd208..809737c 100644
+--- a/sys-utils/lsns.c
++++ b/sys-utils/lsns.c
+@@ -217,6 +217,30 @@ static int get_ns_ino(int dir, const char *nsname, ino_t *ino)
+ 	return 0;
+ }
+ 
++static int parse_proc_stat(FILE *fp, pid_t *pid, char *state, pid_t *ppid)
++{
++	char *line = NULL, *p;
++	size_t len = 0;
++	int rc;
++
++	if (getline(&line, &len, fp) < 0) {
++		rc = -errno;
++		goto error;
++	}
++
++	p = strrchr(line, ')');
++	if (p == NULL ||
++	    sscanf(line, "%d (", pid) != 1 ||
++	    sscanf(p, ") %c %d*[^\n]", state, ppid) != 2) {
++		rc = -EINVAL;
++		goto error;
++	}
++	rc = 0;
++
++error:
++	free(line);
++	return rc;
++}
+ 
+ static int read_process(struct lsns *ls, pid_t pid)
+ {
+@@ -255,11 +279,9 @@ static int read_process(struct lsns *ls, pid_t pid)
+ 		rc = -errno;
+ 		goto done;
+ 	}
+-	rc = fscanf(f, "%d %*s %c %d*[^\n]", &p->pid, &p->state, &p->ppid);
+-	if (rc != 3) {
+-		rc = rc < 0 ? -errno : -EINVAL;
++	rc = parse_proc_stat(f, &p->pid, &p->state, &p->ppid);
++	if (rc < 0)
+ 		goto done;
+-	}
+ 	rc = 0;
+ 
+ 	for (i = 0; i < ARRAY_SIZE(p->ns_ids); i++) {
+-- 
+2.10.2
+

Copied: util-linux/repos/staging-i686/0001-sfdisk-cleanup-dump-error-messages.patch (from rev 284579, util-linux/trunk/0001-sfdisk-cleanup-dump-error-messages.patch)
===================================================================
--- staging-i686/0001-sfdisk-cleanup-dump-error-messages.patch	                        (rev 0)
+++ staging-i686/0001-sfdisk-cleanup-dump-error-messages.patch	2016-12-24 10:59:21 UTC (rev 284580)
@@ -0,0 +1,44 @@
+From c49b765a6e9031642e2bb846e93dddc6827e4b28 Mon Sep 17 00:00:00 2001
+From: Karel Zak <kzak at redhat.com>
+Date: Wed, 30 Nov 2016 10:53:56 +0100
+Subject: [PATCH] sfdisk: cleanup --dump error messages
+
+old:
+  # truncate -s 1G empty && ./sfdisk --dump empty
+  sfdisk: failed to dump partition table: Success
+
+new:
+  # truncate -s 1G empty && ./sfdisk --dump empty
+  sfdisk: empty: does not contain a recognized partition table.
+
+Addresses: https://github.com/karelzak/util-linux/issues/375
+Signed-off-by: Karel Zak <kzak at redhat.com>
+---
+ disk-utils/sfdisk.c | 5 ++++-
+ 1 file changed, 4 insertions(+), 1 deletion(-)
+
+diff --git a/disk-utils/sfdisk.c b/disk-utils/sfdisk.c
+index 0f69d65..10307ad 100644
+--- a/disk-utils/sfdisk.c
++++ b/disk-utils/sfdisk.c
+@@ -950,13 +950,16 @@ static int command_dump(struct sfdisk *sf, int argc, char **argv)
+ 	if (rc)
+ 		err(EXIT_FAILURE, _("cannot open %s"), devname);
+ 
++	if (!fdisk_has_label(sf->cxt))
++		errx(EXIT_FAILURE, _("%s: does not contain a recognized partition table"), devname);
++
+ 	dp = fdisk_new_script(sf->cxt);
+ 	if (!dp)
+ 		err(EXIT_FAILURE, _("failed to allocate dump struct"));
+ 
+ 	rc = fdisk_script_read_context(dp, NULL);
+ 	if (rc)
+-		err(EXIT_FAILURE, _("failed to dump partition table"));
++		errx(EXIT_FAILURE, _("%s: failed to dump partition table"), devname);
+ 
+ 	if (sf->json)
+ 		fdisk_script_enable_json(dp, 1);
+-- 
+2.10.2
+

Copied: util-linux/repos/staging-i686/0001-sfdisk-don-t-be-silent-when-list-non-existing-device.patch (from rev 284579, util-linux/trunk/0001-sfdisk-don-t-be-silent-when-list-non-existing-device.patch)
===================================================================
--- staging-i686/0001-sfdisk-don-t-be-silent-when-list-non-existing-device.patch	                        (rev 0)
+++ staging-i686/0001-sfdisk-don-t-be-silent-when-list-non-existing-device.patch	2016-12-24 10:59:21 UTC (rev 284580)
@@ -0,0 +1,70 @@
+From fed304837f60b626f6198663990e76e506f89063 Mon Sep 17 00:00:00 2001
+From: Karel Zak <kzak at redhat.com>
+Date: Tue, 29 Nov 2016 15:58:18 +0100
+Subject: [PATCH] sfdisk: don't be silent when list non-existing device
+
+Addresses: https://github.com/karelzak/util-linux/issues/376
+Signed-off-by: Karel Zak <kzak at redhat.com>
+---
+ disk-utils/sfdisk.c | 16 ++++++++++------
+ 1 file changed, 10 insertions(+), 6 deletions(-)
+
+diff --git a/disk-utils/sfdisk.c b/disk-utils/sfdisk.c
+index 52f2a6d..0f69d65 100644
+--- a/disk-utils/sfdisk.c
++++ b/disk-utils/sfdisk.c
+@@ -560,6 +560,7 @@ static int write_changes(struct sfdisk *sf)
+  */
+ static int command_list_partitions(struct sfdisk *sf, int argc, char **argv)
+ {
++	int fail = 0;
+ 	fdisk_enable_listonly(sf->cxt, 1);
+ 
+ 	if (argc) {
+@@ -568,13 +569,14 @@ static int command_list_partitions(struct sfdisk *sf, int argc, char **argv)
+ 		for (i = 0; i < argc; i++) {
+ 			if (ct)
+ 				fputs("\n\n", stdout);
+-			if (print_device_pt(sf->cxt, argv[i], 0, sf->verify) == 0)
+-				ct++;
++			if (print_device_pt(sf->cxt, argv[i], 1, sf->verify) != 0)
++				fail++;
++			ct++;
+ 		}
+ 	} else
+ 		print_all_devices_pt(sf->cxt, sf->verify);
+ 
+-	return 0;
++	return fail;
+ }
+ 
+ /*
+@@ -582,6 +584,7 @@ static int command_list_partitions(struct sfdisk *sf, int argc, char **argv)
+  */
+ static int command_list_freespace(struct sfdisk *sf, int argc, char **argv)
+ {
++	int fail = 0;
+ 	fdisk_enable_listonly(sf->cxt, 1);
+ 
+ 	if (argc) {
+@@ -590,13 +593,14 @@ static int command_list_freespace(struct sfdisk *sf, int argc, char **argv)
+ 		for (i = 0; i < argc; i++) {
+ 			if (ct)
+ 				fputs("\n\n", stdout);
+-			if (print_device_freespace(sf->cxt, argv[i], 0) == 0)
+-				ct++;
++			if (print_device_freespace(sf->cxt, argv[i], 1) != 0)
++				fail++;
++			ct++;
+ 		}
+ 	} else
+ 		print_all_devices_freespace(sf->cxt);
+ 
+-	return 0;
++	return fail;
+ }
+ 
+ /*
+-- 
+2.10.2
+

Copied: util-linux/repos/staging-i686/0001-sfdisk-support-empty-label-use-case.patch (from rev 284579, util-linux/trunk/0001-sfdisk-support-empty-label-use-case.patch)
===================================================================
--- staging-i686/0001-sfdisk-support-empty-label-use-case.patch	                        (rev 0)
+++ staging-i686/0001-sfdisk-support-empty-label-use-case.patch	2016-12-24 10:59:21 UTC (rev 284580)
@@ -0,0 +1,223 @@
+From 35ca51182782193f555fbdcb06bb10766550d017 Mon Sep 17 00:00:00 2001
+From: Karel Zak <kzak at redhat.com>
+Date: Wed, 30 Nov 2016 12:43:10 +0100
+Subject: [PATCH] sfdisk: support empty label use-case
+
+By default sfdisk creates partition table when a first partition is
+specified, otherwise the device is not modified. This force users to
+create at least one partition.
+
+This commit allows to create empty label without partitions if "label:
+<name>" header line is specified by script.
+
+The commit also modifies "New situation:" output to list label name
+and label identifier.
+
+Addresses: https://github.com/karelzak/util-linux/issues/374
+Signed-off-by: Karel Zak <kzak at redhat.com>
+---
+ disk-utils/fdisk-list.c    | 23 +++++++++++++++--------
+ disk-utils/fdisk-list.h    |  1 +
+ disk-utils/sfdisk.8        | 18 +++++++++++++++++-
+ disk-utils/sfdisk.c        | 17 +++++++++++++++++
+ libfdisk/src/libfdisk.h.in |  1 +
+ libfdisk/src/libfdisk.sym  |  5 +++++
+ libfdisk/src/script.c      | 20 +++++++++++++++++++-
+ 7 files changed, 75 insertions(+), 10 deletions(-)
+
+diff --git a/disk-utils/fdisk-list.c b/disk-utils/fdisk-list.c
+index e6b2033..c9560f4 100644
+--- a/disk-utils/fdisk-list.c
++++ b/disk-utils/fdisk-list.c
+@@ -34,10 +34,23 @@ static int is_ide_cdrom_or_tape(char *device)
+ 	return ret;
+ }
+ 
++void list_disk_identifier(struct fdisk_context *cxt)
++{
++	struct fdisk_label *lb = fdisk_get_label(cxt, NULL);
++	char *id = NULL;
++
++	if (fdisk_has_label(cxt))
++		fdisk_info(cxt, _("Disklabel type: %s"),
++				fdisk_label_get_name(lb));
++
++	if (!fdisk_is_details(cxt) && fdisk_get_disklabel_id(cxt, &id) == 0 && id) {
++		fdisk_info(cxt, _("Disk identifier: %s"), id);
++		free(id);
++	}
++}
+ 
+ void list_disk_geometry(struct fdisk_context *cxt)
+ {
+-	char *id = NULL;
+ 	struct fdisk_label *lb = fdisk_get_label(cxt, NULL);
+ 	uint64_t bytes = fdisk_get_nsectors(cxt) * fdisk_get_sector_size(cxt);
+ 	char *strsz = size_to_human_string(SIZE_SUFFIX_SPACE
+@@ -71,14 +84,8 @@ void list_disk_geometry(struct fdisk_context *cxt)
+ 	if (fdisk_get_alignment_offset(cxt))
+ 		fdisk_info(cxt, _("Alignment offset: %lu bytes"),
+ 				fdisk_get_alignment_offset(cxt));
+-	if (fdisk_has_label(cxt))
+-		fdisk_info(cxt, _("Disklabel type: %s"),
+-				fdisk_label_get_name(lb));
+ 
+-	if (!fdisk_is_details(cxt) && fdisk_get_disklabel_id(cxt, &id) == 0 && id) {
+-		fdisk_info(cxt, _("Disk identifier: %s"), id);
+-		free(id);
+-	}
++	list_disk_identifier(cxt);
+ }
+ 
+ void list_disklabel(struct fdisk_context *cxt)
+diff --git a/disk-utils/fdisk-list.h b/disk-utils/fdisk-list.h
+index eddab92..4ed5c25 100644
+--- a/disk-utils/fdisk-list.h
++++ b/disk-utils/fdisk-list.h
+@@ -2,6 +2,7 @@
+ #define UTIL_LINUX_FDISK_LIST_H
+ 
+ extern void list_disklabel(struct fdisk_context *cxt);
++extern void list_disk_identifier(struct fdisk_context *cxt);
+ extern void list_disk_geometry(struct fdisk_context *cxt);
+ extern void list_freespace(struct fdisk_context *cxt);
+ 
+diff --git a/disk-utils/sfdisk.8 b/disk-utils/sfdisk.8
+index fcde872..efe4a86 100644
+--- a/disk-utils/sfdisk.8
++++ b/disk-utils/sfdisk.8
+@@ -212,7 +212,10 @@ Deprecated option.  Only the sector unit is supported.
+ .BR \-X , " \-\-label " \fItype
+ Specify the disk label type (e.g. \fBdos\fR, \fBgpt\fR, ...).  If this option
+ is not given, then \fBsfdisk\fR defaults to the existing label, but if there
+-is no label on the device yet, then the type defaults to \fBdos\fR.
++is no label on the device yet, then the type defaults to \fBdos\fR. The default
++or the current label may be overwritten by the "label: <name>" script header
++line. The option \fB\-\-label\fR does not force \fBsfdisk\fR to create empty
++disk label (see the \fBEMPTY DISK LABEL\fR section below).
+ .TP
+ .BR \-Y , " \-\-label\-nested " \fItype
+ Force editing of a nested disk label.  The primary disk label has to exist already.
+@@ -404,6 +407,19 @@ For backward compatibility the \fBId=\fR field has the same meaning.
+ .RE
+ .RE
+ 
++.SH "EMPTY DISK LABEL"
++.B sfdisk
++does not create partition table without partitions by default. The lines with
++partitions are expected in the script by default. The empty partition table has
++to be explicitly requested by "label: <name>" script header line without any
++partitions lines. For example:
++.RS
++.sp
++.B "echo 'label: gpt' | sfdisk /dev/sdb"
++.sp
++.RE
++creates empty GPT partition table. Note that the \fB\-\-append\fR disables this feature.
++
+ .SH "BACKING UP THE PARTITION TABLE"
+ It is recommended to save the layout of your devices.
+ .B sfdisk
+diff --git a/disk-utils/sfdisk.c b/disk-utils/sfdisk.c
+index 10307ad..2d65974 100644
+--- a/disk-utils/sfdisk.c
++++ b/disk-utils/sfdisk.c
+@@ -1766,8 +1766,25 @@ static int command_fdisk(struct sfdisk *sf, int argc, char **argv)
+ 		}
+ 	} while (1);
+ 
++	/* create empty disk label if label, but no partition specified */
++	if (rc == SFDISK_DONE_EOF && created == 0
++	    && fdisk_script_has_force_label(dp) == 1
++	    && fdisk_table_get_nents(tb) == 0
++	    && fdisk_script_get_header(dp, "label")) {
++
++		int xrc = fdisk_apply_script_headers(sf->cxt, dp);
++		created = !xrc;
++		if (xrc) {
++			fdisk_warnx(sf->cxt, _(
++				  "Failed to apply script headers, "
++				  "disk label not created."));
++			rc = SFDISK_DONE_ABORT;
++		}
++	}
++
+ 	if (!sf->quiet && rc != SFDISK_DONE_ABORT) {
+ 		fdisk_info(sf->cxt, _("\nNew situation:"));
++		list_disk_identifier(sf->cxt);
+ 		list_disklabel(sf->cxt);
+ 	}
+ 
+diff --git a/libfdisk/src/libfdisk.h.in b/libfdisk/src/libfdisk.h.in
+index 9154f5b..59cce19 100644
+--- a/libfdisk/src/libfdisk.h.in
++++ b/libfdisk/src/libfdisk.h.in
+@@ -642,6 +642,7 @@ const char *fdisk_script_get_header(struct fdisk_script *dp, const char *name);
+ int fdisk_script_set_header(struct fdisk_script *dp, const char *name, const char *data);
+ struct fdisk_table *fdisk_script_get_table(struct fdisk_script *dp);
+ int fdisk_script_get_nlines(struct fdisk_script *dp);
++int fdisk_script_has_force_label(struct fdisk_script *dp);
+ 
+ int fdisk_script_set_userdata(struct fdisk_script *dp, void *data);
+ void *fdisk_script_get_userdata(struct fdisk_script *dp);
+diff --git a/libfdisk/src/libfdisk.sym b/libfdisk/src/libfdisk.sym
+index 02cd7a8..d6d4ac5 100644
+--- a/libfdisk/src/libfdisk.sym
++++ b/libfdisk/src/libfdisk.sym
+@@ -274,3 +274,8 @@ FDISK_2.29 {
+ 	fdisk_labelitem_is_number;
+ 	fdisk_gpt_set_npartitions;
+ } FDISK_2.28;
++
++
++FDISK_2.30 {
++	fdisk_script_has_force_label;
++} FDISK_2.29;
+diff --git a/libfdisk/src/script.c b/libfdisk/src/script.c
+index ae7e99a..0d1f260 100644
+--- a/libfdisk/src/script.c
++++ b/libfdisk/src/script.c
+@@ -36,7 +36,8 @@ struct fdisk_script {
+ 	size_t			nlines;
+ 	struct fdisk_label	*label;
+ 
+-	unsigned int		json : 1;		/* JSON output */
++	unsigned int		json : 1,		/* JSON output */
++				force_label : 1;	/* label: <name> specified */
+ };
+ 
+ 
+@@ -354,6 +355,22 @@ int fdisk_script_get_nlines(struct fdisk_script *dp)
+ }
+ 
+ /**
++ * fdisk_script_has_force_label:
++ * @dp: script
++ *
++ * Note that fdisk_script_set_header(dp, "label", name) does not modify
++ * force_label status. The label has to be specified by script.
++ *
++ * Returns: true if "label: <name>" has been parsed.
++ */
++int fdisk_script_has_force_label(struct fdisk_script *dp)
++{
++	assert(dp);
++	return dp->force_label;
++}
++
++
++/**
+  * fdisk_script_read_context:
+  * @dp: script
+  * @cxt: context
+@@ -706,6 +723,7 @@ static int parse_line_header(struct fdisk_script *dp, char *s)
+ 	if (strcmp(name, "label") == 0) {
+ 		if (dp->cxt && !fdisk_get_label(dp->cxt, value))
+ 			goto done;			/* unknown label name */
++		dp->force_label = 1;
+ 	} else if (strcmp(name, "unit") == 0) {
+ 		if (strcmp(value, "sectors") != 0)
+ 			goto done;			/* only "sectors" supported */
+-- 
+2.10.2
+

Copied: util-linux/repos/staging-i686/PKGBUILD (from rev 284579, util-linux/trunk/PKGBUILD)
===================================================================
--- staging-i686/PKGBUILD	                        (rev 0)
+++ staging-i686/PKGBUILD	2016-12-24 10:59:21 UTC (rev 284580)
@@ -0,0 +1,117 @@
+# $Id$
+# Maintainer: Tom Gundersen <teg at jklm.no>
+# Maintainer: Dave Reisner <dreisner at archlinux.org>
+# Contributor: judd <jvinet at zeroflux.org>
+
+pkgbase=util-linux
+pkgname=(util-linux libutil-linux)
+_pkgmajor=2.29
+pkgver=${_pkgmajor}
+pkgrel=2
+pkgdesc="Miscellaneous system utilities for Linux"
+url="https://www.kernel.org/pub/linux/utils/util-linux/"
+arch=('i686' 'x86_64')
+makedepends=('systemd' 'python')
+license=('GPL2')
+options=('strip' 'debug')
+validpgpkeys=('B0C64D14301CC6EFAEDF60E4E4B71D5EEC39C284')  # Karel Zak
+source=("https://www.kernel.org/pub/linux/utils/util-linux/v$_pkgmajor/$pkgbase-$pkgver.tar."{xz,sign}
+        pam-{login,common,su}
+        '0001-sfdisk-don-t-be-silent-when-list-non-existing-device.patch'
+        '0001-sfdisk-cleanup-dump-error-messages.patch'
+        '0001-sfdisk-support-empty-label-use-case.patch'
+        '0001-chrt-default-to-SCHED_RR-policy.patch'
+        '0001-lsns-Fix-parser-for-proc-pid-stat-which-is-including.patch')
+md5sums=('07b6845f48a421ad5844aa9d58edb837'
+         'SKIP'
+         '4368b3f98abd8a32662e094c54e7f9b1'
+         'a31374fef2cba0ca34dfc7078e2969e4'
+         'fa85e5cce5d723275b14365ba71a8aad'
+         '3fce7192ce1b3d97fdffd0226ed63a90'
+         '2f3c061865360170cacda948035fd02d'
+         '6d2e3915124938577f0ff18ef701c87f'
+         '168c1cb2cfe7d4eddfc6e3f3b19d3ced'
+         '68c2076a9a09564ba0c9776540a175fa')
+
+prepare() {
+  cd "$pkgbase-$pkgver"
+
+  patch -Np1 <../0001-sfdisk-don-t-be-silent-when-list-non-existing-device.patch
+  patch -Np1 <../0001-sfdisk-cleanup-dump-error-messages.patch
+  patch -Np1 <../0001-sfdisk-support-empty-label-use-case.patch
+  patch -Np1 <../0001-chrt-default-to-SCHED_RR-policy.patch
+  patch -Np1 <../0001-lsns-Fix-parser-for-proc-pid-stat-which-is-including.patch
+}
+
+build() {
+  cd "$pkgbase-$pkgver"
+
+  ./configure --prefix=/usr \
+              --libdir=/usr/lib \
+              --bindir=/usr/bin \
+              --localstatedir=/run \
+              --enable-fs-paths-extra=/usr/bin \
+              --enable-raw \
+              --enable-vipw \
+              --enable-newgrp \
+              --enable-chfn-chsh \
+              --enable-write \
+              --enable-mesg \
+              --disable-tailf \
+              --with-python=3
+
+  make
+}
+
+package_util-linux() {
+  conflicts=('util-linux-ng' 'eject' 'zramctl')
+  provides=("util-linux-ng=$pkgver" 'eject' 'zramctl')
+  replaces=('zramctl')
+  depends=('pam' 'shadow' 'coreutils' 'libsystemd' 'libutil-linux')
+  optdepends=('python: python bindings to libmount')
+  groups=('base' 'base-devel')
+  backup=(etc/pam.d/chfn
+          etc/pam.d/chsh
+          etc/pam.d/login
+          etc/pam.d/su
+          etc/pam.d/su-l)
+
+  cd "$pkgbase-$pkgver"
+
+  make DESTDIR="$pkgdir" install
+
+  # setuid chfn and chsh
+  chmod 4755 "$pkgdir"/usr/bin/{newgrp,ch{sh,fn}}
+
+  # install PAM files for login-utils
+  install -Dm644 "$srcdir/pam-common" "$pkgdir/etc/pam.d/chfn"
+  install -m644 "$srcdir/pam-common" "$pkgdir/etc/pam.d/chsh"
+  install -m644 "$srcdir/pam-login" "$pkgdir/etc/pam.d/login"
+  install -m644 "$srcdir/pam-su" "$pkgdir/etc/pam.d/su"
+  install -m644 "$srcdir/pam-su" "$pkgdir/etc/pam.d/su-l"
+
+  # TODO(dreisner): offer this upstream?
+  sed -i '/ListenStream/ aRuntimeDirectory=uuidd' "$pkgdir/usr/lib/systemd/system/uuidd.socket"
+
+  # adjust for usrmove
+  # TODO(dreisner): fix configure.ac upstream so that this isn't needed
+  cd "$pkgdir"
+  mv {,usr/}sbin/* usr/bin
+  rmdir sbin usr/sbin
+
+  ### runtime libs are shipped as part of libutil-linux
+  rm "$pkgdir"/usr/lib/lib*.{a,so}*
+
+  ### tailf has been deprecated for a while. let's not include it anymore.
+  rm \
+    "$pkgdir"/usr/bin/tailf \
+    "$pkgdir"/usr/share/bash-completion/completions/tailf \
+    "$pkgdir"/usr/share/man/man1/tailf.1
+}
+
+package_libutil-linux() {
+  pkgdesc="util-linux runtime libraries"
+  provides=('libblkid.so' 'libfdisk.so' 'libmount.so' 'libsmartcols.so' 'libuuid.so')
+
+  make -C "$pkgbase-$pkgver" DESTDIR="$pkgdir" install-usrlib_execLTLIBRARIES
+}

Copied: util-linux/repos/staging-i686/pam-common (from rev 284579, util-linux/trunk/pam-common)
===================================================================
--- staging-i686/pam-common	                        (rev 0)
+++ staging-i686/pam-common	2016-12-24 10:59:21 UTC (rev 284580)
@@ -0,0 +1,6 @@
+#%PAM-1.0
+auth		sufficient	pam_rootok.so
+auth		required	pam_unix.so
+account		required	pam_unix.so
+session		required	pam_unix.so
+password	required	pam_permit.so

Copied: util-linux/repos/staging-i686/pam-login (from rev 284579, util-linux/trunk/pam-login)
===================================================================
--- staging-i686/pam-login	                        (rev 0)
+++ staging-i686/pam-login	2016-12-24 10:59:21 UTC (rev 284580)
@@ -0,0 +1,7 @@
+#%PAM-1.0
+
+auth       required     pam_securetty.so
+auth       requisite    pam_nologin.so
+auth       include      system-local-login
+account    include      system-local-login
+session    include      system-local-login

Copied: util-linux/repos/staging-i686/pam-su (from rev 284579, util-linux/trunk/pam-su)
===================================================================
--- staging-i686/pam-su	                        (rev 0)
+++ staging-i686/pam-su	2016-12-24 10:59:21 UTC (rev 284580)
@@ -0,0 +1,9 @@
+#%PAM-1.0
+auth		sufficient	pam_rootok.so
+# Uncomment the following line to implicitly trust users in the "wheel" group.
+#auth		sufficient	pam_wheel.so trust use_uid
+# Uncomment the following line to require a user to be in the "wheel" group.
+#auth		required	pam_wheel.so use_uid
+auth		required	pam_unix.so
+account		required	pam_unix.so
+session		required	pam_unix.so

Copied: util-linux/repos/staging-x86_64/0001-chrt-default-to-SCHED_RR-policy.patch (from rev 284579, util-linux/trunk/0001-chrt-default-to-SCHED_RR-policy.patch)
===================================================================
--- staging-x86_64/0001-chrt-default-to-SCHED_RR-policy.patch	                        (rev 0)
+++ staging-x86_64/0001-chrt-default-to-SCHED_RR-policy.patch	2016-12-24 10:59:21 UTC (rev 284580)
@@ -0,0 +1,39 @@
+From c7adc2f204f19167f781fa2ee739e0ca386fc4f5 Mon Sep 17 00:00:00 2001
+From: Andreas Henriksson <andreas at fatal.se>
+Date: Fri, 2 Dec 2016 15:10:18 +0100
+Subject: [PATCH] chrt: default to SCHED_RR policy
+
+This fixes a regression introduced in:
+
+commit 7a4ea5664edba98bff28adec3a9c3cfb5763a495
+"chrt: add control struct"
+
+Previously (and as documented in the manpage) the default policy
+was SCHED_RR. Now it's implicitly SCHED_OTHER (0) as the value
+is not initialized explicitly anymore.
+
+Test-command: chrt 90 echo hello
+
+Reported-by: Patrick Pelissier <patrick.pelissier at gmail.com>
+Addresses: http://bugs.debian.org/846572
+Signed-off-by: Andreas Henriksson <andreas at fatal.se>
+---
+ schedutils/chrt.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/schedutils/chrt.c b/schedutils/chrt.c
+index a861d9f..73d1ffa 100644
+--- a/schedutils/chrt.c
++++ b/schedutils/chrt.c
+@@ -409,7 +409,7 @@ static void set_sched(struct chrt_ctl *ctl)
+ 
+ int main(int argc, char **argv)
+ {
+-	struct chrt_ctl _ctl = { .pid = -1 }, *ctl = &_ctl;
++	struct chrt_ctl _ctl = { .pid = -1, .policy = SCHED_RR }, *ctl = &_ctl;
+ 	int c;
+ 
+ 	static const struct option longopts[] = {
+-- 
+2.10.2
+

Copied: util-linux/repos/staging-x86_64/0001-lsns-Fix-parser-for-proc-pid-stat-which-is-including.patch (from rev 284579, util-linux/trunk/0001-lsns-Fix-parser-for-proc-pid-stat-which-is-including.patch)
===================================================================
--- staging-x86_64/0001-lsns-Fix-parser-for-proc-pid-stat-which-is-including.patch	                        (rev 0)
+++ staging-x86_64/0001-lsns-Fix-parser-for-proc-pid-stat-which-is-including.patch	2016-12-24 10:59:21 UTC (rev 284580)
@@ -0,0 +1,79 @@
+From 3fcbd7978980dc1a29c626b701333e27599e506d Mon Sep 17 00:00:00 2001
+From: OGAWA Hirofumi <hirofumi at mail.parknet.co.jp>
+Date: Wed, 23 Nov 2016 14:13:34 +0900
+Subject: [PATCH] lsns: Fix parser for /proc/<pid>/stat which is including
+ space in comm
+
+For example, child process of spamd has
+
+    32031 (spamd child) S 32026 32026 32026 0 -1 4210752 338 0 0 0 ...
+
+fscanf("%d %*s %c %d*[^\n]") in read_process() can't parse above as we
+expected, because %s only skips non-whitespace. I.e. it parses like
+following,
+
+    32031 (spamd child) S 32026 32026 32026 0 -1 4210752 338 0 0 0 ...
+    +---+ +----+ +
+      %d    %*s  %c
+
+and returns 2 (pid=32031, state=c).
+
+This fixes it by skipping task->comm part manually.
+
+Signed-off-by: OGAWA Hirofumi <hirofumi at mail.parknet.co.jp>
+---
+ sys-utils/lsns.c | 30 ++++++++++++++++++++++++++----
+ 1 file changed, 26 insertions(+), 4 deletions(-)
+
+diff --git a/sys-utils/lsns.c b/sys-utils/lsns.c
+index e4fd208..809737c 100644
+--- a/sys-utils/lsns.c
++++ b/sys-utils/lsns.c
+@@ -217,6 +217,30 @@ static int get_ns_ino(int dir, const char *nsname, ino_t *ino)
+ 	return 0;
+ }
+ 
++static int parse_proc_stat(FILE *fp, pid_t *pid, char *state, pid_t *ppid)
++{
++	char *line = NULL, *p;
++	size_t len = 0;
++	int rc;
++
++	if (getline(&line, &len, fp) < 0) {
++		rc = -errno;
++		goto error;
++	}
++
++	p = strrchr(line, ')');
++	if (p == NULL ||
++	    sscanf(line, "%d (", pid) != 1 ||
++	    sscanf(p, ") %c %d*[^\n]", state, ppid) != 2) {
++		rc = -EINVAL;
++		goto error;
++	}
++	rc = 0;
++
++error:
++	free(line);
++	return rc;
++}
+ 
+ static int read_process(struct lsns *ls, pid_t pid)
+ {
+@@ -255,11 +279,9 @@ static int read_process(struct lsns *ls, pid_t pid)
+ 		rc = -errno;
+ 		goto done;
+ 	}
+-	rc = fscanf(f, "%d %*s %c %d*[^\n]", &p->pid, &p->state, &p->ppid);
+-	if (rc != 3) {
+-		rc = rc < 0 ? -errno : -EINVAL;
++	rc = parse_proc_stat(f, &p->pid, &p->state, &p->ppid);
++	if (rc < 0)
+ 		goto done;
+-	}
+ 	rc = 0;
+ 
+ 	for (i = 0; i < ARRAY_SIZE(p->ns_ids); i++) {
+-- 
+2.10.2
+

Copied: util-linux/repos/staging-x86_64/0001-sfdisk-cleanup-dump-error-messages.patch (from rev 284579, util-linux/trunk/0001-sfdisk-cleanup-dump-error-messages.patch)
===================================================================
--- staging-x86_64/0001-sfdisk-cleanup-dump-error-messages.patch	                        (rev 0)
+++ staging-x86_64/0001-sfdisk-cleanup-dump-error-messages.patch	2016-12-24 10:59:21 UTC (rev 284580)
@@ -0,0 +1,44 @@
+From c49b765a6e9031642e2bb846e93dddc6827e4b28 Mon Sep 17 00:00:00 2001
+From: Karel Zak <kzak at redhat.com>
+Date: Wed, 30 Nov 2016 10:53:56 +0100
+Subject: [PATCH] sfdisk: cleanup --dump error messages
+
+old:
+  # truncate -s 1G empty && ./sfdisk --dump empty
+  sfdisk: failed to dump partition table: Success
+
+new:
+  # truncate -s 1G empty && ./sfdisk --dump empty
+  sfdisk: empty: does not contain a recognized partition table.
+
+Addresses: https://github.com/karelzak/util-linux/issues/375
+Signed-off-by: Karel Zak <kzak at redhat.com>
+---
+ disk-utils/sfdisk.c | 5 ++++-
+ 1 file changed, 4 insertions(+), 1 deletion(-)
+
+diff --git a/disk-utils/sfdisk.c b/disk-utils/sfdisk.c
+index 0f69d65..10307ad 100644
+--- a/disk-utils/sfdisk.c
++++ b/disk-utils/sfdisk.c
+@@ -950,13 +950,16 @@ static int command_dump(struct sfdisk *sf, int argc, char **argv)
+ 	if (rc)
+ 		err(EXIT_FAILURE, _("cannot open %s"), devname);
+ 
++	if (!fdisk_has_label(sf->cxt))
++		errx(EXIT_FAILURE, _("%s: does not contain a recognized partition table"), devname);
++
+ 	dp = fdisk_new_script(sf->cxt);
+ 	if (!dp)
+ 		err(EXIT_FAILURE, _("failed to allocate dump struct"));
+ 
+ 	rc = fdisk_script_read_context(dp, NULL);
+ 	if (rc)
+-		err(EXIT_FAILURE, _("failed to dump partition table"));
++		errx(EXIT_FAILURE, _("%s: failed to dump partition table"), devname);
+ 
+ 	if (sf->json)
+ 		fdisk_script_enable_json(dp, 1);
+-- 
+2.10.2
+

Copied: util-linux/repos/staging-x86_64/0001-sfdisk-don-t-be-silent-when-list-non-existing-device.patch (from rev 284579, util-linux/trunk/0001-sfdisk-don-t-be-silent-when-list-non-existing-device.patch)
===================================================================
--- staging-x86_64/0001-sfdisk-don-t-be-silent-when-list-non-existing-device.patch	                        (rev 0)
+++ staging-x86_64/0001-sfdisk-don-t-be-silent-when-list-non-existing-device.patch	2016-12-24 10:59:21 UTC (rev 284580)
@@ -0,0 +1,70 @@
+From fed304837f60b626f6198663990e76e506f89063 Mon Sep 17 00:00:00 2001
+From: Karel Zak <kzak at redhat.com>
+Date: Tue, 29 Nov 2016 15:58:18 +0100
+Subject: [PATCH] sfdisk: don't be silent when list non-existing device
+
+Addresses: https://github.com/karelzak/util-linux/issues/376
+Signed-off-by: Karel Zak <kzak at redhat.com>
+---
+ disk-utils/sfdisk.c | 16 ++++++++++------
+ 1 file changed, 10 insertions(+), 6 deletions(-)
+
+diff --git a/disk-utils/sfdisk.c b/disk-utils/sfdisk.c
+index 52f2a6d..0f69d65 100644
+--- a/disk-utils/sfdisk.c
++++ b/disk-utils/sfdisk.c
+@@ -560,6 +560,7 @@ static int write_changes(struct sfdisk *sf)
+  */
+ static int command_list_partitions(struct sfdisk *sf, int argc, char **argv)
+ {
++	int fail = 0;
+ 	fdisk_enable_listonly(sf->cxt, 1);
+ 
+ 	if (argc) {
+@@ -568,13 +569,14 @@ static int command_list_partitions(struct sfdisk *sf, int argc, char **argv)
+ 		for (i = 0; i < argc; i++) {
+ 			if (ct)
+ 				fputs("\n\n", stdout);
+-			if (print_device_pt(sf->cxt, argv[i], 0, sf->verify) == 0)
+-				ct++;
++			if (print_device_pt(sf->cxt, argv[i], 1, sf->verify) != 0)
++				fail++;
++			ct++;
+ 		}
+ 	} else
+ 		print_all_devices_pt(sf->cxt, sf->verify);
+ 
+-	return 0;
++	return fail;
+ }
+ 
+ /*
+@@ -582,6 +584,7 @@ static int command_list_partitions(struct sfdisk *sf, int argc, char **argv)
+  */
+ static int command_list_freespace(struct sfdisk *sf, int argc, char **argv)
+ {
++	int fail = 0;
+ 	fdisk_enable_listonly(sf->cxt, 1);
+ 
+ 	if (argc) {
+@@ -590,13 +593,14 @@ static int command_list_freespace(struct sfdisk *sf, int argc, char **argv)
+ 		for (i = 0; i < argc; i++) {
+ 			if (ct)
+ 				fputs("\n\n", stdout);
+-			if (print_device_freespace(sf->cxt, argv[i], 0) == 0)
+-				ct++;
++			if (print_device_freespace(sf->cxt, argv[i], 1) != 0)
++				fail++;
++			ct++;
+ 		}
+ 	} else
+ 		print_all_devices_freespace(sf->cxt);
+ 
+-	return 0;
++	return fail;
+ }
+ 
+ /*
+-- 
+2.10.2
+

Copied: util-linux/repos/staging-x86_64/0001-sfdisk-support-empty-label-use-case.patch (from rev 284579, util-linux/trunk/0001-sfdisk-support-empty-label-use-case.patch)
===================================================================
--- staging-x86_64/0001-sfdisk-support-empty-label-use-case.patch	                        (rev 0)
+++ staging-x86_64/0001-sfdisk-support-empty-label-use-case.patch	2016-12-24 10:59:21 UTC (rev 284580)
@@ -0,0 +1,223 @@
+From 35ca51182782193f555fbdcb06bb10766550d017 Mon Sep 17 00:00:00 2001
+From: Karel Zak <kzak at redhat.com>
+Date: Wed, 30 Nov 2016 12:43:10 +0100
+Subject: [PATCH] sfdisk: support empty label use-case
+
+By default sfdisk creates partition table when a first partition is
+specified, otherwise the device is not modified. This force users to
+create at least one partition.
+
+This commit allows to create empty label without partitions if "label:
+<name>" header line is specified by script.
+
+The commit also modifies "New situation:" output to list label name
+and label identifier.
+
+Addresses: https://github.com/karelzak/util-linux/issues/374
+Signed-off-by: Karel Zak <kzak at redhat.com>
+---
+ disk-utils/fdisk-list.c    | 23 +++++++++++++++--------
+ disk-utils/fdisk-list.h    |  1 +
+ disk-utils/sfdisk.8        | 18 +++++++++++++++++-
+ disk-utils/sfdisk.c        | 17 +++++++++++++++++
+ libfdisk/src/libfdisk.h.in |  1 +
+ libfdisk/src/libfdisk.sym  |  5 +++++
+ libfdisk/src/script.c      | 20 +++++++++++++++++++-
+ 7 files changed, 75 insertions(+), 10 deletions(-)
+
+diff --git a/disk-utils/fdisk-list.c b/disk-utils/fdisk-list.c
+index e6b2033..c9560f4 100644
+--- a/disk-utils/fdisk-list.c
++++ b/disk-utils/fdisk-list.c
+@@ -34,10 +34,23 @@ static int is_ide_cdrom_or_tape(char *device)
+ 	return ret;
+ }
+ 
++void list_disk_identifier(struct fdisk_context *cxt)
++{
++	struct fdisk_label *lb = fdisk_get_label(cxt, NULL);
++	char *id = NULL;
++
++	if (fdisk_has_label(cxt))
++		fdisk_info(cxt, _("Disklabel type: %s"),
++				fdisk_label_get_name(lb));
++
++	if (!fdisk_is_details(cxt) && fdisk_get_disklabel_id(cxt, &id) == 0 && id) {
++		fdisk_info(cxt, _("Disk identifier: %s"), id);
++		free(id);
++	}
++}
+ 
+ void list_disk_geometry(struct fdisk_context *cxt)
+ {
+-	char *id = NULL;
+ 	struct fdisk_label *lb = fdisk_get_label(cxt, NULL);
+ 	uint64_t bytes = fdisk_get_nsectors(cxt) * fdisk_get_sector_size(cxt);
+ 	char *strsz = size_to_human_string(SIZE_SUFFIX_SPACE
+@@ -71,14 +84,8 @@ void list_disk_geometry(struct fdisk_context *cxt)
+ 	if (fdisk_get_alignment_offset(cxt))
+ 		fdisk_info(cxt, _("Alignment offset: %lu bytes"),
+ 				fdisk_get_alignment_offset(cxt));
+-	if (fdisk_has_label(cxt))
+-		fdisk_info(cxt, _("Disklabel type: %s"),
+-				fdisk_label_get_name(lb));
+ 
+-	if (!fdisk_is_details(cxt) && fdisk_get_disklabel_id(cxt, &id) == 0 && id) {
+-		fdisk_info(cxt, _("Disk identifier: %s"), id);
+-		free(id);
+-	}
++	list_disk_identifier(cxt);
+ }
+ 
+ void list_disklabel(struct fdisk_context *cxt)
+diff --git a/disk-utils/fdisk-list.h b/disk-utils/fdisk-list.h
+index eddab92..4ed5c25 100644
+--- a/disk-utils/fdisk-list.h
++++ b/disk-utils/fdisk-list.h
+@@ -2,6 +2,7 @@
+ #define UTIL_LINUX_FDISK_LIST_H
+ 
+ extern void list_disklabel(struct fdisk_context *cxt);
++extern void list_disk_identifier(struct fdisk_context *cxt);
+ extern void list_disk_geometry(struct fdisk_context *cxt);
+ extern void list_freespace(struct fdisk_context *cxt);
+ 
+diff --git a/disk-utils/sfdisk.8 b/disk-utils/sfdisk.8
+index fcde872..efe4a86 100644
+--- a/disk-utils/sfdisk.8
++++ b/disk-utils/sfdisk.8
+@@ -212,7 +212,10 @@ Deprecated option.  Only the sector unit is supported.
+ .BR \-X , " \-\-label " \fItype
+ Specify the disk label type (e.g. \fBdos\fR, \fBgpt\fR, ...).  If this option
+ is not given, then \fBsfdisk\fR defaults to the existing label, but if there
+-is no label on the device yet, then the type defaults to \fBdos\fR.
++is no label on the device yet, then the type defaults to \fBdos\fR. The default
++or the current label may be overwritten by the "label: <name>" script header
++line. The option \fB\-\-label\fR does not force \fBsfdisk\fR to create empty
++disk label (see the \fBEMPTY DISK LABEL\fR section below).
+ .TP
+ .BR \-Y , " \-\-label\-nested " \fItype
+ Force editing of a nested disk label.  The primary disk label has to exist already.
+@@ -404,6 +407,19 @@ For backward compatibility the \fBId=\fR field has the same meaning.
+ .RE
+ .RE
+ 
++.SH "EMPTY DISK LABEL"
++.B sfdisk
++does not create partition table without partitions by default. The lines with
++partitions are expected in the script by default. The empty partition table has
++to be explicitly requested by "label: <name>" script header line without any
++partitions lines. For example:
++.RS
++.sp
++.B "echo 'label: gpt' | sfdisk /dev/sdb"
++.sp
++.RE
++creates empty GPT partition table. Note that the \fB\-\-append\fR disables this feature.
++
+ .SH "BACKING UP THE PARTITION TABLE"
+ It is recommended to save the layout of your devices.
+ .B sfdisk
+diff --git a/disk-utils/sfdisk.c b/disk-utils/sfdisk.c
+index 10307ad..2d65974 100644
+--- a/disk-utils/sfdisk.c
++++ b/disk-utils/sfdisk.c
+@@ -1766,8 +1766,25 @@ static int command_fdisk(struct sfdisk *sf, int argc, char **argv)
+ 		}
+ 	} while (1);
+ 
++	/* create empty disk label if label, but no partition specified */
++	if (rc == SFDISK_DONE_EOF && created == 0
++	    && fdisk_script_has_force_label(dp) == 1
++	    && fdisk_table_get_nents(tb) == 0
++	    && fdisk_script_get_header(dp, "label")) {
++
++		int xrc = fdisk_apply_script_headers(sf->cxt, dp);
++		created = !xrc;
++		if (xrc) {
++			fdisk_warnx(sf->cxt, _(
++				  "Failed to apply script headers, "
++				  "disk label not created."));
++			rc = SFDISK_DONE_ABORT;
++		}
++	}
++
+ 	if (!sf->quiet && rc != SFDISK_DONE_ABORT) {
+ 		fdisk_info(sf->cxt, _("\nNew situation:"));
++		list_disk_identifier(sf->cxt);
+ 		list_disklabel(sf->cxt);
+ 	}
+ 
+diff --git a/libfdisk/src/libfdisk.h.in b/libfdisk/src/libfdisk.h.in
+index 9154f5b..59cce19 100644
+--- a/libfdisk/src/libfdisk.h.in
++++ b/libfdisk/src/libfdisk.h.in
+@@ -642,6 +642,7 @@ const char *fdisk_script_get_header(struct fdisk_script *dp, const char *name);
+ int fdisk_script_set_header(struct fdisk_script *dp, const char *name, const char *data);
+ struct fdisk_table *fdisk_script_get_table(struct fdisk_script *dp);
+ int fdisk_script_get_nlines(struct fdisk_script *dp);
++int fdisk_script_has_force_label(struct fdisk_script *dp);
+ 
+ int fdisk_script_set_userdata(struct fdisk_script *dp, void *data);
+ void *fdisk_script_get_userdata(struct fdisk_script *dp);
+diff --git a/libfdisk/src/libfdisk.sym b/libfdisk/src/libfdisk.sym
+index 02cd7a8..d6d4ac5 100644
+--- a/libfdisk/src/libfdisk.sym
++++ b/libfdisk/src/libfdisk.sym
+@@ -274,3 +274,8 @@ FDISK_2.29 {
+ 	fdisk_labelitem_is_number;
+ 	fdisk_gpt_set_npartitions;
+ } FDISK_2.28;
++
++
++FDISK_2.30 {
++	fdisk_script_has_force_label;
++} FDISK_2.29;
+diff --git a/libfdisk/src/script.c b/libfdisk/src/script.c
+index ae7e99a..0d1f260 100644
+--- a/libfdisk/src/script.c
++++ b/libfdisk/src/script.c
+@@ -36,7 +36,8 @@ struct fdisk_script {
+ 	size_t			nlines;
+ 	struct fdisk_label	*label;
+ 
+-	unsigned int		json : 1;		/* JSON output */
++	unsigned int		json : 1,		/* JSON output */
++				force_label : 1;	/* label: <name> specified */
+ };
+ 
+ 
+@@ -354,6 +355,22 @@ int fdisk_script_get_nlines(struct fdisk_script *dp)
+ }
+ 
+ /**
++ * fdisk_script_has_force_label:
++ * @dp: script
++ *
++ * Note that fdisk_script_set_header(dp, "label", name) does not modify
++ * force_label status. The label has to be specified by script.
++ *
++ * Returns: true if "label: <name>" has been parsed.
++ */
++int fdisk_script_has_force_label(struct fdisk_script *dp)
++{
++	assert(dp);
++	return dp->force_label;
++}
++
++
++/**
+  * fdisk_script_read_context:
+  * @dp: script
+  * @cxt: context
+@@ -706,6 +723,7 @@ static int parse_line_header(struct fdisk_script *dp, char *s)
+ 	if (strcmp(name, "label") == 0) {
+ 		if (dp->cxt && !fdisk_get_label(dp->cxt, value))
+ 			goto done;			/* unknown label name */
++		dp->force_label = 1;
+ 	} else if (strcmp(name, "unit") == 0) {
+ 		if (strcmp(value, "sectors") != 0)
+ 			goto done;			/* only "sectors" supported */
+-- 
+2.10.2
+

Copied: util-linux/repos/staging-x86_64/PKGBUILD (from rev 284579, util-linux/trunk/PKGBUILD)
===================================================================
--- staging-x86_64/PKGBUILD	                        (rev 0)
+++ staging-x86_64/PKGBUILD	2016-12-24 10:59:21 UTC (rev 284580)
@@ -0,0 +1,117 @@
+# $Id$
+# Maintainer: Tom Gundersen <teg at jklm.no>
+# Maintainer: Dave Reisner <dreisner at archlinux.org>
+# Contributor: judd <jvinet at zeroflux.org>
+
+pkgbase=util-linux
+pkgname=(util-linux libutil-linux)
+_pkgmajor=2.29
+pkgver=${_pkgmajor}
+pkgrel=2
+pkgdesc="Miscellaneous system utilities for Linux"
+url="https://www.kernel.org/pub/linux/utils/util-linux/"
+arch=('i686' 'x86_64')
+makedepends=('systemd' 'python')
+license=('GPL2')
+options=('strip' 'debug')
+validpgpkeys=('B0C64D14301CC6EFAEDF60E4E4B71D5EEC39C284')  # Karel Zak
+source=("https://www.kernel.org/pub/linux/utils/util-linux/v$_pkgmajor/$pkgbase-$pkgver.tar."{xz,sign}
+        pam-{login,common,su}
+        '0001-sfdisk-don-t-be-silent-when-list-non-existing-device.patch'
+        '0001-sfdisk-cleanup-dump-error-messages.patch'
+        '0001-sfdisk-support-empty-label-use-case.patch'
+        '0001-chrt-default-to-SCHED_RR-policy.patch'
+        '0001-lsns-Fix-parser-for-proc-pid-stat-which-is-including.patch')
+md5sums=('07b6845f48a421ad5844aa9d58edb837'
+         'SKIP'
+         '4368b3f98abd8a32662e094c54e7f9b1'
+         'a31374fef2cba0ca34dfc7078e2969e4'
+         'fa85e5cce5d723275b14365ba71a8aad'
+         '3fce7192ce1b3d97fdffd0226ed63a90'
+         '2f3c061865360170cacda948035fd02d'
+         '6d2e3915124938577f0ff18ef701c87f'
+         '168c1cb2cfe7d4eddfc6e3f3b19d3ced'
+         '68c2076a9a09564ba0c9776540a175fa')
+
+prepare() {
+  cd "$pkgbase-$pkgver"
+
+  patch -Np1 <../0001-sfdisk-don-t-be-silent-when-list-non-existing-device.patch
+  patch -Np1 <../0001-sfdisk-cleanup-dump-error-messages.patch
+  patch -Np1 <../0001-sfdisk-support-empty-label-use-case.patch
+  patch -Np1 <../0001-chrt-default-to-SCHED_RR-policy.patch
+  patch -Np1 <../0001-lsns-Fix-parser-for-proc-pid-stat-which-is-including.patch
+}
+
+build() {
+  cd "$pkgbase-$pkgver"
+
+  ./configure --prefix=/usr \
+              --libdir=/usr/lib \
+              --bindir=/usr/bin \
+              --localstatedir=/run \
+              --enable-fs-paths-extra=/usr/bin \
+              --enable-raw \
+              --enable-vipw \
+              --enable-newgrp \
+              --enable-chfn-chsh \
+              --enable-write \
+              --enable-mesg \
+              --disable-tailf \
+              --with-python=3
+
+  make
+}
+
+package_util-linux() {
+  conflicts=('util-linux-ng' 'eject' 'zramctl')
+  provides=("util-linux-ng=$pkgver" 'eject' 'zramctl')
+  replaces=('zramctl')
+  depends=('pam' 'shadow' 'coreutils' 'libsystemd' 'libutil-linux')
+  optdepends=('python: python bindings to libmount')
+  groups=('base' 'base-devel')
+  backup=(etc/pam.d/chfn
+          etc/pam.d/chsh
+          etc/pam.d/login
+          etc/pam.d/su
+          etc/pam.d/su-l)
+
+  cd "$pkgbase-$pkgver"
+
+  make DESTDIR="$pkgdir" install
+
+  # setuid chfn and chsh
+  chmod 4755 "$pkgdir"/usr/bin/{newgrp,ch{sh,fn}}
+
+  # install PAM files for login-utils
+  install -Dm644 "$srcdir/pam-common" "$pkgdir/etc/pam.d/chfn"
+  install -m644 "$srcdir/pam-common" "$pkgdir/etc/pam.d/chsh"
+  install -m644 "$srcdir/pam-login" "$pkgdir/etc/pam.d/login"
+  install -m644 "$srcdir/pam-su" "$pkgdir/etc/pam.d/su"
+  install -m644 "$srcdir/pam-su" "$pkgdir/etc/pam.d/su-l"
+
+  # TODO(dreisner): offer this upstream?
+  sed -i '/ListenStream/ aRuntimeDirectory=uuidd' "$pkgdir/usr/lib/systemd/system/uuidd.socket"
+
+  # adjust for usrmove
+  # TODO(dreisner): fix configure.ac upstream so that this isn't needed
+  cd "$pkgdir"
+  mv {,usr/}sbin/* usr/bin
+  rmdir sbin usr/sbin
+
+  ### runtime libs are shipped as part of libutil-linux
+  rm "$pkgdir"/usr/lib/lib*.{a,so}*
+
+  ### tailf has been deprecated for a while. let's not include it anymore.
+  rm \
+    "$pkgdir"/usr/bin/tailf \
+    "$pkgdir"/usr/share/bash-completion/completions/tailf \
+    "$pkgdir"/usr/share/man/man1/tailf.1
+}
+
+package_libutil-linux() {
+  pkgdesc="util-linux runtime libraries"
+  provides=('libblkid.so' 'libfdisk.so' 'libmount.so' 'libsmartcols.so' 'libuuid.so')
+
+  make -C "$pkgbase-$pkgver" DESTDIR="$pkgdir" install-usrlib_execLTLIBRARIES
+}

Copied: util-linux/repos/staging-x86_64/pam-common (from rev 284579, util-linux/trunk/pam-common)
===================================================================
--- staging-x86_64/pam-common	                        (rev 0)
+++ staging-x86_64/pam-common	2016-12-24 10:59:21 UTC (rev 284580)
@@ -0,0 +1,6 @@
+#%PAM-1.0
+auth		sufficient	pam_rootok.so
+auth		required	pam_unix.so
+account		required	pam_unix.so
+session		required	pam_unix.so
+password	required	pam_permit.so

Copied: util-linux/repos/staging-x86_64/pam-login (from rev 284579, util-linux/trunk/pam-login)
===================================================================
--- staging-x86_64/pam-login	                        (rev 0)
+++ staging-x86_64/pam-login	2016-12-24 10:59:21 UTC (rev 284580)
@@ -0,0 +1,7 @@
+#%PAM-1.0
+
+auth       required     pam_securetty.so
+auth       requisite    pam_nologin.so
+auth       include      system-local-login
+account    include      system-local-login
+session    include      system-local-login

Copied: util-linux/repos/staging-x86_64/pam-su (from rev 284579, util-linux/trunk/pam-su)
===================================================================
--- staging-x86_64/pam-su	                        (rev 0)
+++ staging-x86_64/pam-su	2016-12-24 10:59:21 UTC (rev 284580)
@@ -0,0 +1,9 @@
+#%PAM-1.0
+auth		sufficient	pam_rootok.so
+# Uncomment the following line to implicitly trust users in the "wheel" group.
+#auth		sufficient	pam_wheel.so trust use_uid
+# Uncomment the following line to require a user to be in the "wheel" group.
+#auth		required	pam_wheel.so use_uid
+auth		required	pam_unix.so
+account		required	pam_unix.so
+session		required	pam_unix.so



More information about the arch-commits mailing list