From 1ae81e57b4b84450ac1eb9239b037ae647688905 Mon Sep 17 00:00:00 2001 From: Karel Zak Date: Mon, 15 Apr 2013 11:36:37 +0200 Subject: [PATCH 1/2] 2.23-0.7: remove unused patches Signed-off-by: Karel Zak --- agetty-replace-perms-660-to-620.patch | 45 ----- ...-ncurses-output-functions-and-printf.patch | 139 --------------- ...egfault-when-iterating-over-an-empty.patch | 95 ---------- ...-support-for-btrfs-backup-superblock.patch | 46 ----- ...ckup-superblock-visible-for-wipefs-8.patch | 64 ------- ...ve-optimization-from-verify-function.patch | 165 ------------------ util-linux.spec | 5 +- 7 files changed, 4 insertions(+), 555 deletions(-) delete mode 100644 agetty-replace-perms-660-to-620.patch delete mode 100644 cal-don-t-mix-ncurses-output-functions-and-printf.patch delete mode 100644 hexdump-do-not-segfault-when-iterating-over-an-empty.patch delete mode 100644 libblkid-add-support-for-btrfs-backup-superblock.patch delete mode 100644 libblkid-make-backup-superblock-visible-for-wipefs-8.patch delete mode 100644 libblkid-remove-optimization-from-verify-function.patch diff --git a/agetty-replace-perms-660-to-620.patch b/agetty-replace-perms-660-to-620.patch deleted file mode 100644 index ebf59b7..0000000 --- a/agetty-replace-perms-660-to-620.patch +++ /dev/null @@ -1,45 +0,0 @@ -From 7afbf6f20e1de62fb5595411d998703c95af8965 Mon Sep 17 00:00:00 2001 -From: Karel Zak -Date: Wed, 2 Jan 2013 08:23:00 +0100 -Subject: [PATCH 1/3] agetty: replace perms 660 to 620 - - ... the default is root:tty 620 - -Signed-off-by: Karel Zak ---- - login-utils/login.1 | 5 ++++- - term-utils/agetty.c | 2 +- - 2 files changed, 5 insertions(+), 2 deletions(-) - -diff --git a/login-utils/login.1 b/login-utils/login.1 -index 092213d..e37e5e6 100644 ---- a/login-utils/login.1 -+++ b/login-utils/login.1 -@@ -184,7 +184,10 @@ login failure. The default value is - (string) - .RS 4 - The terminal permissions. The default value is --.IR 0600 . -+.IR 0600 -+or -+.IR 0620 -+if tty group is used. - .RE - .PP - .B TTYGROUP -diff --git a/term-utils/agetty.c b/term-utils/agetty.c -index 7ee252d..17ebfba 100644 ---- a/term-utils/agetty.c -+++ b/term-utils/agetty.c -@@ -894,7 +894,7 @@ static void open_tty(char *tty, struct termios *tp, struct options *op) - * Linux login(1) will change tty permissions. Use root owner and group - * with permission -rw------- for the period between getty and login. - */ -- if (chown(buf, 0, gid) || chmod(buf, (gid ? 0660 : 0600))) { -+ if (chown(buf, 0, gid) || chmod(buf, (gid ? 0620 : 0600))) { - if (errno == EROFS) - log_warn("%s: %m", buf); - else --- -1.8.1 - diff --git a/cal-don-t-mix-ncurses-output-functions-and-printf.patch b/cal-don-t-mix-ncurses-output-functions-and-printf.patch deleted file mode 100644 index 1641068..0000000 --- a/cal-don-t-mix-ncurses-output-functions-and-printf.patch +++ /dev/null @@ -1,139 +0,0 @@ -From c265cc40a8ece740084fbfb3ebd4c1894b3b29b7 Mon Sep 17 00:00:00 2001 -From: Karel Zak -Date: Thu, 17 Jan 2013 18:48:16 +0100 -Subject: [PATCH 3/3] cal: don't mix ncurses output functions and printf() - -Fedora 18 (ncurses-libs-5.9-7.20121017, glibc-2.16-28): - -$ cal | cat -Actual results: - January 2013 Su Mo Tu We Th Fr Sa 1 2 3 4 5 6 7 8 -9 10 11 1213 14 15 16 17 18 1920 21 22 23 24 25 2627 28 29 30 31 - -Not sure where is the problem, but it's too fragile to mix two -output methods in one code. - -Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=896447 -Signed-off-by: Karel Zak ---- - misc-utils/cal.c | 43 +++++++++++++++++++++++++++---------------- - 1 file changed, 27 insertions(+), 16 deletions(-) - -diff --git a/misc-utils/cal.c b/misc-utils/cal.c -index 60e85df..0e204b9 100644 ---- a/misc-utils/cal.c -+++ b/misc-utils/cal.c -@@ -498,7 +498,7 @@ monthly(int day, int month, int year) { - do_monthly(day, month, year, &out); - for (i = 0; i < FMT_ST_LINES; i++) { - my_putstring(out.s[i]); -- putchar('\n'); -+ my_putstring("\n"); - } - } - -@@ -533,8 +533,11 @@ monthly3(int day, int month, int year) { - do_monthly(day, next_month, next_year, &out_next); - - width = (julian ? J_WEEK_LEN : WEEK_LEN) -1; -- for (i = 0; i < 2; i++) -- printf("%s %s %s\n", out_prev.s[i], out_curm.s[i], out_next.s[i]); -+ for (i = 0; i < 2; i++) { -+ snprintf(lineout, sizeof(lineout), -+ "%s %s %s\n", out_prev.s[i], out_curm.s[i], out_next.s[i]); -+ my_putstring(lineout); -+ } - for (i = 2; i < FMT_ST_LINES; i++) { - int w1, w2, w3; - w1 = w2 = w3 = width; -@@ -562,7 +565,7 @@ j_yearly(int day, int year) { - - snprintf(lineout, sizeof(lineout), "%d", year); - center(lineout, J_WEEK_LEN*2 + J_HEAD_SEP - 1, 0); -- printf("\n\n"); -+ my_putstring("\n\n"); - - for (i = 0; i < 12; i++) - day_array(day, i + 1, year, days[i]); -@@ -571,8 +574,10 @@ j_yearly(int day, int year) { - for (month = 0; month < 12; month += 2) { - center(full_month[month], J_WEEK_LEN-1, J_HEAD_SEP+1); - center(full_month[month + 1], J_WEEK_LEN-1, 0); -- printf("\n%s%*s %s\n", j_day_headings, J_HEAD_SEP, "", -- j_day_headings); -+ snprintf(lineout, sizeof(lineout), -+ "\n%s%*s %s\n", j_day_headings, J_HEAD_SEP, "", -+ j_day_headings); -+ my_putstring(lineout); - for (row = 0; row < 6; row++) { - p = lineout; - for (which_cal = 0; which_cal < 2; which_cal++) { -@@ -584,10 +589,10 @@ j_yearly(int day, int year) { - *p = '\0'; - trim_trailing_spaces(lineout); - my_putstring(lineout); -- putchar('\n'); -+ my_putstring("\n"); - } - } -- printf("\n"); -+ my_putstring("\n"); - } - - void -@@ -598,7 +603,7 @@ yearly(int day, int year) { - - snprintf(lineout, sizeof(lineout), "%d", year); - center(lineout, WEEK_LEN*3 + HEAD_SEP*2 - 1, 0); -- printf("\n\n"); -+ my_putstring("\n\n"); - - for (i = 0; i < 12; i++) - day_array(day, i + 1, year, days[i]); -@@ -608,8 +613,10 @@ yearly(int day, int year) { - center(full_month[month], WEEK_LEN-1, HEAD_SEP+1); - center(full_month[month + 1], WEEK_LEN-1, HEAD_SEP+1); - center(full_month[month + 2], WEEK_LEN-1, 0); -- printf("\n%s%*s %s%*s %s\n", day_headings, HEAD_SEP, -- "", day_headings, HEAD_SEP, "", day_headings); -+ snprintf(lineout, sizeof(lineout), -+ "\n%s%*s %s%*s %s\n", day_headings, HEAD_SEP, -+ "", day_headings, HEAD_SEP, "", day_headings); -+ my_putstring(lineout); - for (row = 0; row < 6; row++) { - p = lineout; - for (which_cal = 0; which_cal < 3; which_cal++) { -@@ -621,10 +628,10 @@ yearly(int day, int year) { - *p = '\0'; - trim_trailing_spaces(lineout); - my_putstring(lineout); -- putchar('\n'); -+ my_putstring("\n"); - } - } -- putchar('\n'); -+ my_putstring("\n"); - } - - /* -@@ -773,10 +780,14 @@ void - center(const char *str, size_t len, int separate) - { - char lineout[FMT_ST_CHARS]; -+ - center_str(str, lineout, ARRAY_SIZE(lineout), len); -- fputs(lineout, stdout); -- if (separate) -- printf("%*s", separate, ""); -+ my_putstring(lineout); -+ -+ if (separate) { -+ snprintf(lineout, sizeof(lineout), "%*s", separate, ""); -+ my_putstring(lineout); -+ } - } - - static void __attribute__ ((__noreturn__)) usage(FILE * out) --- -1.8.1 - diff --git a/hexdump-do-not-segfault-when-iterating-over-an-empty.patch b/hexdump-do-not-segfault-when-iterating-over-an-empty.patch deleted file mode 100644 index c9472bd..0000000 --- a/hexdump-do-not-segfault-when-iterating-over-an-empty.patch +++ /dev/null @@ -1,95 +0,0 @@ -From 85c24fe2b11cd136d43bbffd983014a3f967c25e Mon Sep 17 00:00:00 2001 -From: Ondrej Oprala -Date: Fri, 21 Dec 2012 13:04:04 +0100 -Subject: [PATCH 2/3] hexdump: do not segfault when iterating over an empty - format string - -Signed-off-by: Ondrej Oprala ---- - tests/commands.sh | 1 + - tests/expected/hexdump/empty-format | 1 + - tests/ts/hexdump/empty-format | 26 ++++++++++++++++++++++++++ - text-utils/parse.c | 16 +++++++++------- - 4 files changed, 37 insertions(+), 7 deletions(-) - create mode 100644 tests/expected/hexdump/empty-format - create mode 100755 tests/ts/hexdump/empty-format - -diff --git a/tests/commands.sh b/tests/commands.sh -index db1d4ac..3672095 100644 ---- a/tests/commands.sh -+++ b/tests/commands.sh -@@ -62,3 +62,4 @@ TS_CMD_FINDMNT=${TS_CMD_FINDMNT-"$top_builddir/findmnt"} - - TS_CMD_FDISK=${TS_CMD_FDISK-"$top_builddir/fdisk"} - -+TS_CMD_HEXDUMP=${TS_CMD_HEXDUMP-"$top_builddir/hexdump"} -diff --git a/tests/expected/hexdump/empty-format b/tests/expected/hexdump/empty-format -new file mode 100644 -index 0000000..9d60796 ---- /dev/null -+++ b/tests/expected/hexdump/empty-format -@@ -0,0 +1 @@ -+11 -\ No newline at end of file -diff --git a/tests/ts/hexdump/empty-format b/tests/ts/hexdump/empty-format -new file mode 100755 -index 0000000..4a3e528 ---- /dev/null -+++ b/tests/ts/hexdump/empty-format -@@ -0,0 +1,26 @@ -+#!/bin/bash -+ -+# This file is part of util-linux. -+# -+# This file is free software; you can redistribute it and/or modify -+# it under the terms of the GNU General Public License as published by -+# the Free Software Foundation; either version 2 of the License, or -+# (at your option) any later version. -+# -+# This file is distributed in the hope that it will be useful, -+# but WITHOUT ANY WARRANTY; without even the implied warranty of -+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+# GNU General Public License for more details. -+# -+TS_TOPDIR="$(dirname $0)/../.." -+TS_DESC="format-strings" -+ -+. $TS_TOPDIR/functions.sh -+ts_init "$*" -+ -+INPUT=$(printf \\1) -+$TS_CMD_HEXDUMP -n1 -ve '2 "" "%x"' <<< $INPUT 2>&1 >> $TS_OUTPUT -+ -+$TS_CMD_HEXDUMP -n1 -ve '4 "%x"' -e '2 ""' <<< $INPUT 2>&1 >> $TS_OUTPUT -+ -+ts_finalize -diff --git a/text-utils/parse.c b/text-utils/parse.c -index 5f1e2bd..bd96961 100644 ---- a/text-utils/parse.c -+++ b/text-utils/parse.c -@@ -421,13 +421,15 @@ isint2: switch(fu->bcnt) { - !(fu->flags&F_SETREP) && fu->bcnt) - fu->reps += (blocksize - fs->bcnt) / fu->bcnt; - if (fu->reps > 1) { -- for (pr = fu->nextpr;; pr = pr->nextpr) -- if (!pr->nextpr) -- break; -- for (p1 = pr->fmt, p2 = NULL; *p1; ++p1) -- p2 = isspace((unsigned char)*p1) ? p1 : NULL; -- if (p2) -- pr->nospace = p2; -+ if (fu->nextpr) { -+ for (pr = fu->nextpr; ; pr = pr->nextpr) -+ if (!pr->nextpr) -+ break; -+ for (p1 = pr->fmt, p2 = NULL; *p1; ++p1) -+ p2 = isspace((unsigned char)*p1) ? p1 : NULL; -+ if (p2) -+ pr->nospace = p2; -+ } - } - } - } --- -1.8.1 - diff --git a/libblkid-add-support-for-btrfs-backup-superblock.patch b/libblkid-add-support-for-btrfs-backup-superblock.patch deleted file mode 100644 index e8a3ea8..0000000 --- a/libblkid-add-support-for-btrfs-backup-superblock.patch +++ /dev/null @@ -1,46 +0,0 @@ -From d4a276491269b6502c15e0089fba6b616f5c5df8 Mon Sep 17 00:00:00 2001 -From: Goffredo Baroncelli -Date: Wed, 9 Jan 2013 22:14:43 +0100 -Subject: [PATCH] libblkid: add support for btrfs backup superblock - -Btrfs has three superblock. The first one is placed at 64KB, the second one at -64MB, the third one at 256GB. - -If the first superblock is valid except that the "magic field" is zeroed, btrfs -skips the check of the other superblocks. If the first superblock is fully -invalid, btrfs checks for the other superblock. - -So zeroing the first superblock "magic field" at the beginning seems that the -filesystem is wiped. But when the first superblock is overwritten (eg by -another filesystem), then the other two superblock may be considered valid, and -the filesystem may resurrect. - -This patch allow to find and wipe the other btrfs superblocks signature. - -Signed-off-by: Karel Zak ---- - libblkid/src/superblocks/btrfs.c | 8 ++++++++ - 1 file changed, 8 insertions(+) - -diff --git a/libblkid/src/superblocks/btrfs.c b/libblkid/src/superblocks/btrfs.c -index 039be42..1bd1df9 100644 ---- a/libblkid/src/superblocks/btrfs.c -+++ b/libblkid/src/superblocks/btrfs.c -@@ -87,6 +87,14 @@ const struct blkid_idinfo btrfs_idinfo = - .magics = - { - { .magic = "_BHRfS_M", .len = 8, .kboff = 64, .sboff = 0x40 }, -+ { .magic = "_BHRfS_M", -+ .len = 8, -+ .kboff = 64 * 1024, -+ .sboff = 0x40 }, -+ { .magic = "_BHRfS_M", -+ .len = 8, -+ .kboff = 256 * 1024 * 1024, -+ .sboff = 0x40 }, - { NULL } - } - }; --- -1.7.11.7 - diff --git a/libblkid-make-backup-superblock-visible-for-wipefs-8.patch b/libblkid-make-backup-superblock-visible-for-wipefs-8.patch deleted file mode 100644 index df06674..0000000 --- a/libblkid-make-backup-superblock-visible-for-wipefs-8.patch +++ /dev/null @@ -1,64 +0,0 @@ -diff -up util-linux-2.22.2/libblkid/src/blkidP.h.kzak util-linux-2.22.2/libblkid/src/blkidP.h ---- util-linux-2.22.2/libblkid/src/blkidP.h.kzak 2012-12-12 21:04:47.902355093 +0100 -+++ util-linux-2.22.2/libblkid/src/blkidP.h 2013-02-20 10:54:33.885606609 +0100 -@@ -224,6 +224,9 @@ struct blkid_struct_probe - - /* private per-probing flags */ - #define BLKID_PROBE_FL_IGNORE_PT (1 << 1) /* ignore partition table */ -+#define BLKID_PROBE_FL_IGNORE_BACKUP (1 << 2) /* ignore backup superblocks or PT */ -+ -+extern int blkid_probe_ignore_backup(blkid_probe pr); - - extern blkid_probe blkid_clone_probe(blkid_probe parent); - extern blkid_probe blkid_probe_get_wholedisk_probe(blkid_probe pr); -diff -up util-linux-2.22.2/libblkid/src/probe.c.kzak util-linux-2.22.2/libblkid/src/probe.c ---- util-linux-2.22.2/libblkid/src/probe.c.kzak 2012-12-12 21:04:47.903355101 +0100 -+++ util-linux-2.22.2/libblkid/src/probe.c 2013-02-20 11:02:48.525255696 +0100 -@@ -810,6 +810,7 @@ int blkid_probe_get_idmag(blkid_probe pr - static inline void blkid_probe_start(blkid_probe pr) - { - if (pr) { -+ DBG(DEBUG_LOWPROBE, printf("%p: start probe\n", pr)); - pr->cur_chain = NULL; - pr->prob_flags = 0; - blkid_probe_set_wiper(pr, 0, 0); -@@ -819,6 +820,7 @@ static inline void blkid_probe_start(blk - static inline void blkid_probe_end(blkid_probe pr) - { - if (pr) { -+ DBG(DEBUG_LOWPROBE, printf("%p: end probe\n", pr)); - pr->cur_chain = NULL; - pr->prob_flags = 0; - blkid_probe_set_wiper(pr, 0, 0); -@@ -1057,6 +1059,8 @@ int blkid_do_safeprobe(blkid_probe pr) - - blkid_probe_start(pr); - -+ pr->prob_flags |= BLKID_PROBE_FL_IGNORE_BACKUP; -+ - for (i = 0; i < BLKID_NCHAINS; i++) { - struct blkid_chain *chn; - -@@ -1679,3 +1683,7 @@ void blkid_probe_use_wiper(blkid_probe p - } - } - -+int blkid_probe_ignore_backup(blkid_probe pr) -+{ -+ return pr && (pr->prob_flags & BLKID_PROBE_FL_IGNORE_BACKUP); -+} -diff -up util-linux-2.22.2/libblkid/src/superblocks/btrfs.c.kzak util-linux-2.22.2/libblkid/src/superblocks/btrfs.c ---- util-linux-2.22.2/libblkid/src/superblocks/btrfs.c.kzak 2013-02-20 10:54:03.422381876 +0100 -+++ util-linux-2.22.2/libblkid/src/superblocks/btrfs.c 2013-02-20 10:54:33.886606616 +0100 -@@ -63,6 +63,11 @@ static int probe_btrfs(blkid_probe pr, c - { - struct btrfs_super_block *bfs; - -+ if (mag->kboff > 64 && blkid_probe_ignore_backup(pr)) { -+ DBG(DEBUG_LOWPROBE, printf("btrfs: found backup superblock, ignore\n")); -+ return 1; -+ } -+ - bfs = blkid_probe_get_sb(pr, mag, struct btrfs_super_block); - if (!bfs) - return -1; diff --git a/libblkid-remove-optimization-from-verify-function.patch b/libblkid-remove-optimization-from-verify-function.patch deleted file mode 100644 index 7d40835..0000000 --- a/libblkid-remove-optimization-from-verify-function.patch +++ /dev/null @@ -1,165 +0,0 @@ -From 2270b1ad90b394950f4fe215eb2fc1042020cef0 Mon Sep 17 00:00:00 2001 -From: Karel Zak -Date: Fri, 1 Feb 2013 15:59:58 +0100 -Subject: [PATCH] libblkid: remove optimization from verify( funrtion - -Now libblkid (the cache based part) tries to probe for the cached -filesystem firstly. This optimization is broken, because: - - * new another superblock could be on the device and the original - is already obsolete - * we still need to probe for partitions and raids - * the code was too fragile - -The patch also suggests lsblk --fs in blkid.8 for end users. lsblk -read information from used db. - -Reported-by: Andreas Hofmeister -Signed-off-by: Karel Zak ---- - libblkid/src/verify.c | 76 ++++++++------------------------------------------- - misc-utils/blkid.8 | 11 ++++++++ - 2 files changed, 22 insertions(+), 65 deletions(-) - -diff --git a/libblkid/src/verify.c b/libblkid/src/verify.c -index 4bab4de..0f48c48 100644 ---- a/libblkid/src/verify.c -+++ b/libblkid/src/verify.c -@@ -43,26 +43,6 @@ static void blkid_probe_to_tags(blkid_probe pr, blkid_dev dev) - blkid_set_tag(dev, name, data, len); - } - } -- -- /* -- * remove obsolete tags -- */ -- if (!nvals || !blkid_probe_has_value(pr, "LABEL")) -- blkid_set_tag(dev, "LABEL", NULL, 0); -- if (!nvals || !blkid_probe_has_value(pr, "UUID")) -- blkid_set_tag(dev, "UUID", NULL, 0); -- if (!nvals || !blkid_probe_has_value(pr, "PART_ENTRY_UUID")) -- blkid_set_tag(dev, "PARTUUID", NULL, 0); -- if (!nvals || !blkid_probe_has_value(pr, "PART_ENTRY_NAME")) -- blkid_set_tag(dev, "PARTLABEL", NULL, 0); -- if (!nvals || !blkid_probe_has_value(pr, "TYPE")) -- blkid_set_tag(dev, "TYPE", NULL, 0); -- if (!nvals || !blkid_probe_has_value(pr, "SEC_TYPE")) -- blkid_set_tag(dev, "SEC_TYPE", NULL, 0); -- if (!nvals || !blkid_probe_has_value(pr, "EXT_JOURNAL")) /* extN */ -- blkid_set_tag(dev, "EXT_JOURNAL", NULL, 0); -- if (!nvals || !blkid_probe_has_value(pr, "MOUNT")) /* ocfs */ -- blkid_set_tag(dev, "MOUNT", NULL, 0); - } - - /* -@@ -76,9 +56,10 @@ static void blkid_probe_to_tags(blkid_probe pr, blkid_dev dev) - */ - blkid_dev blkid_verify(blkid_cache cache, blkid_dev dev) - { -+ blkid_tag_iterate iter; -+ const char *type, *value; - struct stat st; - time_t diff, now; -- char *fltr[2]; - int fd; - - if (!dev) -@@ -155,64 +136,29 @@ blkid_dev blkid_verify(blkid_cache cache, blkid_dev dev) - return NULL; - } - -- blkid_probe_enable_superblocks(cache->probe, TRUE); -+ /* remove old cache info */ -+ iter = blkid_tag_iterate_begin(dev); -+ while (blkid_tag_next(iter, &type, &value) == 0) -+ blkid_set_tag(dev, type, NULL, 0); -+ blkid_tag_iterate_end(iter); - -+ /* enable superblocks probing */ -+ blkid_probe_enable_superblocks(cache->probe, TRUE); - blkid_probe_set_superblocks_flags(cache->probe, - BLKID_SUBLKS_LABEL | BLKID_SUBLKS_UUID | - BLKID_SUBLKS_TYPE | BLKID_SUBLKS_SECTYPE); - -- /* -- * If we already know the type, then try that first. -- */ -- if (dev->bid_type) { -- blkid_tag_iterate iter; -- const char *type, *value; -- -- fltr[0] = dev->bid_type; -- fltr[1] = NULL; -- -- blkid_probe_filter_superblocks_type(cache->probe, -- BLKID_FLTR_ONLYIN, fltr); -- -- if (blkid_do_probe(cache->probe) == 0) { -- /* -- * Cool, we found FS type, let's also read PART{UUID,LABEL} -- */ -- blkid_probe_enable_superblocks(cache->probe, FALSE); -- blkid_probe_enable_partitions(cache->probe, TRUE); -- blkid_probe_set_partitions_flags(cache->probe, BLKID_PARTS_ENTRY_DETAILS); -- if (blkid_do_probe(cache->probe) == 0) -- goto found_type; -- } -- -- blkid_probe_enable_superblocks(cache->probe, TRUE); -- blkid_probe_invert_superblocks_filter(cache->probe); -- -- /* -- * Zap the device filesystem information and try again -- */ -- DBG(DEBUG_PROBE, -- printf("previous fs type %s not valid, " -- "trying full probe\n", dev->bid_type)); -- iter = blkid_tag_iterate_begin(dev); -- while (blkid_tag_next(iter, &type, &value) == 0) -- blkid_set_tag(dev, type, 0, 0); -- blkid_tag_iterate_end(iter); -- } -- -+ /* enable partitions probing */ - blkid_probe_enable_partitions(cache->probe, TRUE); - blkid_probe_set_partitions_flags(cache->probe, BLKID_PARTS_ENTRY_DETAILS); - -- /* -- * Probe for all types. -- */ -+ /* probe */ - if (blkid_do_safeprobe(cache->probe)) { - /* found nothing or error */ - blkid_free_dev(dev); - dev = NULL; - } - --found_type: - if (dev) { - #ifdef HAVE_STRUCT_STAT_ST_MTIM_TV_NSEC - struct timeval tv; -diff --git a/misc-utils/blkid.8 b/misc-utils/blkid.8 -index 2ba1ab4..eb8d716 100644 ---- a/misc-utils/blkid.8 -+++ b/misc-utils/blkid.8 -@@ -64,6 +64,17 @@ library. It can determine the type of content (e.g. filesystem or swap) - that a block device holds, and also attributes (tokens, NAME=value pairs) - from the content metadata (e.g. LABEL or UUID fields). - .PP -+Note that -+.B blkid -+reads information directly from devices and for non-root users -+it returns cached unverified information. It's better to use -+.B lsblk --fs -+to get user-friendly overview about filesystems and devices. -+.BR lsblk (8) -+is also easy to use in scripts. -+.B blkid -+is mostly designed for system services and to test libblkid functionality. -+.PP - .B blkid - has two main forms of operation: either searching for a device with a - specific NAME=value pair, or displaying NAME=value pairs for one or --- -1.8.1 - diff --git a/util-linux.spec b/util-linux.spec index 3bac0be..cafc0bc 100644 --- a/util-linux.spec +++ b/util-linux.spec @@ -2,7 +2,7 @@ Summary: A collection of basic system utilities Name: util-linux Version: 2.23 -Release: 0.6%{?dist} +Release: 0.7%{?dist} License: GPLv2 and GPLv2+ and LGPLv2+ and BSD with advertising and Public Domain Group: System Environment/Base URL: http://en.wikipedia.org/wiki/Util-linux @@ -788,6 +788,9 @@ fi %{_libdir}/pkgconfig/uuid.pc %changelog +* Mon Apr 15 2013 Karel Zak 2.23-0.7 +- remove unused patches + * Mon Apr 15 2013 Karel Zak 2.23-0.6 - remove floppy from util-linux From 506ce7948f7cb4a8df5cac7c0080ee07bf4f82d9 Mon Sep 17 00:00:00 2001 From: Karel Zak Date: Thu, 25 Apr 2013 13:09:58 +0200 Subject: [PATCH 2/2] 2.23-1: upgrade 2.23-rc2 -> 2.23 Signed-off-by: Karel Zak --- .gitignore | 1 + ...nt.nfs-segfault-rely-on-assert-rathe.patch | 1340 ----------------- sources | 2 +- util-linux.spec | 20 +- 4 files changed, 16 insertions(+), 1347 deletions(-) delete mode 100644 0001-libmount-fix-mount.nfs-segfault-rely-on-assert-rathe.patch diff --git a/.gitignore b/.gitignore index 94ddde1..3c0a5a5 100644 --- a/.gitignore +++ b/.gitignore @@ -24,3 +24,4 @@ /util-linux-2.22.2.tar.xz /util-linux-2.23-rc1.tar.xz /util-linux-2.23-rc2.tar.xz +/util-linux-2.23.tar.xz diff --git a/0001-libmount-fix-mount.nfs-segfault-rely-on-assert-rathe.patch b/0001-libmount-fix-mount.nfs-segfault-rely-on-assert-rathe.patch deleted file mode 100644 index a2d2223..0000000 --- a/0001-libmount-fix-mount.nfs-segfault-rely-on-assert-rathe.patch +++ /dev/null @@ -1,1340 +0,0 @@ -From 4569bbeab783632c81ee14793da84b3e29444543 Mon Sep 17 00:00:00 2001 -From: Karel Zak -Date: Fri, 12 Apr 2013 12:35:34 +0200 -Subject: [PATCH] libmount: fix mount.nfs segfault, rely on assert() rather - than on nonnull - -We use - mnt_optstr_append_option(&o, mnt_fs_get_vfs_options(fs), NULL); - -in mount.nfs, unfortunately mnt_optstr_append_option() has been marked -ass nonnull(1, 2). That's wrong because append and prepend should -robust enough to accept NULL as option name. - -The patch also removes almost all __attribute__((nonnull). It seems -better to rely on assert() to have usable feedback. In many cases -(nonnull) is premature optimization for the library. This attribute -makes sense for things like strlen() or so... - -Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=948274 -Signed-off-by: Karel Zak ---- - libmount/src/context.c | 55 ++++++++++-- - libmount/src/fs.c | 34 ++++++-- - libmount/src/libmount.h.in | 202 ++++++++++++++++----------------------------- - libmount/src/lock.c | 2 + - libmount/src/mountP.h | 4 +- - libmount/src/optstr.c | 26 +++++- - libmount/src/tab_parse.c | 8 +- - libmount/src/tab_update.c | 13 ++- - libmount/src/utils.c | 9 +- - libmount/src/version.c | 5 ++ - 10 files changed, 202 insertions(+), 156 deletions(-) - -diff --git a/libmount/src/context.c b/libmount/src/context.c -index 614d3f3..38f80de 100644 ---- a/libmount/src/context.c -+++ b/libmount/src/context.c -@@ -196,6 +196,7 @@ int mnt_reset_context(struct libmnt_context *cxt) - */ - int mnt_context_reset_status(struct libmnt_context *cxt) - { -+ assert(cxt); - if (!cxt) - return -EINVAL; - -@@ -207,6 +208,7 @@ int mnt_context_reset_status(struct libmnt_context *cxt) - - static int set_flag(struct libmnt_context *cxt, int flag, int enable) - { -+ assert(cxt); - if (!cxt) - return -EINVAL; - if (enable) { -@@ -227,7 +229,6 @@ static int set_flag(struct libmnt_context *cxt, int flag, int enable) - */ - int mnt_context_is_restricted(struct libmnt_context *cxt) - { -- assert(cxt); - return cxt->restricted; - } - -@@ -270,6 +271,7 @@ int mnt_context_is_restricted(struct libmnt_context *cxt) - */ - int mnt_context_set_optsmode(struct libmnt_context *cxt, int mode) - { -+ assert(cxt); - if (!cxt) - return -EINVAL; - cxt->optsmode = mode; -@@ -285,6 +287,7 @@ int mnt_context_set_optsmode(struct libmnt_context *cxt, int mode) - - int mnt_context_get_optsmode(struct libmnt_context *cxt) - { -+ assert(cxt); - return cxt->optsmode; - } - -@@ -663,6 +666,7 @@ int mnt_context_set_fs(struct libmnt_context *cxt, struct libmnt_fs *fs) - */ - struct libmnt_fs *mnt_context_get_fs(struct libmnt_context *cxt) - { -+ assert(cxt); - if (!cxt) - return NULL; - if (!cxt->fs) { -@@ -681,6 +685,7 @@ struct libmnt_fs *mnt_context_get_fs(struct libmnt_context *cxt) - */ - int mnt_context_set_source(struct libmnt_context *cxt, const char *source) - { -+ assert(cxt); - return mnt_fs_set_source(mnt_context_get_fs(cxt), source); - } - -@@ -692,6 +697,7 @@ int mnt_context_set_source(struct libmnt_context *cxt, const char *source) - */ - const char *mnt_context_get_source(struct libmnt_context *cxt) - { -+ assert(cxt); - return mnt_fs_get_source(mnt_context_get_fs(cxt)); - } - -@@ -704,6 +710,7 @@ const char *mnt_context_get_source(struct libmnt_context *cxt) - */ - int mnt_context_set_target(struct libmnt_context *cxt, const char *target) - { -+ assert(cxt); - return mnt_fs_set_target(mnt_context_get_fs(cxt), target); - } - -@@ -715,6 +722,7 @@ int mnt_context_set_target(struct libmnt_context *cxt, const char *target) - */ - const char *mnt_context_get_target(struct libmnt_context *cxt) - { -+ assert(cxt); - return mnt_fs_get_target(mnt_context_get_fs(cxt)); - } - -@@ -731,6 +739,7 @@ const char *mnt_context_get_target(struct libmnt_context *cxt) - */ - int mnt_context_set_fstype(struct libmnt_context *cxt, const char *fstype) - { -+ assert(cxt); - return mnt_fs_set_fstype(mnt_context_get_fs(cxt), fstype); - } - -@@ -742,6 +751,7 @@ int mnt_context_set_fstype(struct libmnt_context *cxt, const char *fstype) - */ - const char *mnt_context_get_fstype(struct libmnt_context *cxt) - { -+ assert(cxt); - return mnt_fs_get_fstype(mnt_context_get_fs(cxt)); - } - -@@ -754,6 +764,7 @@ const char *mnt_context_get_fstype(struct libmnt_context *cxt) - */ - int mnt_context_set_options(struct libmnt_context *cxt, const char *optstr) - { -+ assert(cxt); - return mnt_fs_set_options(mnt_context_get_fs(cxt), optstr); - } - -@@ -766,6 +777,7 @@ int mnt_context_set_options(struct libmnt_context *cxt, const char *optstr) - */ - int mnt_context_append_options(struct libmnt_context *cxt, const char *optstr) - { -+ assert(cxt); - return mnt_fs_append_options(mnt_context_get_fs(cxt), optstr); - } - -@@ -784,6 +796,7 @@ int mnt_context_append_options(struct libmnt_context *cxt, const char *optstr) - */ - const char *mnt_context_get_options(struct libmnt_context *cxt) - { -+ assert(cxt); - return mnt_fs_get_options(mnt_context_get_fs(cxt)); - } - -@@ -800,6 +813,7 @@ int mnt_context_set_fstype_pattern(struct libmnt_context *cxt, const char *patte - { - char *p = NULL; - -+ assert(cxt); - if (!cxt) - return -EINVAL; - if (pattern) { -@@ -825,6 +839,7 @@ int mnt_context_set_options_pattern(struct libmnt_context *cxt, const char *patt - { - char *p = NULL; - -+ assert(cxt); - if (!cxt) - return -EINVAL; - if (pattern) { -@@ -856,6 +871,7 @@ int mnt_context_set_options_pattern(struct libmnt_context *cxt, const char *patt - */ - int mnt_context_set_fstab(struct libmnt_context *cxt, struct libmnt_table *tb) - { -+ assert(cxt); - if (!cxt) - return -EINVAL; - if (!(cxt->flags & MNT_FL_EXTERN_FSTAB)) -@@ -879,9 +895,9 @@ int mnt_context_get_fstab(struct libmnt_context *cxt, struct libmnt_table **tb) - { - struct libmnt_cache *cache; - -+ assert(cxt); - if (!cxt) - return -EINVAL; -- - if (!cxt->fstab) { - int rc; - -@@ -921,9 +937,9 @@ int mnt_context_get_mtab(struct libmnt_context *cxt, struct libmnt_table **tb) - { - struct libmnt_cache *cache; - -+ assert(cxt); - if (!cxt) - return -EINVAL; -- - if (!cxt->mtab) { - int rc; - -@@ -962,6 +978,7 @@ int mnt_context_set_tabfilter(struct libmnt_context *cxt, - int (*fltr)(struct libmnt_fs *, void *), - void *data) - { -+ assert(cxt); - if (!cxt) - return -EINVAL; - -@@ -1002,6 +1019,8 @@ int mnt_context_get_table(struct libmnt_context *cxt, - struct libmnt_cache *cache; - int rc; - -+ assert(cxt); -+ assert(tb); - if (!cxt || !tb) - return -EINVAL; - -@@ -1042,6 +1061,7 @@ int mnt_context_get_table(struct libmnt_context *cxt, - int mnt_context_set_tables_errcb(struct libmnt_context *cxt, - int (*cb)(struct libmnt_table *tb, const char *filename, int line)) - { -+ assert(cxt); - if (!cxt) - return -EINVAL; - -@@ -1085,6 +1105,7 @@ int mnt_context_set_cache(struct libmnt_context *cxt, struct libmnt_cache *cache - */ - struct libmnt_cache *mnt_context_get_cache(struct libmnt_context *cxt) - { -+ assert(cxt); - if (!cxt || mnt_context_is_nocanonicalize(cxt)) - return NULL; - -@@ -1112,9 +1133,9 @@ int mnt_context_set_passwd_cb(struct libmnt_context *cxt, - char *(*get)(struct libmnt_context *), - void (*release)(struct libmnt_context *, char *)) - { -+ assert(cxt); - if (!cxt) - return -EINVAL; -- - cxt->pwd_get_cb = get; - cxt->pwd_release_cb = release; - return 0; -@@ -1142,6 +1163,7 @@ int mnt_context_set_passwd_cb(struct libmnt_context *cxt, - */ - struct libmnt_lock *mnt_context_get_lock(struct libmnt_context *cxt) - { -+ assert(cxt); - /* - * DON'T call this function within libmount, it will always allocate - * the lock. The mnt_update_* functions are able to allocate the lock -@@ -1181,6 +1203,7 @@ struct libmnt_lock *mnt_context_get_lock(struct libmnt_context *cxt) - */ - int mnt_context_set_mflags(struct libmnt_context *cxt, unsigned long flags) - { -+ assert(cxt); - if (!cxt) - return -EINVAL; - -@@ -1213,6 +1236,8 @@ int mnt_context_get_mflags(struct libmnt_context *cxt, unsigned long *flags) - int rc = 0; - struct list_head *p; - -+ assert(cxt); -+ assert(flags); - if (!cxt || !flags) - return -EINVAL; - -@@ -1249,6 +1274,7 @@ int mnt_context_get_mflags(struct libmnt_context *cxt, unsigned long *flags) - */ - int mnt_context_set_user_mflags(struct libmnt_context *cxt, unsigned long flags) - { -+ assert(cxt); - if (!cxt) - return -EINVAL; - cxt->user_mountflags = flags; -@@ -1268,6 +1294,9 @@ int mnt_context_set_user_mflags(struct libmnt_context *cxt, unsigned long flags) - int mnt_context_get_user_mflags(struct libmnt_context *cxt, unsigned long *flags) - { - int rc = 0; -+ -+ assert(cxt); -+ assert(flags); - if (!cxt || !flags) - return -EINVAL; - -@@ -1299,6 +1328,7 @@ int mnt_context_get_user_mflags(struct libmnt_context *cxt, unsigned long *flags - */ - int mnt_context_set_mountdata(struct libmnt_context *cxt, void *data) - { -+ assert(cxt); - if (!cxt) - return -EINVAL; - cxt->mountdata = data; -@@ -1908,6 +1938,7 @@ int mnt_context_apply_fstab(struct libmnt_context *cxt) - */ - int mnt_context_tab_applied(struct libmnt_context *cxt) - { -+ assert(cxt); - return cxt->flags & MNT_FL_TAB_APPLIED; - } - -@@ -1949,6 +1980,7 @@ int mnt_context_propagation_only(struct libmnt_context *cxt) - */ - int mnt_context_get_status(struct libmnt_context *cxt) - { -+ assert(cxt); - return !cxt->syscall_status || !cxt->helper_exec_status; - } - -@@ -1960,6 +1992,7 @@ int mnt_context_get_status(struct libmnt_context *cxt) - */ - int mnt_context_helper_executed(struct libmnt_context *cxt) - { -+ assert(cxt); - return cxt->helper_exec_status != 1; - } - -@@ -1972,6 +2005,7 @@ int mnt_context_helper_executed(struct libmnt_context *cxt) - */ - int mnt_context_get_helper_status(struct libmnt_context *cxt) - { -+ assert(cxt); - return cxt->helper_status; - } - -@@ -1983,6 +2017,7 @@ int mnt_context_get_helper_status(struct libmnt_context *cxt) - */ - int mnt_context_syscall_called(struct libmnt_context *cxt) - { -+ assert(cxt); - return cxt->syscall_status != 1; - } - -@@ -1997,9 +2032,9 @@ int mnt_context_syscall_called(struct libmnt_context *cxt) - */ - int mnt_context_get_syscall_errno(struct libmnt_context *cxt) - { -+ assert(cxt); - if (cxt->syscall_status < 0) - return -cxt->syscall_status; -- - return 0; - } - -@@ -2017,6 +2052,7 @@ int mnt_context_get_syscall_errno(struct libmnt_context *cxt) - */ - int mnt_context_set_syscall_status(struct libmnt_context *cxt, int status) - { -+ assert(cxt); - if (!cxt) - return -EINVAL; - -@@ -2063,8 +2099,11 @@ int mnt_context_strerror(struct libmnt_context *cxt __attribute__((__unused__)), - int mnt_context_init_helper(struct libmnt_context *cxt, int action, - int flags __attribute__((__unused__))) - { -- int rc = mnt_context_disable_helpers(cxt, TRUE); -+ int rc; - -+ assert(cxt); -+ -+ rc = mnt_context_disable_helpers(cxt, TRUE); - if (!rc) - rc = set_flag(cxt, MNT_FL_HELPER, 1); - if (!rc) -@@ -2115,6 +2154,7 @@ int mnt_context_is_fs_mounted(struct libmnt_context *cxt, - struct libmnt_table *mtab; - int rc; - -+ assert(cxt); - if (!cxt || !fs || !mounted) - return -EINVAL; - -@@ -2130,6 +2170,7 @@ static int mnt_context_add_child(struct libmnt_context *cxt, pid_t pid) - { - pid_t *pids; - -+ assert(cxt); - if (!cxt) - return -EINVAL; - -@@ -2149,6 +2190,7 @@ int mnt_fork_context(struct libmnt_context *cxt) - int rc = 0; - pid_t pid; - -+ assert(cxt); - if (!mnt_context_is_parent(cxt)) - return -EINVAL; - -@@ -2182,6 +2224,7 @@ int mnt_context_wait_for_children(struct libmnt_context *cxt, - { - int i; - -+ assert(cxt); - if (!cxt) - return -EINVAL; - -diff --git a/libmount/src/fs.c b/libmount/src/fs.c -index bb9006d..c95cdc7 100644 ---- a/libmount/src/fs.c -+++ b/libmount/src/fs.c -@@ -131,7 +131,6 @@ struct libmnt_fs *mnt_copy_fs(struct libmnt_fs *dest, - - if (!src) - return NULL; -- - if (!dest) { - dest = mnt_new_fs(); - if (!dest) -@@ -197,6 +196,7 @@ struct libmnt_fs *mnt_copy_mtab_fs(const struct libmnt_fs *fs) - { - struct libmnt_fs *n = mnt_new_fs(); - -+ assert(fs); - if (!n) - return NULL; - -@@ -249,6 +249,7 @@ err: - */ - void *mnt_fs_get_userdata(struct libmnt_fs *fs) - { -+ assert(fs); - return fs ? fs->userdata : NULL; - } - -@@ -263,6 +264,7 @@ void *mnt_fs_get_userdata(struct libmnt_fs *fs) - */ - int mnt_fs_set_userdata(struct libmnt_fs *fs, void *data) - { -+ assert(fs); - if (!fs) - return -EINVAL; - fs->userdata = data; -@@ -303,6 +305,7 @@ const char *mnt_fs_get_srcpath(struct libmnt_fs *fs) - */ - const char *mnt_fs_get_source(struct libmnt_fs *fs) - { -+ assert(fs); - return fs ? fs->source : NULL; - } - -@@ -346,6 +349,7 @@ int mnt_fs_set_source(struct libmnt_fs *fs, const char *source) - char *p = NULL; - int rc; - -+ assert(fs); - if (!fs) - return -EINVAL; - -@@ -375,6 +379,7 @@ int mnt_fs_streq_srcpath(struct libmnt_fs *fs, const char *path) - { - const char *p; - -+ assert(fs); - if (!fs) - return 0; - -@@ -401,6 +406,7 @@ int mnt_fs_streq_srcpath(struct libmnt_fs *fs, const char *path) - */ - int mnt_fs_streq_target(struct libmnt_fs *fs, const char *path) - { -+ assert(fs); - return fs && streq_except_trailing_slash(mnt_fs_get_target(fs), path); - } - -@@ -439,6 +445,7 @@ int mnt_fs_streq_target(struct libmnt_fs *fs, const char *path) - */ - int mnt_fs_get_tag(struct libmnt_fs *fs, const char **name, const char **value) - { -+ assert(fs); - if (fs == NULL || !fs->tagname) - return -EINVAL; - if (name) -@@ -474,7 +481,6 @@ int mnt_fs_set_target(struct libmnt_fs *fs, const char *target) - char *p = NULL; - - assert(fs); -- - if (!fs) - return -EINVAL; - if (target) { -@@ -506,6 +512,7 @@ static int mnt_fs_get_flags(struct libmnt_fs *fs) - */ - int mnt_fs_get_propagation(struct libmnt_fs *fs, unsigned long *flags) - { -+ assert(fs); - if (!fs || !flags) - return -EINVAL; - -@@ -547,6 +554,7 @@ int mnt_fs_is_kernel(struct libmnt_fs *fs) - */ - int mnt_fs_is_swaparea(struct libmnt_fs *fs) - { -+ assert(fs); - return mnt_fs_get_flags(fs) & MNT_FS_SWAP; - } - -@@ -558,6 +566,7 @@ int mnt_fs_is_swaparea(struct libmnt_fs *fs) - */ - int mnt_fs_is_pseudofs(struct libmnt_fs *fs) - { -+ assert(fs); - return mnt_fs_get_flags(fs) & MNT_FS_PSEUDO; - } - -@@ -569,6 +578,7 @@ int mnt_fs_is_pseudofs(struct libmnt_fs *fs) - */ - int mnt_fs_is_netfs(struct libmnt_fs *fs) - { -+ assert(fs); - return mnt_fs_get_flags(fs) & MNT_FS_NET; - } - -@@ -622,6 +632,7 @@ int mnt_fs_set_fstype(struct libmnt_fs *fs, const char *fstype) - { - char *p = NULL; - -+ assert(fs); - if (!fs) - return -EINVAL; - if (fstype) { -@@ -700,9 +711,7 @@ char *mnt_fs_strdup_options(struct libmnt_fs *fs) - char *res; - - assert(fs); -- - errno = 0; -- - if (fs->optstr) - return strdup(fs->optstr); - -@@ -758,7 +767,6 @@ int mnt_fs_set_options(struct libmnt_fs *fs, const char *optstr) - char *v = NULL, *f = NULL, *u = NULL, *n = NULL; - - assert(fs); -- - if (!fs) - return -EINVAL; - if (optstr) { -@@ -801,7 +809,6 @@ int mnt_fs_append_options(struct libmnt_fs *fs, const char *optstr) - int rc; - - assert(fs); -- - if (!fs) - return -EINVAL; - if (!optstr) -@@ -842,7 +849,6 @@ int mnt_fs_prepend_options(struct libmnt_fs *fs, const char *optstr) - int rc; - - assert(fs); -- - if (!fs) - return -EINVAL; - if (!optstr) -@@ -932,6 +938,7 @@ int mnt_fs_set_attributes(struct libmnt_fs *fs, const char *optstr) - { - char *p = NULL; - -+ assert(fs); - if (!fs) - return -EINVAL; - if (optstr) { -@@ -974,6 +981,7 @@ int mnt_fs_append_attributes(struct libmnt_fs *fs, const char *optstr) - */ - int mnt_fs_prepend_attributes(struct libmnt_fs *fs, const char *optstr) - { -+ assert(fs); - if (!fs) - return -EINVAL; - if (!optstr) -@@ -1235,6 +1243,7 @@ int mnt_fs_get_option(struct libmnt_fs *fs, const char *name, - { - char rc = 1; - -+ assert(fs); - if (!fs) - return -EINVAL; - if (fs->fs_optstr) -@@ -1260,6 +1269,9 @@ int mnt_fs_get_attribute(struct libmnt_fs *fs, const char *name, - { - char rc = 1; - -+ assert(fs); -+ if (!fs) -+ return -EINVAL; - if (fs->attrs) - rc = mnt_optstr_get_option(fs->attrs, name, value, valsz); - return rc; -@@ -1286,6 +1298,7 @@ int mnt_fs_match_target(struct libmnt_fs *fs, const char *target, - { - int rc = 0; - -+ assert(fs); - if (!fs || !target || !fs->target) - return 0; - -@@ -1330,6 +1343,7 @@ int mnt_fs_match_source(struct libmnt_fs *fs, const char *source, - char *cn; - const char *src, *t, *v; - -+ assert(fs); - if (!fs) - return 0; - -@@ -1403,6 +1417,7 @@ int mnt_fs_match_source(struct libmnt_fs *fs, const char *source, - */ - int mnt_fs_match_fstype(struct libmnt_fs *fs, const char *types) - { -+ assert(fs); - return mnt_match_fstype(fs->fstype, types); - } - -@@ -1418,6 +1433,7 @@ int mnt_fs_match_fstype(struct libmnt_fs *fs, const char *types) - */ - int mnt_fs_match_options(struct libmnt_fs *fs, const char *options) - { -+ assert(fs); - return mnt_match_options(mnt_fs_get_options(fs), options); - } - -@@ -1430,7 +1446,7 @@ int mnt_fs_match_options(struct libmnt_fs *fs, const char *options) - */ - int mnt_fs_print_debug(struct libmnt_fs *fs, FILE *file) - { -- if (!fs) -+ if (!fs || !file) - return -EINVAL; - fprintf(file, "------ fs: %p\n", fs); - fprintf(file, "source: %s\n", mnt_fs_get_source(fs)); -@@ -1514,6 +1530,8 @@ int mnt_fs_to_mntent(struct libmnt_fs *fs, struct mntent **mnt) - int rc; - struct mntent *m; - -+ assert(fs); -+ assert(mnt); - if (!fs || !mnt) - return -EINVAL; - -diff --git a/libmount/src/libmount.h.in b/libmount/src/libmount.h.in -index 1b5df82..db479e1 100644 ---- a/libmount/src/libmount.h.in -+++ b/libmount/src/libmount.h.in -@@ -187,8 +187,7 @@ enum { - extern void mnt_init_debug(int mask); - - /* version.c */ --extern int mnt_parse_version_string(const char *ver_string) -- __ul_attribute__((nonnull)); -+extern int mnt_parse_version_string(const char *ver_string); - extern int mnt_get_library_version(const char **ver_string); - extern int mnt_get_library_features(const char ***features); - -@@ -198,10 +197,8 @@ extern char *mnt_mangle(const char *str) - extern char *mnt_unmangle(const char *str) - __ul_attribute__((warn_unused_result)); - --extern int mnt_fstype_is_netfs(const char *type) -- __ul_attribute__((nonnull)); --extern int mnt_fstype_is_pseudofs(const char *type) -- __ul_attribute__((nonnull)); -+extern int mnt_fstype_is_netfs(const char *type); -+extern int mnt_fstype_is_pseudofs(const char *type); - - extern int mnt_match_fstype(const char *type, const char *pattern) - __ul_attribute__((warn_unused_result)); -@@ -212,7 +209,7 @@ extern const char *mnt_get_swaps_path(void); - extern const char *mnt_get_mtab_path(void); - extern int mnt_has_regular_mtab(const char **mtab, int *writable); - extern char *mnt_get_mountpoint(const char *path) -- __ul_attribute__((nonnull, warn_unused_result)); -+ __ul_attribute__((warn_unused_result)); - - /* cache.c */ - extern struct libmnt_cache *mnt_new_cache(void) -@@ -224,8 +221,7 @@ extern int mnt_cache_read_tags(struct libmnt_cache *cache, const char *devname); - extern int mnt_cache_device_has_tag(struct libmnt_cache *cache, - const char *devname, - const char *token, -- const char *value) -- __ul_attribute__((nonnull)); -+ const char *value); - - extern char *mnt_cache_find_tag_value(struct libmnt_cache *cache, - const char *devname, const char *token); -@@ -245,24 +241,18 @@ extern char *mnt_pretty_path(const char *path, struct libmnt_cache *cache) - - /* optstr.c */ - extern int mnt_optstr_next_option(char **optstr, char **name, size_t *namesz, -- char **value, size_t *valuesz) -- __ul_attribute__((nonnull(1))); -+ char **value, size_t *valuesz); - extern int mnt_optstr_append_option(char **optstr, const char *name, -- const char *value) -- __ul_attribute__((nonnull(1, 2))); -+ const char *value); - extern int mnt_optstr_prepend_option(char **optstr, const char *name, -- const char *value) -- __ul_attribute__((nonnull(1, 2))); -+ const char *value); - - extern int mnt_optstr_get_option(const char *optstr, const char *name, - char **value, size_t *valsz); - extern int mnt_optstr_set_option(char **optstr, const char *name, -- const char *value) -- __ul_attribute__((nonnull(1, 2))); --extern int mnt_optstr_remove_option(char **optstr, const char *name) -- __ul_attribute__((nonnull)); --extern int mnt_optstr_deduplicate_option(char **optstr, const char *name) -- __ul_attribute__((nonnull)); -+ const char *value); -+extern int mnt_optstr_remove_option(char **optstr, const char *name); -+extern int mnt_optstr_deduplicate_option(char **optstr, const char *name); - - extern int mnt_split_optstr(const char *optstr, - char **user, char **vfs, char **fs, -@@ -301,11 +291,10 @@ extern const struct libmnt_optmap *mnt_get_builtin_optmap(int id); - - /* lock.c */ - extern struct libmnt_lock *mnt_new_lock(const char *datafile, pid_t id) -- __ul_attribute__((nonnull, warn_unused_result)); -+ __ul_attribute__((warn_unused_result)); - extern void mnt_free_lock(struct libmnt_lock *ml); - --extern void mnt_unlock_file(struct libmnt_lock *ml) -- __ul_attribute__((nonnull)); -+extern void mnt_unlock_file(struct libmnt_lock *ml); - extern int mnt_lock_file(struct libmnt_lock *ml); - extern int mnt_lock_block_signals(struct libmnt_lock *ml, int enable); - -@@ -314,27 +303,21 @@ extern struct libmnt_fs *mnt_new_fs(void) - __ul_attribute__((warn_unused_result)); - extern void mnt_free_fs(struct libmnt_fs *fs); - --extern void mnt_reset_fs(struct libmnt_fs *fs) -- __ul_attribute__((nonnull)); -+extern void mnt_reset_fs(struct libmnt_fs *fs); - extern struct libmnt_fs *mnt_copy_fs(struct libmnt_fs *dest, - const struct libmnt_fs *src) - __ul_attribute__((warn_unused_result)); --extern void *mnt_fs_get_userdata(struct libmnt_fs *fs) -- __ul_attribute__((nonnull)); -+extern void *mnt_fs_get_userdata(struct libmnt_fs *fs); - extern int mnt_fs_set_userdata(struct libmnt_fs *fs, void *data); --extern const char *mnt_fs_get_source(struct libmnt_fs *fs) -- __ul_attribute__((nonnull)); -+extern const char *mnt_fs_get_source(struct libmnt_fs *fs); - extern int mnt_fs_set_source(struct libmnt_fs *fs, const char *source); - extern const char *mnt_fs_get_srcpath(struct libmnt_fs *fs); - - extern int mnt_fs_get_tag(struct libmnt_fs *fs, const char **name, -- const char **value) -- __ul_attribute__((nonnull(1))); --extern const char *mnt_fs_get_target(struct libmnt_fs *fs) -- __ul_attribute__((nonnull)); -+ const char **value); -+extern const char *mnt_fs_get_target(struct libmnt_fs *fs); - extern int mnt_fs_set_target(struct libmnt_fs *fs, const char *target); --extern const char *mnt_fs_get_fstype(struct libmnt_fs *fs) -- __ul_attribute__((nonnull)); -+extern const char *mnt_fs_get_fstype(struct libmnt_fs *fs); - extern int mnt_fs_set_fstype(struct libmnt_fs *fs, const char *fstype); - - extern int mnt_fs_streq_srcpath(struct libmnt_fs *fs, const char *path) -@@ -343,11 +326,11 @@ extern int mnt_fs_streq_target(struct libmnt_fs *fs, const char *path) - __ul_attribute__((warn_unused_result)); - - extern char *mnt_fs_strdup_options(struct libmnt_fs *fs) -- __ul_attribute__((nonnull, warn_unused_result)); -+ __ul_attribute__((warn_unused_result)); - extern const char *mnt_fs_get_options(struct libmnt_fs *fs) -- __ul_attribute__((nonnull, warn_unused_result)); -+ __ul_attribute__((warn_unused_result)); - extern const char *mnt_fs_get_optional_fields(struct libmnt_fs *fs) -- __ul_attribute__((nonnull, warn_unused_result)); -+ __ul_attribute__((warn_unused_result)); - extern int mnt_fs_get_propagation(struct libmnt_fs *fs, unsigned long *flags); - - extern int mnt_fs_set_options(struct libmnt_fs *fs, const char *optstr); -@@ -357,81 +340,56 @@ extern int mnt_fs_prepend_options(struct libmnt_fs *fs, const char *optstr); - extern int mnt_fs_get_option(struct libmnt_fs *fs, const char *name, - char **value, size_t *valsz); - --extern const char *mnt_fs_get_fs_options(struct libmnt_fs *fs) -- __ul_attribute__((nonnull)); --extern const char *mnt_fs_get_vfs_options(struct libmnt_fs *fs) -- __ul_attribute__((nonnull)); --extern const char *mnt_fs_get_user_options(struct libmnt_fs *fs) -- __ul_attribute__((nonnull)); -+extern const char *mnt_fs_get_fs_options(struct libmnt_fs *fs); -+extern const char *mnt_fs_get_vfs_options(struct libmnt_fs *fs); -+extern const char *mnt_fs_get_user_options(struct libmnt_fs *fs); - --extern const char *mnt_fs_get_attributes(struct libmnt_fs *fs) -- __ul_attribute__((nonnull)); -+extern const char *mnt_fs_get_attributes(struct libmnt_fs *fs); - extern int mnt_fs_set_attributes(struct libmnt_fs *fs, const char *optstr); - extern int mnt_fs_get_attribute(struct libmnt_fs *fs, const char *name, - char **value, size_t *valsz); - extern int mnt_fs_append_attributes(struct libmnt_fs *fs, const char *optstr); - extern int mnt_fs_prepend_attributes(struct libmnt_fs *fs, const char *optstr); - --extern int mnt_fs_get_freq(struct libmnt_fs *fs) -- __ul_attribute__((nonnull)); -+extern int mnt_fs_get_freq(struct libmnt_fs *fs); - extern int mnt_fs_set_freq(struct libmnt_fs *fs, int freq); --extern int mnt_fs_get_passno(struct libmnt_fs *fs) -- __ul_attribute__((nonnull)); -+extern int mnt_fs_get_passno(struct libmnt_fs *fs); - extern int mnt_fs_set_passno(struct libmnt_fs *fs, int passno); --extern const char *mnt_fs_get_root(struct libmnt_fs *fs) -- __ul_attribute__((nonnull)); -+extern const char *mnt_fs_get_root(struct libmnt_fs *fs); - extern int mnt_fs_set_root(struct libmnt_fs *fs, const char *root); --extern const char *mnt_fs_get_bindsrc(struct libmnt_fs *fs) -- __ul_attribute__((nonnull)); -+extern const char *mnt_fs_get_bindsrc(struct libmnt_fs *fs); - extern int mnt_fs_set_bindsrc(struct libmnt_fs *fs, const char *src); --extern int mnt_fs_get_id(struct libmnt_fs *fs) -- __ul_attribute__((nonnull)); --extern int mnt_fs_get_parent_id(struct libmnt_fs *fs) -- __ul_attribute__((nonnull)); --extern dev_t mnt_fs_get_devno(struct libmnt_fs *fs) -- __ul_attribute__((nonnull)); --extern pid_t mnt_fs_get_tid(struct libmnt_fs *fs) -- __ul_attribute__((nonnull)); -+extern int mnt_fs_get_id(struct libmnt_fs *fs); -+extern int mnt_fs_get_parent_id(struct libmnt_fs *fs); -+extern dev_t mnt_fs_get_devno(struct libmnt_fs *fs); -+extern pid_t mnt_fs_get_tid(struct libmnt_fs *fs); - --extern const char *mnt_fs_get_swaptype(struct libmnt_fs *fs) -- __ul_attribute__((nonnull)); --extern off_t mnt_fs_get_size(struct libmnt_fs *fs) -- __ul_attribute__((nonnull)); --extern off_t mnt_fs_get_usedsize(struct libmnt_fs *fs) -- __ul_attribute__((nonnull)); --extern int mnt_fs_get_priority(struct libmnt_fs *fs) -- __ul_attribute__((nonnull)); -+extern const char *mnt_fs_get_swaptype(struct libmnt_fs *fs); -+extern off_t mnt_fs_get_size(struct libmnt_fs *fs); -+extern off_t mnt_fs_get_usedsize(struct libmnt_fs *fs); -+extern int mnt_fs_get_priority(struct libmnt_fs *fs); - - extern int mnt_fs_match_target(struct libmnt_fs *fs, const char *target, -- struct libmnt_cache *cache) -- __ul_attribute__((nonnull(1))); -+ struct libmnt_cache *cache); - extern int mnt_fs_match_source(struct libmnt_fs *fs, const char *source, -- struct libmnt_cache *cache) -- __ul_attribute__((nonnull(1))); --extern int mnt_fs_match_fstype(struct libmnt_fs *fs, const char *types) -- __ul_attribute__((nonnull(1))); --extern int mnt_fs_match_options(struct libmnt_fs *fs, const char *options) -- __ul_attribute__((nonnull(1))); --extern int mnt_fs_print_debug(struct libmnt_fs *fs, FILE *file) -- __ul_attribute__((nonnull)); -+ struct libmnt_cache *cache); -+extern int mnt_fs_match_fstype(struct libmnt_fs *fs, const char *types); -+extern int mnt_fs_match_options(struct libmnt_fs *fs, const char *options); -+extern int mnt_fs_print_debug(struct libmnt_fs *fs, FILE *file); - --extern int mnt_fs_is_kernel(struct libmnt_fs *fs) -- __ul_attribute__((nonnull)); --extern int mnt_fs_is_swaparea(struct libmnt_fs *fs) -- __ul_attribute__((nonnull)); --extern int mnt_fs_is_netfs(struct libmnt_fs *fs) -- __ul_attribute__((nonnull)); --extern int mnt_fs_is_pseudofs(struct libmnt_fs *fs) -- __ul_attribute__((nonnull)); -+extern int mnt_fs_is_kernel(struct libmnt_fs *fs); -+extern int mnt_fs_is_swaparea(struct libmnt_fs *fs); -+extern int mnt_fs_is_netfs(struct libmnt_fs *fs); -+extern int mnt_fs_is_pseudofs(struct libmnt_fs *fs); - - extern void mnt_free_mntent(struct mntent *mnt); - extern int mnt_fs_to_mntent(struct libmnt_fs *fs, struct mntent **mnt); - - /* tab-parse.c */ - extern struct libmnt_table *mnt_new_table_from_file(const char *filename) -- __ul_attribute__((nonnull, warn_unused_result)); -+ __ul_attribute__((warn_unused_result)); - extern struct libmnt_table *mnt_new_table_from_dir(const char *dirname) -- __ul_attribute__((nonnull, warn_unused_result)); -+ __ul_attribute__((warn_unused_result)); - extern int mnt_table_parse_stream(struct libmnt_table *tb, FILE *f, - const char *filename); - extern int mnt_table_parse_file(struct libmnt_table *tb, const char *filename); -@@ -484,27 +442,21 @@ extern int mnt_table_find_next_fs(struct libmnt_table *tb, - void *userdata, - struct libmnt_fs **fs); - --extern int mnt_table_is_fs_mounted(struct libmnt_table *tb, struct libmnt_fs *fstab_fs) -- __ul_attribute__((nonnull)); -- -+extern int mnt_table_is_fs_mounted(struct libmnt_table *tb, struct libmnt_fs *fstab_fs); - - /* tab_update.c */ - extern struct libmnt_update *mnt_new_update(void) - __ul_attribute__((warn_unused_result)); - extern void mnt_free_update(struct libmnt_update *upd); - --extern int mnt_update_is_ready(struct libmnt_update *upd) -- __ul_attribute__((nonnull)); -+extern int mnt_update_is_ready(struct libmnt_update *upd); - extern int mnt_update_set_fs(struct libmnt_update *upd, unsigned long mountflags, - const char *target, struct libmnt_fs *fs); - extern int mnt_update_table(struct libmnt_update *upd, struct libmnt_lock *lc); --extern unsigned long mnt_update_get_mflags(struct libmnt_update *upd) -- __ul_attribute__((nonnull)); -+extern unsigned long mnt_update_get_mflags(struct libmnt_update *upd); - extern int mnt_update_force_rdonly(struct libmnt_update *upd, int rdonly); --extern const char *mnt_update_get_filename(struct libmnt_update *upd) -- __ul_attribute__((nonnull)); --extern struct libmnt_fs *mnt_update_get_fs(struct libmnt_update *upd) -- __ul_attribute__((nonnull)); -+extern const char *mnt_update_get_filename(struct libmnt_update *upd); -+extern struct libmnt_fs *mnt_update_get_fs(struct libmnt_update *upd); - - /* tab_diff.c */ - enum { -@@ -578,8 +530,8 @@ extern int mnt_context_enable_loopdel(struct libmnt_context *cxt, int enable); - extern int mnt_context_enable_fork(struct libmnt_context *cxt, int enable); - extern int mnt_context_disable_swapmatch(struct libmnt_context *cxt, int disable); - --extern int mnt_context_get_optsmode(struct libmnt_context *cxt) -- __ul_attribute__((nonnull)); -+extern int mnt_context_get_optsmode(struct libmnt_context *cxt); -+ - extern int mnt_context_is_lazy(struct libmnt_context *cxt) - __ul_attribute__((nonnull)); - extern int mnt_context_is_rdonly_umount(struct libmnt_context *cxt) -@@ -614,28 +566,22 @@ extern int mnt_context_wait_for_children(struct libmnt_context *cxt, - int *nchildren, int *nerrs); - - extern int mnt_context_is_fs_mounted(struct libmnt_context *cxt, -- struct libmnt_fs *fs, int *mounted) -- __ul_attribute__((nonnull)); -+ struct libmnt_fs *fs, int *mounted); - extern int mnt_context_set_fs(struct libmnt_context *cxt, struct libmnt_fs *fs); --extern struct libmnt_fs *mnt_context_get_fs(struct libmnt_context *cxt) -- __ul_attribute__((nonnull)); -+extern struct libmnt_fs *mnt_context_get_fs(struct libmnt_context *cxt); - - extern int mnt_context_set_source(struct libmnt_context *cxt, const char *source); - extern int mnt_context_set_target(struct libmnt_context *cxt, const char *target); - extern int mnt_context_set_fstype(struct libmnt_context *cxt, const char *fstype); - --extern const char *mnt_context_get_source(struct libmnt_context *cxt) -- __ul_attribute__((nonnull)); --extern const char *mnt_context_get_target(struct libmnt_context *cxt) -- __ul_attribute__((nonnull)); --extern const char *mnt_context_get_fstype(struct libmnt_context *cxt) -- __ul_attribute__((nonnull)); -+extern const char *mnt_context_get_source(struct libmnt_context *cxt); -+extern const char *mnt_context_get_target(struct libmnt_context *cxt); -+extern const char *mnt_context_get_fstype(struct libmnt_context *cxt); - - extern int mnt_context_set_options(struct libmnt_context *cxt, const char *optstr); - extern int mnt_context_append_options(struct libmnt_context *cxt, const char *optstr); - --extern const char *mnt_context_get_options(struct libmnt_context *cxt) -- __ul_attribute__((nonnull)); -+extern const char *mnt_context_get_options(struct libmnt_context *cxt); - - extern int mnt_context_set_fstype_pattern(struct libmnt_context *cxt, const char *pattern); - extern int mnt_context_set_options_pattern(struct libmnt_context *cxt, const char *pattern); -@@ -659,10 +605,8 @@ extern int mnt_context_get_table(struct libmnt_context *cxt, - struct libmnt_table **tb); - extern int mnt_context_set_cache(struct libmnt_context *cxt, - struct libmnt_cache *cache); --extern struct libmnt_cache *mnt_context_get_cache(struct libmnt_context *cxt) -- __ul_attribute__((nonnull)); --extern struct libmnt_lock *mnt_context_get_lock(struct libmnt_context *cxt) -- __ul_attribute__((nonnull)); -+extern struct libmnt_cache *mnt_context_get_cache(struct libmnt_context *cxt); -+extern struct libmnt_lock *mnt_context_get_lock(struct libmnt_context *cxt); - extern int mnt_context_set_mflags(struct libmnt_context *cxt, - unsigned long flags); - extern int mnt_context_get_mflags(struct libmnt_context *cxt, -@@ -676,19 +620,14 @@ extern int mnt_context_set_mountdata(struct libmnt_context *cxt, void *data); - extern int mnt_context_apply_fstab(struct libmnt_context *cxt); - - extern int mnt_context_reset_status(struct libmnt_context *cxt); --extern int mnt_context_get_status(struct libmnt_context *cxt) -- __ul_attribute__((nonnull)); -+extern int mnt_context_get_status(struct libmnt_context *cxt); - --extern int mnt_context_helper_executed(struct libmnt_context *cxt) -- __ul_attribute__((nonnull)); --extern int mnt_context_get_helper_status(struct libmnt_context *cxt) -- __ul_attribute__((nonnull)); -+extern int mnt_context_helper_executed(struct libmnt_context *cxt); -+extern int mnt_context_get_helper_status(struct libmnt_context *cxt); - --extern int mnt_context_syscall_called(struct libmnt_context *cxt) -- __ul_attribute__((nonnull)); -+extern int mnt_context_syscall_called(struct libmnt_context *cxt); - --extern int mnt_context_get_syscall_errno(struct libmnt_context *cxt) -- __ul_attribute__((nonnull)); -+extern int mnt_context_get_syscall_errno(struct libmnt_context *cxt); - - extern int mnt_context_strerror(struct libmnt_context *cxt, char *buf, - size_t bufsiz); -@@ -720,8 +659,7 @@ extern int mnt_context_prepare_umount(struct libmnt_context *cxt) - extern int mnt_context_do_umount(struct libmnt_context *cxt); - extern int mnt_context_finalize_umount(struct libmnt_context *cxt); - --extern int mnt_context_tab_applied(struct libmnt_context *cxt) -- __ul_attribute__((nonnull)); -+extern int mnt_context_tab_applied(struct libmnt_context *cxt); - extern int mnt_context_set_syscall_status(struct libmnt_context *cxt, int status); - - /* -diff --git a/libmount/src/lock.c b/libmount/src/lock.c -index 9e583cc..e73edf5 100644 ---- a/libmount/src/lock.c -+++ b/libmount/src/lock.c -@@ -53,6 +53,8 @@ struct libmnt_lock *mnt_new_lock(const char *datafile, pid_t id) - char *lo = NULL, *ln = NULL; - size_t losz; - -+ assert(datafile); -+ - /* for flock we use "foo.lock, for mtab "foo~" - */ - losz = strlen(datafile) + sizeof(".lock"); -diff --git a/libmount/src/mountP.h b/libmount/src/mountP.h -index 065b815..e064a68 100644 ---- a/libmount/src/mountP.h -+++ b/libmount/src/mountP.h -@@ -26,7 +26,9 @@ - #define CONFIG_LIBMOUNT_DEBUG - - #ifdef CONFIG_LIBMOUNT_ASSERT --#include -+# include -+#else -+# define assert(x) - #endif - - /* -diff --git a/libmount/src/optstr.c b/libmount/src/optstr.c -index a3a5d0a..5e9e708 100644 ---- a/libmount/src/optstr.c -+++ b/libmount/src/optstr.c -@@ -169,8 +169,7 @@ int mnt_optstr_next_option(char **optstr, char **name, size_t *namesz, - return mnt_optstr_parse_next(optstr, name, namesz, value, valuesz); - } - --static int __attribute__((nonnull(1, 2))) --__mnt_optstr_append_option(char **optstr, -+static int __mnt_optstr_append_option(char **optstr, - const char *name, size_t nsz, - const char *value, size_t vsz) - { -@@ -180,6 +179,7 @@ __mnt_optstr_append_option(char **optstr, - assert(name); - assert(*name); - assert(nsz); -+ assert(optstr); - - osz = *optstr ? strlen(*optstr) : 0; - -@@ -225,6 +225,8 @@ int mnt_optstr_append_option(char **optstr, const char *name, const char *value) - { - size_t vsz, nsz; - -+ assert(optstr); -+ - if (!name || !*name) - return 0; - -@@ -248,6 +250,11 @@ int mnt_optstr_prepend_option(char **optstr, const char *name, const char *value - int rc = 0; - char *tmp = *optstr; - -+ assert(optstr); -+ -+ if (!name || !*name) -+ return 0; -+ - *optstr = NULL; - - rc = mnt_optstr_append_option(optstr, name, value); -@@ -282,6 +289,9 @@ int mnt_optstr_get_option(const char *optstr, const char *name, - struct libmnt_optloc ol; - int rc; - -+ assert(optstr); -+ assert(name); -+ - mnt_init_optloc(&ol); - - rc = mnt_optstr_locate_option((char *) optstr, name, &ol); -@@ -307,8 +317,12 @@ int mnt_optstr_get_option(const char *optstr, const char *name, - int mnt_optstr_deduplicate_option(char **optstr, const char *name) - { - int rc; -- char *begin = NULL, *end = NULL, *opt = *optstr; -+ char *begin = NULL, *end = NULL, *opt; - -+ assert(optstr); -+ assert(name); -+ -+ opt = *optstr; - do { - struct libmnt_optloc ol; - -@@ -421,6 +435,9 @@ int mnt_optstr_set_option(char **optstr, const char *name, const char *value) - char *nameend; - int rc = 1; - -+ assert(optstr); -+ assert(name); -+ - if (!optstr) - return -EINVAL; - -@@ -467,6 +484,9 @@ int mnt_optstr_remove_option(char **optstr, const char *name) - struct libmnt_optloc ol; - int rc; - -+ assert(optstr); -+ assert(name); -+ - mnt_init_optloc(&ol); - - rc = mnt_optstr_locate_option(*optstr, name, &ol); -diff --git a/libmount/src/tab_parse.c b/libmount/src/tab_parse.c -index 7368d8c..e930fd8 100644 ---- a/libmount/src/tab_parse.c -+++ b/libmount/src/tab_parse.c -@@ -720,7 +720,6 @@ struct libmnt_table *__mnt_new_table_from_file(const char *filename, int fmt) - struct stat st; - - assert(filename); -- - if (!filename) - return NULL; - if (stat(filename, &st)) -@@ -749,6 +748,7 @@ struct libmnt_table *__mnt_new_table_from_file(const char *filename, int fmt) - */ - struct libmnt_table *mnt_new_table_from_file(const char *filename) - { -+ assert(filename); - return __mnt_new_table_from_file(filename, MNT_FMT_GUESS); - } - -@@ -763,7 +763,6 @@ struct libmnt_table *mnt_new_table_from_dir(const char *dirname) - struct libmnt_table *tb; - - assert(dirname); -- - if (!dirname) - return NULL; - tb = mnt_new_table(); -@@ -793,6 +792,7 @@ struct libmnt_table *mnt_new_table_from_dir(const char *dirname) - int mnt_table_set_parser_errcb(struct libmnt_table *tb, - int (*cb)(struct libmnt_table *tb, const char *filename, int line)) - { -+ assert(tb); - if (!tb) - return -EINVAL; - tb->errcb = cb; -@@ -807,6 +807,7 @@ int mnt_table_set_parser_fltrcb(struct libmnt_table *tb, - int (*cb)(struct libmnt_fs *, void *), - void *data) - { -+ assert(tb); - if (!tb) - return -EINVAL; - -@@ -862,7 +863,6 @@ int mnt_table_parse_fstab(struct libmnt_table *tb, const char *filename) - int rc = 0; - - assert(tb); -- - if (!tb) - return -EINVAL; - if (!filename) -@@ -959,6 +959,8 @@ int mnt_table_parse_mtab(struct libmnt_table *tb, const char *filename) - const char *utab = NULL; - struct libmnt_table *u_tb; - -+ assert(tb); -+ - if (mnt_has_regular_mtab(&filename, NULL)) { - - DBG(TAB, mnt_debug_h(tb, "force %s usage", filename)); -diff --git a/libmount/src/tab_update.c b/libmount/src/tab_update.c -index 044a13f..1e7f32b 100644 ---- a/libmount/src/tab_update.c -+++ b/libmount/src/tab_update.c -@@ -131,6 +131,7 @@ int mnt_update_set_filename(struct libmnt_update *upd, const char *filename, - */ - const char *mnt_update_get_filename(struct libmnt_update *upd) - { -+ assert(upd); - return upd ? upd->filename : NULL; - } - -@@ -143,6 +144,7 @@ const char *mnt_update_get_filename(struct libmnt_update *upd) - */ - int mnt_update_is_ready(struct libmnt_update *upd) - { -+ assert(upd); - return upd ? upd->ready : FALSE; - } - -@@ -227,6 +229,7 @@ int mnt_update_set_fs(struct libmnt_update *upd, unsigned long mountflags, - */ - struct libmnt_fs *mnt_update_get_fs(struct libmnt_update *upd) - { -+ assert(upd); - return upd ? upd->fs : NULL; - } - -@@ -238,6 +241,7 @@ struct libmnt_fs *mnt_update_get_fs(struct libmnt_update *upd) - */ - unsigned long mnt_update_get_mflags(struct libmnt_update *upd) - { -+ assert(upd); - return upd ? upd->mountflags : 0; - } - -@@ -252,6 +256,7 @@ int mnt_update_force_rdonly(struct libmnt_update *upd, int rdonly) - { - int rc = 0; - -+ assert(upd); - if (!upd || !upd->fs) - return -EINVAL; - -@@ -505,6 +510,7 @@ static int update_table(struct libmnt_update *upd, struct libmnt_table *tb) - int rc, fd; - char *uq = NULL; - -+ assert(upd); - if (!tb || !upd->filename) - return -EINVAL; - -@@ -566,8 +572,11 @@ leave: - - static int add_file_entry(struct libmnt_table *tb, struct libmnt_update *upd) - { -- struct libmnt_fs *fs = mnt_copy_fs(NULL, upd->fs); -+ struct libmnt_fs *fs; -+ -+ assert(upd); - -+ fs = mnt_copy_fs(NULL, upd->fs); - if (!fs) - return -ENOMEM; - -@@ -638,6 +647,7 @@ static int update_modify_target(struct libmnt_update *upd, struct libmnt_lock *l - struct libmnt_table *tb = NULL; - int rc = 0; - -+ assert(upd); - DBG(UPDATE, mnt_debug_h(upd, "%s: modify target", upd->filename)); - - if (lc) -@@ -726,7 +736,6 @@ int mnt_update_table(struct libmnt_update *upd, struct libmnt_lock *lc) - int rc = -EINVAL; - - assert(upd); -- - if (!upd || !upd->filename) - return -EINVAL; - if (!upd->ready) -diff --git a/libmount/src/utils.c b/libmount/src/utils.c -index c910035..c328414 100644 ---- a/libmount/src/utils.c -+++ b/libmount/src/utils.c -@@ -269,6 +269,8 @@ int mnt_fstype_is_pseudofs(const char *type) - "tmpfs" - }; - -+ assert(type); -+ - return !(bsearch(&type, pseudofs, ARRAY_SIZE(pseudofs), - sizeof(char*), fstype_cmp) == NULL); - } -@@ -281,6 +283,8 @@ int mnt_fstype_is_pseudofs(const char *type) - */ - int mnt_fstype_is_netfs(const char *type) - { -+ assert(type); -+ - if (strcmp(type, "cifs") == 0 || - strcmp(type, "smbfs") == 0 || - strncmp(type,"nfs", 3) == 0 || -@@ -859,10 +863,13 @@ int mnt_open_uniq_filename(const char *filename, char **name) - */ - char *mnt_get_mountpoint(const char *path) - { -- char *mnt = strdup(path); -+ char *mnt; - struct stat st; - dev_t dir, base; - -+ assert(path); -+ -+ mnt = strdup(path); - if (!mnt) - return NULL; - if (*mnt == '/' && *(mnt + 1) == '\0') -diff --git a/libmount/src/version.c b/libmount/src/version.c -index 00e4f99..00b7c03 100644 ---- a/libmount/src/version.c -+++ b/libmount/src/version.c -@@ -25,6 +25,9 @@ static const char *lib_features[] = { - #ifdef CONFIG_LIBMOUNT_DEBUG - "debug", - #endif -+#ifdef CONFIG_LIBMOUNT_ASSERT -+ "assert", -+#endif - NULL - }; - -@@ -39,6 +42,8 @@ int mnt_parse_version_string(const char *ver_string) - const char *cp; - int version = 0; - -+ assert(ver_string); -+ - for (cp = ver_string; *cp; cp++) { - if (*cp == '.') - continue; --- -1.8.1.4 - diff --git a/sources b/sources index 09b9945..8f64420 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -abf3d68b534237b9c336dd5bfbf058d9 util-linux-2.23-rc2.tar.xz +cf5e9bb402371beaaffc3a5f276d5783 util-linux-2.23.tar.xz diff --git a/util-linux.spec b/util-linux.spec index cafc0bc..4472484 100644 --- a/util-linux.spec +++ b/util-linux.spec @@ -2,12 +2,12 @@ Summary: A collection of basic system utilities Name: util-linux Version: 2.23 -Release: 0.7%{?dist} +Release: 1%{?dist} License: GPLv2 and GPLv2+ and LGPLv2+ and BSD with advertising and Public Domain Group: System Environment/Base URL: http://en.wikipedia.org/wiki/Util-linux -%define upstream_version %{version}-rc2 +%define upstream_version %{version} ### Macros %define cytune_archs %{ix86} alpha %{arm} @@ -77,10 +77,6 @@ Requires: libmount = %{version}-%{release} # 151635 - makeing /var/log/lastlog Patch3: util-linux-ng-2.22-login-lastlog.patch -### upstream pathes (2.23) -# 948274 - interruption code 0x4003B in libmount.so.1.1.0 -Patch100: 0001-libmount-fix-mount.nfs-segfault-rely-on-assert-rathe.patch - %description The util-linux package contains a large variety of low-level system utilities that are necessary for a Linux system to function. Among @@ -234,6 +230,14 @@ make %{?_smp_mflags} # build nologin gcc $CFLAGS -o nologin nologin.c + +%check +#to run tests use "--with check" +%if %{?_with_check:1}%{!?_with_check:0} +make check +%endif + + %install rm -rf ${RPM_BUILD_ROOT} mkdir -p ${RPM_BUILD_ROOT}%{_bindir} @@ -788,6 +792,10 @@ fi %{_libdir}/pkgconfig/uuid.pc %changelog +* Thu Apr 25 2013 Karel Zak 2.23-1 +- upgrade to 2.23 +- add --with check to call make check + * Mon Apr 15 2013 Karel Zak 2.23-0.7 - remove unused patches