public inbox for util-linux@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 00/14] [pull] smatch scan, and manual tooling
@ 2013-04-08 19:32 Sami Kerola
  2013-04-08 19:32 ` [PATCH 01/14] setarch: clean up usage() Sami Kerola
                   ` (14 more replies)
  0 siblings, 15 replies; 16+ messages in thread
From: Sami Kerola @ 2013-04-08 19:32 UTC (permalink / raw)
  To: util-linux; +Cc: kerolasa

Hi Karel and others,

Yet another set of small fixes, which hopefully can be considered to be
taken to upstream before release.  There are couple patches that was
discussed earlier [0001 & 0003], and some few which Karel outsourced to
me [0008, 0012].  The rest of these patches are reactions to static
analyser, or test tools.


The following changes since commit 0540ea544d4b459bc148d29645225190b76ca8b7:

  libblkid: clean up DBG() (2013-04-08 18:22:13 +0200)

are available in the git repository at:

  git://github.com/kerolasa/lelux-utiliteetit.git 2013wk14

for you to fetch changes up to f4fe2ca9aba1d98e5bb9f7b52dfdefebef0a66d6:

  docs: add fsck.cramfs manual page (2013-04-08 20:20:27 +0100)

----------------------------------------------------------------
Sami Kerola (14):
      setarch: clean up usage()
      bash-completion: setarch: use correct list for architectures
      bash-completion: swapon: add options and fix argument
      various: fix variable and function declarations [smatch scan]
      various: fix shadow declarations [smatch scan]
      libmount, col: remove redundant null checks [smatch scan]
      libblkid: number of functions should not be declared extern [smatch scan]
      tools: add checks to manual page test script
      docs: mount.8: make propagation flags adjustable [checkmans.sh]
      docs: col.1: fix manual page name section [checkmans.sh]
      docs: remove repeated words [checkmans.sh]
      tools: make checkmans.sh to find missing manuals
      docs: add mkfs.cramfs manual page
      docs: add fsck.cramfs manual page

 bash-completion/setarch       |   9 +--
 bash-completion/swapon        |  19 ++++--
 disk-utils/Makemodule.am      |   2 +
 disk-utils/elvtune.8          |   2 +-
 disk-utils/fsck.cramfs.8      |  57 ++++++++++++++++++
 disk-utils/fsck.minix.c       |   3 +-
 disk-utils/mkfs.cramfs.8      |  90 ++++++++++++++++++++++++++++
 fdisks/fdiskdoslabel.c        |  38 ++++++------
 fdisks/sfdisk.c               |   8 +--
 lib/mbsalign.c                |   4 +-
 libblkid/src/dev.c            |  10 ++--
 libblkid/src/devname.c        |   6 +-
 libblkid/src/tag.c            |  10 ++--
 libfdisk/src/alignment.c      |   5 +-
 libmount/src/context_umount.c |   6 +-
 libmount/src/tab.c            |   8 +--
 libuuid/man/uuid_generate.3   |   2 +-
 misc-utils/findmnt.c          |   6 +-
 sys-utils/cytune.8            |   2 +-
 sys-utils/mount.8             |   9 ++-
 sys-utils/setarch.c           |  44 +++++++-------
 term-utils/wall.c             |  10 ++--
 text-utils/col.1              |   2 +-
 text-utils/col.c              |   7 +--
 text-utils/rev.c              |  12 ++--
 text-utils/tailf.c            |  10 ++--
 tools/checkmans.sh            | 134 ++++++++++++++++++++++++++++++++++--------
 27 files changed, 379 insertions(+), 136 deletions(-)
 create mode 100644 disk-utils/fsck.cramfs.8
 create mode 100644 disk-utils/mkfs.cramfs.8


^ permalink raw reply	[flat|nested] 16+ messages in thread

* [PATCH 01/14] setarch: clean up usage()
  2013-04-08 19:32 [PATCH 00/14] [pull] smatch scan, and manual tooling Sami Kerola
@ 2013-04-08 19:32 ` Sami Kerola
  2013-04-08 19:32 ` [PATCH 02/14] bash-completion: setarch: use correct list for architectures Sami Kerola
                   ` (13 subsequent siblings)
  14 siblings, 0 replies; 16+ messages in thread
From: Sami Kerola @ 2013-04-08 19:32 UTC (permalink / raw)
  To: util-linux; +Cc: kerolasa

Requested-by: Karel Zak <kzak@redhat.com>
References: http://marc.info/?l=util-linux-ng&m=136516351523680&w=2
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
---
 sys-utils/setarch.c | 44 +++++++++++++++++++++-----------------------
 1 file changed, 21 insertions(+), 23 deletions(-)

diff --git a/sys-utils/setarch.c b/sys-utils/setarch.c
index f6c0e20..051cbef 100644
--- a/sys-utils/setarch.c
+++ b/sys-utils/setarch.c
@@ -90,32 +90,30 @@ enum {
 static void __attribute__((__noreturn__))
 show_help(void)
 {
-   printf(USAGE_HEADER);
-   printf(_(" %s%s [options] [program [program arguments]]\n"),
-         program_invocation_short_name,
+  fputs(USAGE_HEADER, stdout);
+  printf(_(" %s%s [options] [program [program arguments]]\n"),
+	 program_invocation_short_name,
 	 !strcmp(program_invocation_short_name, "setarch") ? " <arch>" : "");
 
-   printf(USAGE_OPTIONS);
-   printf(_(
-   " -v, --verbose            says what options are being switched on\n"
-   " -R, --addr-no-randomize  disables randomization of the virtual address space\n"
-   " -F, --fdpic-funcptrs     makes function pointers point to descriptors\n"
-   " -Z, --mmap-page-zero     turns on MMAP_PAGE_ZERO\n"
-   " -L, --addr-compat-layout changes the way virtual memory is allocated\n"
-   " -X, --read-implies-exec  turns on READ_IMPLIES_EXEC\n"
-   " -B, --32bit              turns on ADDR_LIMIT_32BIT\n"
-   " -I, --short-inode        turns on SHORT_INODE\n"
-   " -S, --whole-seconds      turns on WHOLE_SECONDS\n"
-   " -T, --sticky-timeouts    turns on STICKY_TIMEOUTS\n"
-   " -3, --3gb                limits the used address space to a maximum of 3 GB\n"
-   "     --4gb                ignored (for backward compatibility only)\n"
-   "     --uname-2.6          turns on UNAME26\n"));
-   printf(_(
-   "     --list               list settable architectures, and exit\n"));
+  fputs(USAGE_OPTIONS, stdout);
+  fputs(_(" -v, --verbose            says what options are being switched on\n"), stdout);
+  fputs(_(" -R, --addr-no-randomize  disables randomization of the virtual address space\n"), stdout);
+  fputs(_(" -F, --fdpic-funcptrs     makes function pointers point to descriptors\n"), stdout);
+  fputs(_(" -Z, --mmap-page-zero     turns on MMAP_PAGE_ZERO\n"), stdout);
+  fputs(_(" -L, --addr-compat-layout changes the way virtual memory is allocated\n"), stdout);
+  fputs(_(" -X, --read-implies-exec  turns on READ_IMPLIES_EXEC\n"), stdout);
+  fputs(_(" -B, --32bit              turns on ADDR_LIMIT_32BIT\n"), stdout);
+  fputs(_(" -I, --short-inode        turns on SHORT_INODE\n"), stdout);
+  fputs(_(" -S, --whole-seconds      turns on WHOLE_SECONDS\n"), stdout);
+  fputs(_(" -T, --sticky-timeouts    turns on STICKY_TIMEOUTS\n"), stdout);
+  fputs(_(" -3, --3gb                limits the used address space to a maximum of 3 GB\n"), stdout);
+  fputs(_("     --4gb                ignored (for backward compatibility only)\n"), stdout);
+  fputs(_("     --uname-2.6          turns on UNAME26\n"), stdout);
+  fputs(_("     --list               list settable architectures, and exit\n"), stdout);
 
-  printf(USAGE_SEPARATOR);
-  printf(USAGE_HELP);
-  printf(USAGE_VERSION);
+  fputs(USAGE_SEPARATOR, stdout);
+  fputs(USAGE_HELP, stdout);
+  fputs(USAGE_VERSION, stdout);
   printf(USAGE_MAN_TAIL("setarch(8)"));
 
   exit(EXIT_SUCCESS);
-- 
1.8.2.1


^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [PATCH 02/14] bash-completion: setarch: use correct list for architectures
  2013-04-08 19:32 [PATCH 00/14] [pull] smatch scan, and manual tooling Sami Kerola
  2013-04-08 19:32 ` [PATCH 01/14] setarch: clean up usage() Sami Kerola
@ 2013-04-08 19:32 ` Sami Kerola
  2013-04-08 19:32 ` [PATCH 03/14] bash-completion: swapon: add options and fix argument Sami Kerola
                   ` (12 subsequent siblings)
  14 siblings, 0 replies; 16+ messages in thread
From: Sami Kerola @ 2013-04-08 19:32 UTC (permalink / raw)
  To: util-linux; +Cc: kerolasa

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
---
 bash-completion/setarch | 9 +--------
 1 file changed, 1 insertion(+), 8 deletions(-)

diff --git a/bash-completion/setarch b/bash-completion/setarch
index 80aabd5..b2c6a07 100644
--- a/bash-completion/setarch
+++ b/bash-completion/setarch
@@ -10,14 +10,7 @@ _setarch_module()
 			;;
 	esac
 	if [ $COMP_CWORD -eq 1 ]; then
-		COMPREPLY=( $(compgen -W "linux32 linux64 ppc32 ppc ppc64
-					  ppc64pseries ppc64iseries i386
-					  i486 i586 i686 athlon x86_64
-					  ia64 parisc32 parisc parisc64
-					  s390 s390x sparc sparc32bash
-					  sparc32 sparc64 mips32 mips
-					  mips64 alpha alphaev5 alphaev56
-					  alphaev6 alphaev67" -- $cur) )
+		COMPREPLY=( $(compgen -W "$(setarch --list)" -- $cur) )
 		return 0
 	fi
 	case $cur in
-- 
1.8.2.1


^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [PATCH 03/14] bash-completion: swapon: add options and fix argument
  2013-04-08 19:32 [PATCH 00/14] [pull] smatch scan, and manual tooling Sami Kerola
  2013-04-08 19:32 ` [PATCH 01/14] setarch: clean up usage() Sami Kerola
  2013-04-08 19:32 ` [PATCH 02/14] bash-completion: setarch: use correct list for architectures Sami Kerola
@ 2013-04-08 19:32 ` Sami Kerola
  2013-04-08 19:32 ` [PATCH 04/14] various: fix variable and function declarations [smatch scan] Sami Kerola
                   ` (11 subsequent siblings)
  14 siblings, 0 replies; 16+ messages in thread
From: Sami Kerola @ 2013-04-08 19:32 UTC (permalink / raw)
  To: util-linux; +Cc: kerolasa

The initial bash-completion missed swapon options -L and -U.  Use of
block device was proposed to be more appropriate than a path to a file.

Requested-by: Karel Zak <kzak@redhat.com>
References: http://marc.info/?l=util-linux-ng&m=136517310727426&w=2
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
---
 bash-completion/swapon | 19 +++++++++++++++----
 1 file changed, 15 insertions(+), 4 deletions(-)

diff --git a/bash-completion/swapon b/bash-completion/swapon
index e127153..7656d4e 100644
--- a/bash-completion/swapon
+++ b/bash-completion/swapon
@@ -19,6 +19,18 @@ _swapon_module()
 			COMPREPLY=( $(compgen -W "$OUTPUT" -S ',' -- $cur) )
 			return 0
 			;;
+		'-U')
+			local UUIDS
+			UUIDS="$(lsblk -nrp -o FSTYPE,UUID | awk '$1 ~ /swap/ { print $2 }')"
+			COMPREPLY=( $(compgen -W "$UUIDS" -- $cur) )
+			return 0
+			;;
+		'-L')
+			local LABELS
+			LABELS="$(lsblk -nrp -o FSTYPE,LABEL | awk '$1 ~ /swap/ { print $2 }')"
+			COMPREPLY=( $(compgen -W "$LABELS" -- $cur) )
+			return 0
+			;;
 		'-h'|'--help'|'-V'|'--version')
 			return 0
 			;;
@@ -42,10 +54,9 @@ _swapon_module()
 			return 0
 			;;
 	esac
-	# FIXME: compgen will split SPEC= from '=' point.  The append
-	# comma separated value problem is very similar.
-	compopt -o filenames
-	COMPREPLY=( $(compgen -f -- $cur) )
+	local DEVS
+	DEVS="$(lsblk -nrp -o FSTYPE,NAME | awk '$1 ~ /swap/ { print $2 }')"
+	COMPREPLY=( $(compgen -W "$DEVS" -- $cur) )
 	return 0
 }
 complete -F _swapon_module swapon
-- 
1.8.2.1


^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [PATCH 04/14] various: fix variable and function declarations [smatch scan]
  2013-04-08 19:32 [PATCH 00/14] [pull] smatch scan, and manual tooling Sami Kerola
                   ` (2 preceding siblings ...)
  2013-04-08 19:32 ` [PATCH 03/14] bash-completion: swapon: add options and fix argument Sami Kerola
@ 2013-04-08 19:32 ` Sami Kerola
  2013-04-08 19:32 ` [PATCH 05/14] various: fix shadow " Sami Kerola
                   ` (10 subsequent siblings)
  14 siblings, 0 replies; 16+ messages in thread
From: Sami Kerola @ 2013-04-08 19:32 UTC (permalink / raw)
  To: util-linux; +Cc: kerolasa

disk-utils/fsck.minix.c:511:9: warning: mixing declarations and code
fdisks/sfdisk.c:982:5: warning: mixing declarations and code
fdisks/sfdisk.c:1254:5: warning: mixing declarations and code
fdisks/sfdisk.c:1564:5: warning: mixing declarations and code
lib/mbsalign.c:279:7: warning: mixing declarations and code
libblkid/src/devname.c:378:17: warning: mixing declarations and code
libfdisk/src/alignment.c:219:9: warning: mixing declarations and code
term-utils/wall.c:111:9: warning: mixing declarations and code
text-utils/col.c:418:19: warning: non-ANSI function declaration of function 'flush_blanks'
text-utils/col.c:553:12: warning: non-ANSI function declaration of function 'alloc_line'
text-utils/rev.c:105:9: warning: mixing declarations and code
text-utils/tailf.c:245:9: warning: mixing declarations and code

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
---
 disk-utils/fsck.minix.c  |  3 ++-
 fdisks/sfdisk.c          |  8 ++++----
 lib/mbsalign.c           |  4 ++--
 libblkid/src/devname.c   |  6 +++---
 libfdisk/src/alignment.c |  5 +++--
 term-utils/wall.c        | 10 +++++-----
 text-utils/col.c         |  4 ++--
 text-utils/rev.c         | 12 ++++++------
 text-utils/tailf.c       | 10 +++++-----
 9 files changed, 32 insertions(+), 30 deletions(-)

diff --git a/disk-utils/fsck.minix.c b/disk-utils/fsck.minix.c
index 3482200..89e96fc 100644
--- a/disk-utils/fsck.minix.c
+++ b/disk-utils/fsck.minix.c
@@ -507,11 +507,12 @@ write_super_block(void) {
 
 static void
 write_tables(void) {
-	write_super_block();
 	unsigned long buffsz = get_inode_buffer_size();
 	unsigned long imaps = get_nimaps();
 	unsigned long zmaps = get_nzmaps();
 
+	write_super_block();
+
 	if (write_all(IN, inode_map, imaps * MINIX_BLOCK_SIZE))
 		die(_("Unable to write inode map"));
 
diff --git a/fdisks/sfdisk.c b/fdisks/sfdisk.c
index d98df9a..3206a6b 100644
--- a/fdisks/sfdisk.c
+++ b/fdisks/sfdisk.c
@@ -977,10 +977,10 @@ out_roundup_size(int width, unsigned long long n, unsigned long unit) {
 static struct geometry
 get_fdisk_geometry_one(struct part_desc *p) {
     struct geometry G;
-
-    memset(&G, 0, sizeof(struct geometry));
     chs b = p->p.end_chs;
     longchs bb = chs_to_longchs(b);
+
+    memset(&G, 0, sizeof(struct geometry));
     G.heads = bb.h + 1;
     G.sectors = bb.s;
     G.cylindersize = G.heads * G.sectors;
@@ -1167,6 +1167,7 @@ static int
 partitions_ok(int fd, struct disk_desc *z) {
     struct part_desc *partitions = &(z->partitions[0]), *p, *q;
     int partno = z->partno;
+    int sector_size;
 
 #define PNO(p) pnumber(p, z)
 
@@ -1251,7 +1252,6 @@ partitions_ok(int fd, struct disk_desc *z) {
 	    }
     }
 
-    int sector_size;
     if (blkdev_get_sector_size(fd, &sector_size) == -1)
 	sector_size = DEFAULT_SECTOR_SIZE;
 
@@ -1538,6 +1538,7 @@ msdos_partition(char *dev, int fd, unsigned long start, struct disk_desc *z) {
     struct part_desc *partitions = &(z->partitions[0]);
     int pno = z->partno;
     int bsd_later = 1;
+    unsigned short sig, magic;
 #ifdef __linux__
     bsd_later = (get_linux_version() >= KERNEL_VERSION(2, 3, 40));
 #endif
@@ -1561,7 +1562,6 @@ msdos_partition(char *dev, int fd, unsigned long start, struct disk_desc *z) {
 	return 0;
     }
 
-    unsigned short sig, magic;
     memcpy(&sig, s->data + 2, sizeof(sig));
     if (sig <= 0x1ae) {
 	memcpy(&magic, s->data + sig, sizeof(magic));
diff --git a/lib/mbsalign.c b/lib/mbsalign.c
index 05c4650..e420fea 100644
--- a/lib/mbsalign.c
+++ b/lib/mbsalign.c
@@ -173,7 +173,7 @@ mbsalign (const char *src, char *dest, size_t dest_size,
   const char *str_to_print = src;
   size_t n_cols = src_size - 1;
   size_t n_used_bytes = n_cols; /* Not including NUL */
-  size_t n_spaces = 0;
+  size_t n_spaces = 0, space_left;
   bool conversion = false;
   bool wc_enabled = false;
 
@@ -276,7 +276,7 @@ mbsalign_unibyte:
         }
 
       dest = mbs_align_pad (dest, dest_end, start_spaces);
-      size_t space_left = dest_end - dest;
+      space_left = dest_end - dest;
       dest = mempcpy (dest, str_to_print, min (n_used_bytes, space_left));
       mbs_align_pad (dest, dest_end, end_spaces);
     }
diff --git a/libblkid/src/devname.c b/libblkid/src/devname.c
index 1c1ab07..497deaf 100644
--- a/libblkid/src/devname.c
+++ b/libblkid/src/devname.c
@@ -371,12 +371,12 @@ ubi_probe_all(blkid_cache cache, int only_if_new)
 	const char **dirname;
 
 	for (dirname = dirlist; *dirname; dirname++) {
-		DBG(DEVNAME, blkid_debug("probing UBI volumes under %s",
-					  *dirname));
-
 		DIR		*dir;
 		struct dirent	*iter;
 
+		DBG(DEVNAME, blkid_debug("probing UBI volumes under %s",
+					  *dirname));
+
 		dir = opendir(*dirname);
 		if (dir == NULL)
 			continue ;
diff --git a/libfdisk/src/alignment.c b/libfdisk/src/alignment.c
index 25323d1..ac44e73 100644
--- a/libfdisk/src/alignment.c
+++ b/libfdisk/src/alignment.c
@@ -212,12 +212,13 @@ int fdisk_discover_geometry(struct fdisk_context *cxt)
 
 int fdisk_discover_topology(struct fdisk_context *cxt)
 {
+#ifdef HAVE_LIBBLKID
+	blkid_probe pr;
+#endif
 	assert(cxt);
 	assert(cxt->sector_size == 0);
 
 #ifdef HAVE_LIBBLKID
-	blkid_probe pr;
-
 	DBG(TOPOLOGY, dbgprint("initialize libblkid prober"));
 
 	pr = blkid_new_probe();
diff --git a/term-utils/wall.c b/term-utils/wall.c
index c2ac7ad..4865ac7 100644
--- a/term-utils/wall.c
+++ b/term-utils/wall.c
@@ -103,11 +103,6 @@ main(int argc, char **argv) {
 	size_t mbufsize;
 	unsigned timeout = WRITE_TIME_OUT;
 
-	setlocale(LC_ALL, "");
-	bindtextdomain(PACKAGE, LOCALEDIR);
-	textdomain(PACKAGE);
-	atexit(close_stdout);
-
 	static const struct option longopts[] = {
 		{ "nobanner",	no_argument,		0, 'n' },
 		{ "timeout",	required_argument,	0, 't' },
@@ -116,6 +111,11 @@ main(int argc, char **argv) {
 		{ NULL,	0, 0, 0 }
 	};
 
+	setlocale(LC_ALL, "");
+	bindtextdomain(PACKAGE, LOCALEDIR);
+	textdomain(PACKAGE);
+	atexit(close_stdout);
+
 	while ((ch = getopt_long(argc, argv, "nt:Vh", longopts, NULL)) != -1) {
 		switch (ch) {
 		case 'n':
diff --git a/text-utils/col.c b/text-utils/col.c
index c2b10dc..474b33f 100644
--- a/text-utils/col.c
+++ b/text-utils/col.c
@@ -415,7 +415,7 @@ void flush_lines(int nflush)
  * is the number of half line feeds, otherwise it is the number of whole line
  * feeds.
  */
-void flush_blanks()
+void flush_blanks(void)
 {
 	int half, i, nb;
 
@@ -550,7 +550,7 @@ void flush_line(LINE *l)
 static LINE *line_freelist;
 
 LINE *
-alloc_line()
+alloc_line(void)
 {
 	LINE *l;
 	int i;
diff --git a/text-utils/rev.c b/text-utils/rev.c
index 00d5196..9554506 100644
--- a/text-utils/rev.c
+++ b/text-utils/rev.c
@@ -94,6 +94,12 @@ int main(int argc, char *argv[])
 	FILE *fp = stdin;
 	int ch, rval = EXIT_SUCCESS;
 
+	static const struct option longopts[] = {
+		{ "version",    no_argument,       0, 'V' },
+		{ "help",       no_argument,       0, 'h' },
+		{ NULL,         0, 0, 0 }
+	};
+
 	setlocale(LC_ALL, "");
 	bindtextdomain(PACKAGE, LOCALEDIR);
 	textdomain(PACKAGE);
@@ -102,12 +108,6 @@ int main(int argc, char *argv[])
 	signal(SIGINT, sig_handler);
 	signal(SIGTERM, sig_handler);
 
-	static const struct option longopts[] = {
-		{ "version",    no_argument,       0, 'V' },
-		{ "help",       no_argument,       0, 'h' },
-		{ NULL,         0, 0, 0 }
-	};
-
 	while ((ch = getopt_long(argc, argv, "Vh", longopts, NULL)) != -1)
 		switch(ch) {
 		case 'V':
diff --git a/text-utils/tailf.c b/text-utils/tailf.c
index a8630fb..2f611a4 100644
--- a/text-utils/tailf.c
+++ b/text-utils/tailf.c
@@ -237,11 +237,6 @@ int main(int argc, char **argv)
 	struct stat st;
 	off_t size = 0;
 
-	setlocale(LC_ALL, "");
-	bindtextdomain(PACKAGE, LOCALEDIR);
-	textdomain(PACKAGE);
-	atexit(close_stdout);
-
 	static const struct option longopts[] = {
 		{ "lines",   required_argument, 0, 'n' },
 		{ "version", no_argument,	0, 'V' },
@@ -249,6 +244,11 @@ int main(int argc, char **argv)
 		{ NULL,      0, 0, 0 }
 	};
 
+	setlocale(LC_ALL, "");
+	bindtextdomain(PACKAGE, LOCALEDIR);
+	textdomain(PACKAGE);
+	atexit(close_stdout);
+
 	lines = old_style_option(&argc, argv);
 	if (lines < 0)
 		lines = DEFAULT_LINES;
-- 
1.8.2.1


^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [PATCH 05/14] various: fix shadow declarations [smatch scan]
  2013-04-08 19:32 [PATCH 00/14] [pull] smatch scan, and manual tooling Sami Kerola
                   ` (3 preceding siblings ...)
  2013-04-08 19:32 ` [PATCH 04/14] various: fix variable and function declarations [smatch scan] Sami Kerola
@ 2013-04-08 19:32 ` Sami Kerola
  2013-04-08 19:32 ` [PATCH 06/14] libmount, col: remove redundant null checks " Sami Kerola
                   ` (9 subsequent siblings)
  14 siblings, 0 replies; 16+ messages in thread
From: Sami Kerola @ 2013-04-08 19:32 UTC (permalink / raw)
  To: util-linux; +Cc: kerolasa

libmount/src/tab.c:990:34: warning: symbol 'fs' shadows an earlier one
libmount/src/tab.c:970:26: originally declared here
misc-utils/findmnt.c:492:30: warning: symbol 'tmp' shadows an earlier one
misc-utils/findmnt.c:473:14: originally declared here
fdisks/fdiskdoslabel.c:211:36: warning: symbol 'pe' shadows an earlier one
fdisks/fdiskdoslabel.c:180:20: originally declared here
fdisks/fdiskdoslabel.c:639:34: warning: symbol 'i' shadows an earlier one
fdisks/fdiskdoslabel.c:578:16: originally declared here
fdisks/fdiskdoslabel.c:947:21: warning: symbol 'i' shadows an earlier one
fdisks/fdiskdoslabel.c:924:16: originally declared here
fdisks/fdiskdoslabel.c:976:29: warning: symbol 'i' shadows an earlier one
fdisks/fdiskdoslabel.c:924:16: originally declared here
fdisks/fdiskdoslabel.c:984:29: warning: symbol 'i' shadows an earlier one
fdisks/fdiskdoslabel.c:924:16: originally declared here

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
---
 fdisks/fdiskdoslabel.c | 38 +++++++++++++++++++-------------------
 libmount/src/tab.c     |  8 ++++----
 misc-utils/findmnt.c   |  6 +++---
 3 files changed, 26 insertions(+), 26 deletions(-)

diff --git a/fdisks/fdiskdoslabel.c b/fdisks/fdiskdoslabel.c
index e2ec0d3..fe04ac7 100644
--- a/fdisks/fdiskdoslabel.c
+++ b/fdisks/fdiskdoslabel.c
@@ -208,14 +208,14 @@ static int dos_delete_partition(struct fdisk_context *cxt, size_t partnum)
 			ptes[partnum-1].changed = 1;
 		} else if (cxt->label->nparts_max > 5) {    /* 5 will be moved to 4 */
 			/* the first logical in a longer chain */
-			struct pte *pe = &ptes[5];
+			struct pte *pete = &ptes[5];
 
-			if (pe->part_table) /* prevent SEGFAULT */
-				set_start_sect(pe->part_table,
-					       get_partition_start(pe) -
+			if (pete->part_table) /* prevent SEGFAULT */
+				set_start_sect(pete->part_table,
+					       get_partition_start(pete) -
 					       extended_offset);
-			pe->offset = extended_offset;
-			pe->changed = 1;
+			pete->offset = extended_offset;
+			pete->changed = 1;
 		}
 
 		if (cxt->label->nparts_max > 5) {
@@ -636,14 +636,14 @@ static int add_partition(struct fdisk_context *cxt, int n, struct fdisk_parttype
 			read = 0;
 		}
 		if (!read && start == temp) {
-			sector_t i = start;
+			sector_t j = start;
 
-			start = read_int(cxt, cround(cxt, i), cround(cxt, dflt),
+			start = read_int(cxt, cround(cxt, j), cround(cxt, dflt),
 					cround(cxt, limit),
 					 0, mesg);
 			if (fdisk_context_use_cylinders(cxt)) {
 				start = (start - 1) * fdisk_context_get_units_per_sector(cxt);
-				if (start < i) start = i;
+				if (start < j) start = j;
 			}
 			read = 1;
 		}
@@ -944,14 +944,14 @@ static int dos_add_partition(
 			printf(_("If you want to create more than four partitions, you must replace a\n"
 				 "primary partition with an extended partition first.\n"));
 	} else if (cxt->label->nparts_max >= MAXIMUM_PARTS) {
-		int i;
+		int j;
 
 		printf(_("All logical partitions are in use\n"));
 		printf(_("Adding a primary partition\n"));
 
-		i = get_partition_unused_primary(cxt);
-		if (i >= 0)
-			rc = add_partition(cxt, i, t);
+		j = get_partition_unused_primary(cxt);
+		if (j >= 0)
+			rc = add_partition(cxt, j, t);
 	} else {
 		char c, line[LINE_LENGTH];
 		int dflt;
@@ -973,18 +973,18 @@ static int dos_add_partition(
 			printf(_("Using default response %c\n"), c);
 		}
 		if (c == 'p') {
-			int i = get_partition_unused_primary(cxt);
-			if (i >= 0)
-				rc = add_partition(cxt, i, t);
+			int j = get_partition_unused_primary(cxt);
+			if (j >= 0)
+				rc = add_partition(cxt, j, t);
 			goto done;
 		} else if (c == 'l' && extended_offset) {
 			rc = add_logical(cxt);
 			goto done;
 		} else if (c == 'e' && !extended_offset) {
-			int i = get_partition_unused_primary(cxt);
-			if (i >= 0) {
+			int j = get_partition_unused_primary(cxt);
+			if (j >= 0) {
 				t = fdisk_get_parttype_from_code(cxt, EXTENDED);
-				rc = add_partition(cxt, i, t);
+				rc = add_partition(cxt, j, t);
 			}
 			goto done;
 		} else
diff --git a/libmount/src/tab.c b/libmount/src/tab.c
index 9d524c1..11a2978 100644
--- a/libmount/src/tab.c
+++ b/libmount/src/tab.c
@@ -987,15 +987,15 @@ int mnt_table_is_fs_mounted(struct libmnt_table *tb, struct libmnt_fs *fstab_fs)
 
 	if (is_mountinfo(tb)) {
 		/* @tb is mountinfo, so we can try to use fs-roots */
-		struct libmnt_fs *fs;
+		struct libmnt_fs *rootfs;
 		int flags = 0;
 
 		if (mnt_fs_get_option(fstab_fs, "bind", NULL, NULL) == 0)
 			flags = MS_BIND;
 
-		fs = mnt_table_get_fs_root(tb, fstab_fs, flags, &root);
-		if (fs)
-			src = mnt_fs_get_srcpath(fs);
+		rootfs = mnt_table_get_fs_root(tb, fstab_fs, flags, &root);
+		if (rootfs)
+			src = mnt_fs_get_srcpath(rootfs);
 	}
 
 	if (!src)
diff --git a/misc-utils/findmnt.c b/misc-utils/findmnt.c
index 2491799..8f74449 100644
--- a/misc-utils/findmnt.c
+++ b/misc-utils/findmnt.c
@@ -489,9 +489,9 @@ static const char *get_data(struct libmnt_fs *fs, int num)
 				str = mnt_resolve_spec(str, cache);
 		}
 		if (root && str && !(flags & FL_NOFSROOT) && strcmp(root, "/")) {
-			char *tmp;
-			xasprintf(&tmp, "%s[%s]", str, root);
-			str = tmp;
+			char *temp;
+			xasprintf(&temp, "%s[%s]", str, root);
+			str = temp;
 		}
 		break;
 	}
-- 
1.8.2.1


^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [PATCH 06/14] libmount, col: remove redundant null checks [smatch scan]
  2013-04-08 19:32 [PATCH 00/14] [pull] smatch scan, and manual tooling Sami Kerola
                   ` (4 preceding siblings ...)
  2013-04-08 19:32 ` [PATCH 05/14] various: fix shadow " Sami Kerola
@ 2013-04-08 19:32 ` Sami Kerola
  2013-04-08 19:32 ` [PATCH 07/14] libblkid: number of functions should not be declared extern " Sami Kerola
                   ` (8 subsequent siblings)
  14 siblings, 0 replies; 16+ messages in thread
From: Sami Kerola @ 2013-04-08 19:32 UTC (permalink / raw)
  To: util-linux; +Cc: kerolasa

libmount/src/context_umount.c:174 mnt_context_find_umount_fs() info: redundant null check on loopdev calling free()
libmount/src/context_umount.c:179 mnt_context_find_umount_fs() info: redundant null check on loopdev calling free()
text-utils/col.c:406 flush_lines() info: redundant null check on l->l_line calling free()

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
---
 libmount/src/context_umount.c | 6 ++----
 text-utils/col.c              | 3 +--
 2 files changed, 3 insertions(+), 6 deletions(-)

diff --git a/libmount/src/context_umount.c b/libmount/src/context_umount.c
index 96ae87a..b948459 100644
--- a/libmount/src/context_umount.c
+++ b/libmount/src/context_umount.c
@@ -170,13 +170,11 @@ try_loopdev:
 	}
 
 	*pfs = fs;
-	if (loopdev)
-		free(loopdev);
+	free(loopdev);
 
 	return fs ? 0 : 1;
 err:
-	if (loopdev)
-		free(loopdev);
+	free(loopdev);
 	return rc;
 }
 
diff --git a/text-utils/col.c b/text-utils/col.c
index 474b33f..9aa6a41 100644
--- a/text-utils/col.c
+++ b/text-utils/col.c
@@ -402,8 +402,7 @@ void flush_lines(int nflush)
 			flush_line(l);
 		}
 		nblank_lines++;
-		if (l->l_line)
-			free((void *)l->l_line);
+		free((void *)l->l_line);
 		free_line(l);
 	}
 	if (lines)
-- 
1.8.2.1


^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [PATCH 07/14] libblkid: number of functions should not be declared extern [smatch scan]
  2013-04-08 19:32 [PATCH 00/14] [pull] smatch scan, and manual tooling Sami Kerola
                   ` (5 preceding siblings ...)
  2013-04-08 19:32 ` [PATCH 06/14] libmount, col: remove redundant null checks " Sami Kerola
@ 2013-04-08 19:32 ` Sami Kerola
  2013-04-08 19:32 ` [PATCH 08/14] tools: add checks to manual page test script Sami Kerola
                   ` (7 subsequent siblings)
  14 siblings, 0 replies; 16+ messages in thread
From: Sami Kerola @ 2013-04-08 19:32 UTC (permalink / raw)
  To: util-linux; +Cc: kerolasa

These functions are already marked extern in header file.

libblkid/src/dev.c:70:19: warning: function 'blkid_dev_devname' with external linkage has definition
libblkid/src/dev.c:128:26: warning: function 'blkid_dev_iterate_begin' with external linkage has definition
libblkid/src/dev.c:148:12: warning: function 'blkid_dev_set_search' with external linkage has definition
libblkid/src/dev.c:175:12: warning: function 'blkid_dev_next' with external linkage has definition
libblkid/src/dev.c:196:13: warning: function 'blkid_dev_iterate_end' with external linkage has definition
libblkid/src/tag.c:84:12: warning: function 'blkid_dev_has_tag' with external linkage has definition
libblkid/src/tag.c:282:26: warning: function 'blkid_tag_iterate_begin' with external linkage has definition
libblkid/src/tag.c:303:12: warning: function 'blkid_tag_next' with external linkage has definition
libblkid/src/tag.c:322:13: warning: function 'blkid_tag_iterate_end' with external linkage has definition
libblkid/src/tag.c:336:18: warning: function 'blkid_find_dev_with_tag' with external linkage has definition

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
---
 libblkid/src/dev.c | 10 +++++-----
 libblkid/src/tag.c | 10 +++++-----
 2 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/libblkid/src/dev.c b/libblkid/src/dev.c
index 11d0a02..a4b2aea 100644
--- a/libblkid/src/dev.c
+++ b/libblkid/src/dev.c
@@ -67,7 +67,7 @@ void blkid_free_dev(blkid_dev dev)
 /*
  * Given a blkid device, return its name
  */
-extern const char *blkid_dev_devname(blkid_dev dev)
+const char *blkid_dev_devname(blkid_dev dev)
 {
 	return dev ? dev->bid_name : NULL;
 }
@@ -124,7 +124,7 @@ struct blkid_struct_dev_iterate {
 	struct list_head	*p;
 };
 
-extern blkid_dev_iterate blkid_dev_iterate_begin(blkid_cache cache)
+blkid_dev_iterate blkid_dev_iterate_begin(blkid_cache cache)
 {
 	blkid_dev_iterate iter;
 
@@ -144,7 +144,7 @@ extern blkid_dev_iterate blkid_dev_iterate_begin(blkid_cache cache)
 	return iter;
 }
 
-extern int blkid_dev_set_search(blkid_dev_iterate iter,
+int blkid_dev_set_search(blkid_dev_iterate iter,
 				 char *search_type, char *search_value)
 {
 	char *new_type, *new_value;
@@ -171,7 +171,7 @@ extern int blkid_dev_set_search(blkid_dev_iterate iter,
 /*
  * Return 0 on success, -1 on error
  */
-extern int blkid_dev_next(blkid_dev_iterate iter,
+int blkid_dev_next(blkid_dev_iterate iter,
 			  blkid_dev *ret_dev)
 {
 	blkid_dev		dev;
@@ -192,7 +192,7 @@ extern int blkid_dev_next(blkid_dev_iterate iter,
 	return -1;
 }
 
-extern void blkid_dev_iterate_end(blkid_dev_iterate iter)
+void blkid_dev_iterate_end(blkid_dev_iterate iter)
 {
 	if (!iter || iter->magic != DEV_ITERATE_MAGIC)
 		return;
diff --git a/libblkid/src/tag.c b/libblkid/src/tag.c
index 55df90e..9cfd617 100644
--- a/libblkid/src/tag.c
+++ b/libblkid/src/tag.c
@@ -81,7 +81,7 @@ blkid_tag blkid_find_tag_dev(blkid_dev dev, const char *type)
 	return NULL;
 }
 
-extern int blkid_dev_has_tag(blkid_dev dev, const char *type,
+int blkid_dev_has_tag(blkid_dev dev, const char *type,
 			     const char *value)
 {
 	blkid_tag		tag;
@@ -277,7 +277,7 @@ struct blkid_struct_tag_iterate {
 	struct list_head	*p;
 };
 
-extern blkid_tag_iterate blkid_tag_iterate_begin(blkid_dev dev)
+blkid_tag_iterate blkid_tag_iterate_begin(blkid_dev dev)
 {
 	blkid_tag_iterate	iter;
 
@@ -298,7 +298,7 @@ extern blkid_tag_iterate blkid_tag_iterate_begin(blkid_dev dev)
 /*
  * Return 0 on success, -1 on error
  */
-extern int blkid_tag_next(blkid_tag_iterate iter,
+int blkid_tag_next(blkid_tag_iterate iter,
 			  const char **type, const char **value)
 {
 	blkid_tag tag;
@@ -317,7 +317,7 @@ extern int blkid_tag_next(blkid_tag_iterate iter,
 	return 0;
 }
 
-extern void blkid_tag_iterate_end(blkid_tag_iterate iter)
+void blkid_tag_iterate_end(blkid_tag_iterate iter)
 {
 	if (!iter || iter->magic != TAG_ITERATE_MAGIC)
 		return;
@@ -331,7 +331,7 @@ extern void blkid_tag_iterate_end(blkid_tag_iterate iter)
  * search specification, it returns the one with the highest priority
  * value.  This allows us to give preference to EVMS or LVM devices.
  */
-extern blkid_dev blkid_find_dev_with_tag(blkid_cache cache,
+blkid_dev blkid_find_dev_with_tag(blkid_cache cache,
 					 const char *type,
 					 const char *value)
 {
-- 
1.8.2.1


^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [PATCH 08/14] tools: add checks to manual page test script
  2013-04-08 19:32 [PATCH 00/14] [pull] smatch scan, and manual tooling Sami Kerola
                   ` (6 preceding siblings ...)
  2013-04-08 19:32 ` [PATCH 07/14] libblkid: number of functions should not be declared extern " Sami Kerola
@ 2013-04-08 19:32 ` Sami Kerola
  2013-04-08 19:32 ` [PATCH 09/14] docs: mount.8: make propagation flags adjustable [checkmans.sh] Sami Kerola
                   ` (6 subsequent siblings)
  14 siblings, 0 replies; 16+ messages in thread
From: Sami Kerola @ 2013-04-08 19:32 UTC (permalink / raw)
  To: util-linux; +Cc: kerolasa, Peter Schiffer

This change includes

- better way to detect manual page inclusion
- man -k header test, which uses lexgrog
- repeated word detection
- static declaration to known repeated words

Most of the  changes are based on man-page-day-1.sh, that is in use at
RedHat Quality Assurance, and wrote by Peter Schiffer.

CC: Peter Schiffer <pschiffe@redhat.com>
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
---
 tools/checkmans.sh | 98 +++++++++++++++++++++++++++++++++++++++++-------------
 1 file changed, 74 insertions(+), 24 deletions(-)

diff --git a/tools/checkmans.sh b/tools/checkmans.sh
index 4b149d0..a987f41 100755
--- a/tools/checkmans.sh
+++ b/tools/checkmans.sh
@@ -13,15 +13,21 @@ SCRIPT_INVOCATION_SHORT_NAME=$(basename ${0})
 trap 'echo "${SCRIPT_INVOCATION_SHORT_NAME}: exit on error"; exit 1' ERR
 
 usage() {
-	echo "Usage: ${0} [-ph]"
-	echo " -p   print file names before checking"
+	echo "Usage: ${0} [-vVh]"
+	echo " -v  verbose messaging"
+	echo " -V  print version and exit"
+	echo " -h  print this help and exit"
 }
 
-PRINT_FILE_NAMES='false'
-while getopts ph OPTIONS; do
+VERBOSE='false'
+while getopts vVh OPTIONS; do
 	case ${OPTIONS} in
-		p)
-			PRINT_FILE_NAMES='true'
+		v)
+			VERBOSE='true'
+			;;
+		V)
+			echo "util-linux: ${SCRIPT_INVOCATION_SHORT_NAME}: 2"
+			exit 0
 			;;
 		h)
 			usage
@@ -37,39 +43,83 @@ ERROR_FILE=$(mktemp ${SCRIPT_INVOCATION_SHORT_NAME}.XXXXXXXXXX)
 # remove tmp file at exit
 trap "rm -f ${ERROR_FILE}" 0
 
+COUNT_ERRORS=0
+declare -a REPEATS
+declare -A KNOWN_REPEATS
+KNOWN_REPEATS[mount.8]='foo'
+KNOWN_REPEATS[sfdisk.8]="0 <c,h,s>"
+KNOWN_REPEATS[flock.1]='"$0"'
+KNOWN_REPEATS[switch_root.8]='$DIR'
+
+remove_repeats()
+{
+	set +u
+	for KN in ${KNOWN_REPEATS[${I##*/}]}; do
+		if [ "${KN}" = "${REPEATS[$1]}" ]; then
+			if $VERBOSE; then
+				echo "info: ${I} removing repeat: ${REPEATS[$1]}"
+			fi
+			unset REPEATS[$1]
+		fi
+	done
+	set -u
+}
+
 for I in $(
 	find $(git rev-parse --show-toplevel) -name '*.[1-8]' |
 	egrep -v '(Documentation|.git|/.libs/|autom4te.cache)'
 ); do
-	# FIXME: the determination whether a manual does include
-	# should probably be somewhat smarter.
-	IS_INCLUDE=$(wc -w ${I} | awk '{print $1}')
-	if [ ${IS_INCLUDE} -eq 2 ]; then
-		# Some manuals, such as x86_64, call include which
-		# will read system manual.  Testing what comes from
-		# package does not make much sense, so skip doing it.
-		if ${PRINT_FILE_NAMES}; then
-			echo "skipping: ${I}"
+	if awk '{if (1 < NR) {exit 1}; if ($1 ~ /^.so$/) {exit 0}}' ${I}; then
+		# Some manuals, such as x86_64, call inclusion and they
+		# should not be tested any further.
+		if ${VERBOSE}; then
+			printf "skipping: ${I}: includes "
+			awk '{print $2}' ${I}
 		fi
 		continue
 	fi
-	if ${PRINT_FILE_NAMES}; then
+	I_ERR=0
+	if ${VERBOSE}; then
 		echo "testing: ${I}"
-		man --warnings=all ${I} >/dev/null
-	else
-		man --warnings=all ${I} >/dev/null 2>> ${ERROR_FILE}
 	fi
+	MANWIDTH=80 man --warnings=all ${I} >/dev/null 2>| ${ERROR_FILE}
+	if [ -s ${ERROR_FILE} ]; then
+		echo "error: run: man --warnings=all ${I} >/dev/null" >&2
+		I_ERR=1
+	fi
+	if ! lexgrog ${I} >/dev/null; then
+		echo "error: run: lexgrog ${I}" >&2
+		I_ERR=1
+	fi
+	REPEATS=( $(MANWIDTH=2000 man -l ${I} |
+		col -b |
+		sed  -e 's/\s\+/\n/g; /^$/d' |
+		awk 'BEGIN { p="" } { if (0 < length($0)) { if (p == $0) { print } } p = $0 }') )
+	if [ 0 -lt "${#REPEATS[@]}" ]; then
+		ITER=${#REPEATS[@]}
+		while [ -1 -lt ${ITER} ]; do
+			remove_repeats ${ITER}
+			# The 'let' may cause exit on error.
+			# When ITER == 0 -> let returns 1, bash bug?
+			let ITER=${ITER}-1 || true
+		done
+		if [ 0 -lt "${#REPEATS[@]}" ]; then
+			echo "warning: ${I} has repeating words: ${REPEATS[@]}"
+		fi
+	fi
+	# The 'let' may cause exit on error.
+	# COUNT_ERRORS=0; let COUNT_ERRORS=$COUNT_ERRORS+0; echo $?
+	# Is this a bash bug?
+	let COUNT_ERRORS=$COUNT_ERRORS+$I_ERR || true
 done
 
-COUNT_ERRORS=$(awk 'END {print NR}' ${ERROR_FILE})
 if [ ${COUNT_ERRORS} -ne 0 ]; then
-	echo "${SCRIPT_INVOCATION_SHORT_NAME}: failed"
-	echo "use: $(readlink -f ${0}) -p"
-	echo "     to find where the problems are."
+	echo "error: ${SCRIPT_INVOCATION_SHORT_NAME}: ${COUNT_ERRORS} manuals failed" >&2
 	exit 1
 fi
 
-if ! ${PRINT_FILE_NAMES}; then
+if ! ${VERBOSE}; then
 	echo "${SCRIPT_INVOCATION_SHORT_NAME}: success"
 fi
+
 exit 0
-- 
1.8.2.1


^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [PATCH 09/14] docs: mount.8: make propagation flags adjustable [checkmans.sh]
  2013-04-08 19:32 [PATCH 00/14] [pull] smatch scan, and manual tooling Sami Kerola
                   ` (7 preceding siblings ...)
  2013-04-08 19:32 ` [PATCH 08/14] tools: add checks to manual page test script Sami Kerola
@ 2013-04-08 19:32 ` Sami Kerola
  2013-04-08 19:32 ` [PATCH 10/14] docs: col.1: fix manual page name section [checkmans.sh] Sami Kerola
                   ` (5 subsequent siblings)
  14 siblings, 0 replies; 16+ messages in thread
From: Sami Kerola @ 2013-04-08 19:32 UTC (permalink / raw)
  To: util-linux; +Cc: kerolasa

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
---
 sys-utils/mount.8 | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/sys-utils/mount.8 b/sys-utils/mount.8
index 4538605..72f0f0b 100644
--- a/sys-utils/mount.8
+++ b/sys-utils/mount.8
@@ -506,7 +506,14 @@ after previous successful mount operation. Note that this use case is not
 atomic. The propagation flags is possible to specify in
 .BR fstab (5)
 as mount options
-(private,slave,shared,unbindable,rprivate,rslave,rshared,runbindable).
+.RI ( private ,
+.IR slave ,
+.IR shared ,
+.IR unbindable ,
+.IR rprivate ,
+.IR rslave ,
+.IR rshared ,
+.IR runbindable ).
 
 For example
 .RS
-- 
1.8.2.1


^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [PATCH 10/14] docs: col.1: fix manual page name section [checkmans.sh]
  2013-04-08 19:32 [PATCH 00/14] [pull] smatch scan, and manual tooling Sami Kerola
                   ` (8 preceding siblings ...)
  2013-04-08 19:32 ` [PATCH 09/14] docs: mount.8: make propagation flags adjustable [checkmans.sh] Sami Kerola
@ 2013-04-08 19:32 ` Sami Kerola
  2013-04-08 19:32 ` [PATCH 11/14] docs: remove repeated words [checkmans.sh] Sami Kerola
                   ` (4 subsequent siblings)
  14 siblings, 0 replies; 16+ messages in thread
From: Sami Kerola @ 2013-04-08 19:32 UTC (permalink / raw)
  To: util-linux; +Cc: kerolasa

$ lexgrog text-utils/col.1
text-utils/col.1: parse failed

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
---
 text-utils/col.1 | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/text-utils/col.1 b/text-utils/col.1
index 9efc72f..2b36c85 100644
--- a/text-utils/col.1
+++ b/text-utils/col.1
@@ -35,7 +35,7 @@
 .\"     @(#)col.1	6.8 (Berkeley) 6/17/91
 .\"
 .TH COL "1" "September 2011" "util-linux" "User Commands"
-.SH COL
+.SH NAME
 col - filter reverse line feeds from input
 .SH SYNOPSIS
 .B col
-- 
1.8.2.1


^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [PATCH 11/14] docs: remove repeated words [checkmans.sh]
  2013-04-08 19:32 [PATCH 00/14] [pull] smatch scan, and manual tooling Sami Kerola
                   ` (9 preceding siblings ...)
  2013-04-08 19:32 ` [PATCH 10/14] docs: col.1: fix manual page name section [checkmans.sh] Sami Kerola
@ 2013-04-08 19:32 ` Sami Kerola
  2013-04-08 19:32 ` [PATCH 12/14] tools: make checkmans.sh to find missing manuals Sami Kerola
                   ` (3 subsequent siblings)
  14 siblings, 0 replies; 16+ messages in thread
From: Sami Kerola @ 2013-04-08 19:32 UTC (permalink / raw)
  To: util-linux; +Cc: kerolasa

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
---
 disk-utils/elvtune.8        | 2 +-
 libuuid/man/uuid_generate.3 | 2 +-
 sys-utils/cytune.8          | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/disk-utils/elvtune.8 b/disk-utils/elvtune.8
index f71b1d4..0554269 100644
--- a/disk-utils/elvtune.8
+++ b/disk-utils/elvtune.8
@@ -45,7 +45,7 @@ pending in the queue.
 Display help text and exit.
 .TP
 .BI -v
-Display version version information and exit.
+Display version information and exit.
 .SH NOTE
 Actually, the only fields tunable are those relative
 to the IO scheduler.  It's not possible to select
diff --git a/libuuid/man/uuid_generate.3 b/libuuid/man/uuid_generate.3
index 07ad94c..3bb789c 100644
--- a/libuuid/man/uuid_generate.3
+++ b/libuuid/man/uuid_generate.3
@@ -79,7 +79,7 @@ by concurrently running processes, the uuid library uses global
 clock state counter (if the process has permissions to gain exclusive access
 to this file) and/or the
 .B uuidd
-daemon, if it is running already or can be be spawned by the process (if
+daemon, if it is running already or can be spawned by the process (if
 installed and the process has enough permissions to run it).  If neither of
 these two synchronization mechanisms can be used, it is theoretically possible
 that two concurrently running processes obtain the same UUID(s).  To tell
diff --git a/sys-utils/cytune.8 b/sys-utils/cytune.8
index fd82391..940fa28 100644
--- a/sys-utils/cytune.8
+++ b/sys-utils/cytune.8
@@ -154,7 +154,7 @@ units.  When the
 .I tty
 is next opened, this value will be used instead of the default.  If
 .I value
-is zero, then the the value will default to 0x20 (160ms), soon to be 0x02
+is zero, then the value will default to 0x20 (160ms), soon to be 0x02
 (10ms).
 .TP
 \fB\-G\fR, \fB\-\-get\-glush\fR
-- 
1.8.2.1


^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [PATCH 12/14] tools: make checkmans.sh to find missing manuals
  2013-04-08 19:32 [PATCH 00/14] [pull] smatch scan, and manual tooling Sami Kerola
                   ` (10 preceding siblings ...)
  2013-04-08 19:32 ` [PATCH 11/14] docs: remove repeated words [checkmans.sh] Sami Kerola
@ 2013-04-08 19:32 ` Sami Kerola
  2013-04-08 19:32 ` [PATCH 13/14] docs: add mkfs.cramfs manual page Sami Kerola
                   ` (2 subsequent siblings)
  14 siblings, 0 replies; 16+ messages in thread
From: Sami Kerola @ 2013-04-08 19:32 UTC (permalink / raw)
  To: util-linux; +Cc: kerolasa, Peter Schiffer

Finding missing manuals is loosely based on ideas in man-page-day-1.sh,
wrote by Peter Schiffer.

CC: Peter Schiffer <pschiffe@redhat.com>
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
---
 tools/checkmans.sh | 44 ++++++++++++++++++++++++++++++++++++++++----
 1 file changed, 40 insertions(+), 4 deletions(-)

diff --git a/tools/checkmans.sh b/tools/checkmans.sh
index a987f41..bc3ba8f 100755
--- a/tools/checkmans.sh
+++ b/tools/checkmans.sh
@@ -43,6 +43,9 @@ ERROR_FILE=$(mktemp ${SCRIPT_INVOCATION_SHORT_NAME}.XXXXXXXXXX)
 # remove tmp file at exit
 trap "rm -f ${ERROR_FILE}" 0
 
+# Try to find missing manuals matching build targets with manual files.
+declare -A MAN_LIST BIN_LIST
+
 COUNT_ERRORS=0
 declare -a REPEATS
 declare -A KNOWN_REPEATS
@@ -69,11 +72,13 @@ for I in $(
 	find $(git rev-parse --show-toplevel) -name '*.[1-8]' |
 	egrep -v '(Documentation|.git|/.libs/|autom4te.cache)'
 ); do
+	MAN_FILE=${I##*/}
+	MAN_LIST[${MAN_FILE%%.[0-9]}]=1
 	if awk '{if (1 < NR) {exit 1}; if ($1 ~ /^.so$/) {exit 0}}' ${I}; then
 		# Some manuals, such as x86_64, call inclusion and they
 		# should not be tested any further.
 		if ${VERBOSE}; then
-			printf "skipping: ${I}: includes "
+			printf "skipping: ${I##*util-linux/}: includes "
 			awk '{print $2}' ${I}
 		fi
 		continue
@@ -84,11 +89,11 @@ for I in $(
 	fi
 	MANWIDTH=80 man --warnings=all ${I} >/dev/null 2>| ${ERROR_FILE}
 	if [ -s ${ERROR_FILE} ]; then
-		echo "error: run: man --warnings=all ${I} >/dev/null" >&2
+		echo "error: run: man --warnings=all ${I##*util-linux/} >/dev/null" >&2
 		I_ERR=1
 	fi
 	if ! lexgrog ${I} >/dev/null; then
-		echo "error: run: lexgrog ${I}" >&2
+		echo "error: run: lexgrog ${I##*util-linux/}" >&2
 		I_ERR=1
 	fi
 	REPEATS=( $(MANWIDTH=2000 man -l ${I} |
@@ -104,7 +109,7 @@ for I in $(
 			let ITER=${ITER}-1 || true
 		done
 		if [ 0 -lt "${#REPEATS[@]}" ]; then
-			echo "warning: ${I} has repeating words: ${REPEATS[@]}"
+			echo "warning: ${I##*util-linux/} has repeating words: ${REPEATS[@]}"
 		fi
 	fi
 	# The 'let' may cause exit on error.
@@ -113,6 +118,37 @@ for I in $(
 	let COUNT_ERRORS=$COUNT_ERRORS+$I_ERR || true
 done
 
+# Create a list of build targets.
+for I in $(find $(git rev-parse --show-toplevel) -name 'Make*.am' | xargs awk '
+$1 ~ /_SOURCES/ {
+	if ($1 ~ /^test/ ||
+	    $1 ~ /^no(inst|dist)/ ||
+	    $1 ~ /^sample/ ||
+	    $1 ~ /^BUILT/) {
+		next
+	}
+	sub(/_SOURCES/, "")
+	if ($1 ~ /^lib.*_la/) {
+		next
+	}
+	sub(/_static/, "")
+	gsub(/_/, ".")
+	sub(/switch.root/, "switch_root")
+	sub(/pivot.root/, "pivot_root")
+	print $1
+}'); do
+	BIN_LIST[$I]=1
+done
+
+# Find if build target does not have manual.
+set +u
+for I in ${!BIN_LIST[@]}; do
+	if [ -v ${MAN_LIST[$I]} ]; then
+		echo "warning: ${I} does not have man page"
+	fi
+done
+set -u
+
 if [ ${COUNT_ERRORS} -ne 0 ]; then
 	echo "error: ${SCRIPT_INVOCATION_SHORT_NAME}: ${COUNT_ERRORS} manuals failed" >&2
 	exit 1
-- 
1.8.2.1


^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [PATCH 13/14] docs: add mkfs.cramfs manual page
  2013-04-08 19:32 [PATCH 00/14] [pull] smatch scan, and manual tooling Sami Kerola
                   ` (11 preceding siblings ...)
  2013-04-08 19:32 ` [PATCH 12/14] tools: make checkmans.sh to find missing manuals Sami Kerola
@ 2013-04-08 19:32 ` Sami Kerola
  2013-04-08 19:32 ` [PATCH 14/14] docs: add fsck.cramfs " Sami Kerola
  2013-04-09 10:30 ` [PATCH 00/14] [pull] smatch scan, and manual tooling Karel Zak
  14 siblings, 0 replies; 16+ messages in thread
From: Sami Kerola @ 2013-04-08 19:32 UTC (permalink / raw)
  To: util-linux; +Cc: kerolasa

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
---
 disk-utils/Makemodule.am |  1 +
 disk-utils/mkfs.cramfs.8 | 90 ++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 91 insertions(+)
 create mode 100644 disk-utils/mkfs.cramfs.8

diff --git a/disk-utils/Makemodule.am b/disk-utils/Makemodule.am
index fb5daba..70b058b 100644
--- a/disk-utils/Makemodule.am
+++ b/disk-utils/Makemodule.am
@@ -96,6 +96,7 @@ fsck_cramfs_LDADD = $(LDADD) -lz libcommon.la
 sbin_PROGRAMS += mkfs.cramfs
 mkfs_cramfs_SOURCES = disk-utils/mkfs.cramfs.c $(cramfs_common_sources)
 mkfs_cramfs_LDADD = $(LDADD) -lz libcommon.la
+dist_man_MANS += disk-utils/mkfs.cramfs.8
 
 check_PROGRAMS += test_fsck.cramfs
 test_fsck_cramfs_SOURCES = $(fsck_cramfs_SOURCES)
diff --git a/disk-utils/mkfs.cramfs.8 b/disk-utils/mkfs.cramfs.8
new file mode 100644
index 0000000..08eeb1a
--- /dev/null
+++ b/disk-utils/mkfs.cramfs.8
@@ -0,0 +1,90 @@
+.TH EXAMPLE "8" "April 2013" "util-linux" "System Administration"
+.SH NAME
+mkfs.cramfs \- make compressed ROM file system
+.SH SYNOPSIS
+.B mkfs.cramfs
+[options]
+.I directory file
+.SH DESCRIPTION
+Files on cramfs file systems are zlib-compressed one page at a time to
+allow random read access.  The metadata is not compressed, but is
+expressed in a terse representation that is more space-efficient than
+conventional file systems.
+.PP
+The file system is intentionally read-only to simplify its design; random
+write access for compressed files is difficult to implement.  cramfs
+ships with a utility (mkcramfs) to pack files into new cramfs images.
+.PP
+File sizes are limited to less than 16MB.
+.PP
+Maximum file system size is a little under 272MB.  (The last file on the
+file system must begin before the 256MB block, but can extend past it.)
+.SH ARGUMENTS
+The
+.I directory
+is simply the root of the directory tree that we want to generate a
+compressed filesystem out of.
+.PP
+The
+.I file
+will contain the cram file system, which later can be mounted.
+.SH OPTIONS
+.TP
+\fB\-v\fR
+Enable verbose messaging.
+.TP
+\fB\-E\fR
+Treat all warnings as errors, which are reflected as command return value.
+.TP
+\fB\-b\fR \fIblocksize\fR
+Use defined block size, which has to be divisible by page size.
+.TP
+\fB\-e\fR \fIedition\fR
+Use defined file system edition number in superblock.
+.TP
+\fB\-N\fR \fIbig, little, host\fR
+Use defined endianness.  Value defaults to
+.IR host .
+.TP
+\fB\-i\fR \fIfile\fR
+Insert a
+.I file
+to cramfs file system.
+.TP
+\fB\-n\fR \fIname\fR
+Set name of the cramfs file system.
+.TP
+\fB\-p\fR
+Pad by 512 bytes for boot code.
+.TP
+\fB\-s\fR
+This option is ignored.  Originally the \-s turned on directory entry
+sorting.
+.TP
+\fB\-z\fR
+Make explicit holes.  Use of this option will require 2.3.39 kernel, or newer.
+.TP
+\fB\-V\fR
+Display version information and exit.
+.TP
+\fB\-h\fR
+Display help and exit.
+.SH "EXIT STATUS"
+.RS
+.PD 0
+.TP
+.B 0
+success
+.TP
+.B 8
+operation error, such as unable to allocate memory
+.PD
+.RE
+.SH "SEE ALSO"
+.BR mount (8),
+.BR fsck.cramfs (8)
+.SH AVAILABILITY
+The example command is part of the util-linux package and is available from
+.UR ftp://\:ftp.kernel.org\:/pub\:/linux\:/utils\:/util-linux/
+Linux Kernel Archive
+.UE .
-- 
1.8.2.1


^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [PATCH 14/14] docs: add fsck.cramfs manual page
  2013-04-08 19:32 [PATCH 00/14] [pull] smatch scan, and manual tooling Sami Kerola
                   ` (12 preceding siblings ...)
  2013-04-08 19:32 ` [PATCH 13/14] docs: add mkfs.cramfs manual page Sami Kerola
@ 2013-04-08 19:32 ` Sami Kerola
  2013-04-09 10:30 ` [PATCH 00/14] [pull] smatch scan, and manual tooling Karel Zak
  14 siblings, 0 replies; 16+ messages in thread
From: Sami Kerola @ 2013-04-08 19:32 UTC (permalink / raw)
  To: util-linux; +Cc: kerolasa

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
---
 disk-utils/Makemodule.am |  1 +
 disk-utils/fsck.cramfs.8 | 57 ++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 58 insertions(+)
 create mode 100644 disk-utils/fsck.cramfs.8

diff --git a/disk-utils/Makemodule.am b/disk-utils/Makemodule.am
index 70b058b..22d066b 100644
--- a/disk-utils/Makemodule.am
+++ b/disk-utils/Makemodule.am
@@ -92,6 +92,7 @@ cramfs_common_sources = disk-utils/cramfs.h disk-utils/cramfs_common.c
 sbin_PROGRAMS += fsck.cramfs
 fsck_cramfs_SOURCES = disk-utils/fsck.cramfs.c $(cramfs_common_sources)
 fsck_cramfs_LDADD = $(LDADD) -lz libcommon.la
+dist_man_MANS += disk-utils/fsck.cramfs.8
 
 sbin_PROGRAMS += mkfs.cramfs
 mkfs_cramfs_SOURCES = disk-utils/mkfs.cramfs.c $(cramfs_common_sources)
diff --git a/disk-utils/fsck.cramfs.8 b/disk-utils/fsck.cramfs.8
new file mode 100644
index 0000000..5519cbc
--- /dev/null
+++ b/disk-utils/fsck.cramfs.8
@@ -0,0 +1,57 @@
+.TH EXAMPLE "8" "April 2013" "util-linux" "System Administration"
+.SH NAME
+fsck.cramfs \- fsck compressed ROM file system
+.SH SYNOPSIS
+.B mkfs.cramfs
+[options]
+.I file
+.SH DESCRIPTION
+.I mkfs.cramfs
+is used to check the cramfs file system.
+.SH OPTIONS
+.TP
+\fB\-v\fR, \fB\-\-verbose\fR
+Enable verbose messaging.
+.TP
+\fB\-x\fR, \fB\-\-destination\fR [\fIdirectory\fR]
+Extract contents of the
+.I file
+to
+.IR directory .
+.TP
+\fB\-a\fR
+This option is silently ignored.
+.TP
+\fB\-y\fR
+This option is silently ignored.
+.TP
+\fB\-V\fR, \fB\-\-version\fR
+Display version information and exit.
+.TP
+\fB\-h\fR, \fB\-\-help\fR
+Display help and exit.
+.SH "EXIT STATUS"
+.RS
+.PD 0
+.TP
+.B 0
+success
+.TP
+.B 4
+file system was left uncorrected
+.TP
+.B 8
+operation error, such as unable to allocate memory
+.TP
+.B 16
+usage information was printed
+.PD
+.RE
+.SH "SEE ALSO"
+.BR mount (8),
+.BR fsck.cramfs (8)
+.SH AVAILABILITY
+The example command is part of the util-linux package and is available from
+.UR ftp://\:ftp.kernel.org\:/pub\:/linux\:/utils\:/util-linux/
+Linux Kernel Archive
+.UE .
-- 
1.8.2.1


^ permalink raw reply related	[flat|nested] 16+ messages in thread

* Re: [PATCH 00/14] [pull] smatch scan, and manual tooling
  2013-04-08 19:32 [PATCH 00/14] [pull] smatch scan, and manual tooling Sami Kerola
                   ` (13 preceding siblings ...)
  2013-04-08 19:32 ` [PATCH 14/14] docs: add fsck.cramfs " Sami Kerola
@ 2013-04-09 10:30 ` Karel Zak
  14 siblings, 0 replies; 16+ messages in thread
From: Karel Zak @ 2013-04-09 10:30 UTC (permalink / raw)
  To: Sami Kerola; +Cc: util-linux

On Mon, Apr 08, 2013 at 08:32:45PM +0100, Sami Kerola wrote:
> Sami Kerola (14):

 All applied, thanks.

>       setarch: clean up usage()
>       bash-completion: setarch: use correct list for architectures
>       bash-completion: swapon: add options and fix argument
>       various: fix variable and function declarations [smatch scan]
>       various: fix shadow declarations [smatch scan]
>       libmount, col: remove redundant null checks [smatch scan]
>       libblkid: number of functions should not be declared extern [smatch scan]
>       tools: add checks to manual page test script
>       docs: mount.8: make propagation flags adjustable [checkmans.sh]
>       docs: col.1: fix manual page name section [checkmans.sh]
>       docs: remove repeated words [checkmans.sh]
>       tools: make checkmans.sh to find missing manuals

>       docs: add mkfs.cramfs manual page
>       docs: add fsck.cramfs manual page

 extra thanks for the new man pages!

    Karel

-- 
 Karel Zak  <kzak@redhat.com>
 http://karelzak.blogspot.com

^ permalink raw reply	[flat|nested] 16+ messages in thread

end of thread, other threads:[~2013-04-09 10:45 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-04-08 19:32 [PATCH 00/14] [pull] smatch scan, and manual tooling Sami Kerola
2013-04-08 19:32 ` [PATCH 01/14] setarch: clean up usage() Sami Kerola
2013-04-08 19:32 ` [PATCH 02/14] bash-completion: setarch: use correct list for architectures Sami Kerola
2013-04-08 19:32 ` [PATCH 03/14] bash-completion: swapon: add options and fix argument Sami Kerola
2013-04-08 19:32 ` [PATCH 04/14] various: fix variable and function declarations [smatch scan] Sami Kerola
2013-04-08 19:32 ` [PATCH 05/14] various: fix shadow " Sami Kerola
2013-04-08 19:32 ` [PATCH 06/14] libmount, col: remove redundant null checks " Sami Kerola
2013-04-08 19:32 ` [PATCH 07/14] libblkid: number of functions should not be declared extern " Sami Kerola
2013-04-08 19:32 ` [PATCH 08/14] tools: add checks to manual page test script Sami Kerola
2013-04-08 19:32 ` [PATCH 09/14] docs: mount.8: make propagation flags adjustable [checkmans.sh] Sami Kerola
2013-04-08 19:32 ` [PATCH 10/14] docs: col.1: fix manual page name section [checkmans.sh] Sami Kerola
2013-04-08 19:32 ` [PATCH 11/14] docs: remove repeated words [checkmans.sh] Sami Kerola
2013-04-08 19:32 ` [PATCH 12/14] tools: make checkmans.sh to find missing manuals Sami Kerola
2013-04-08 19:32 ` [PATCH 13/14] docs: add mkfs.cramfs manual page Sami Kerola
2013-04-08 19:32 ` [PATCH 14/14] docs: add fsck.cramfs " Sami Kerola
2013-04-09 10:30 ` [PATCH 00/14] [pull] smatch scan, and manual tooling Karel Zak

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox