smatch scan, and manual tooling
Subsystems (2)
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
PATCH 1/14 setarch: clean up usage()
References: http://marc.info/?l=util-linux-ng&m=136516351523680&w=2
--- sys-utils/setarch.c | 44 +++++++++++++++++++++----------------------- 1 file changed, 21 insertions(+), 23 deletions(-)
sys-utils/setarch.c +21 -23
@@ -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 );
Signature · 1 line
1.8.2.1
PATCH 2/14 bash-completion: setarch: use correct list for architectures
In reply to Sami Kerola--- bash-completion/setarch | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-)
bash-completion/setarch +1 -8
@@ -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
Signature · 1 line
1.8.2.1
PATCH 3/14 bash-completion: swapon: add options and fix argument
In reply to Sami KerolaThe 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.
References: http://marc.info/?l=util-linux-ng&m=136517310727426&w=2
--- bash-completion/swapon | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-)
bash-completion/swapon +15 -4
@@ -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
Signature · 1 line
1.8.2.1
PATCH 4/14 various: fix variable and function declarations [smatch scan]
In reply to Sami Keroladisk-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
--- 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(-)
disk-utils/fsck.minix.c +2 -1
@@ -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" ));
fdisks/sfdisk.c +4 -4
@@ -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, §or_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));
lib/mbsalign.c +2 -2
@@ -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); }
libblkid/src/devname.c +3 -3
@@ -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 ;
libfdisk/src/alignment.c +3 -2
@@ -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 ();
term-utils/wall.c +5 -5
@@ -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' :
text-utils/col.c +2 -2
@@ -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;
text-utils/rev.c +6 -6
@@ -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' :
text-utils/tailf.c +5 -5
@@ -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 ;
Signature · 1 line
1.8.2.1
PATCH 5/14 various: fix shadow declarations [smatch scan]
In reply to Sami Kerolalibmount/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
--- fdisks/fdiskdoslabel.c | 38 +++++++++++++++++++------------------- libmount/src/tab.c | 8 ++++---- misc-utils/findmnt.c | 6 +++--- 3 files changed, 26 insertions(+), 26 deletions(-)
fdisks/fdiskdoslabel.c +19 -19
@@ -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
libmount/src/tab.c +4 -4
@@ -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)
misc-utils/findmnt.c +3 -3
@@ -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 ; }
Signature · 1 line
1.8.2.1
PATCH 6/14 libmount, col: remove redundant null checks [smatch scan]
In reply to Sami Kerolalibmount/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()
--- libmount/src/context_umount.c | 6 ++---- text-utils/col.c | 3 +-- 2 files changed, 3 insertions(+), 6 deletions(-)
libmount/src/context_umount.c +2 -4
@@ -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; }
text-utils/col.c +1 -2
@@ -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)
Signature · 1 line
1.8.2.1
PATCH 7/14 libblkid: number of functions should not be declared extern [smatch scan]
In reply to Sami KerolaThese 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
--- libblkid/src/dev.c | 10 +++++----- libblkid/src/tag.c | 10 +++++----- 2 files changed, 10 insertions(+), 10 deletions(-)
libblkid/src/dev.c +5 -5
@@ -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 ;
libblkid/src/tag.c +5 -5
@@ -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) {
Signature · 1 line
1.8.2.1
PATCH 8/14 tools: add checks to manual page test script
In reply to Sami KerolaThis 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.
--- tools/checkmans.sh | 98 +++++++++++++++++++++++++++++++++++++++++------------- 1 file changed, 74 insertions(+), 24 deletions(-)
tools/checkmans.sh +74 -24
@@ -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
Signature · 1 line
1.8.2.1
PATCH 9/14 docs: mount.8: make propagation flags adjustable [checkmans.sh]
In reply to Sami Kerola--- sys-utils/mount.8 | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-)
sys-utils/mount.8 +8 -1
@@ -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
Signature · 1 line
1.8.2.1
PATCH 10/14 docs: col.1: fix manual page name section [checkmans.sh]
In reply to Sami Kerola$ lexgrog text-utils/col.1 text-utils/col.1: parse failed
--- text-utils/col.1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
text-utils/col.1 +1 -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
Signature · 1 line
1.8.2.1
PATCH 11/14 docs: remove repeated words [checkmans.sh]
In reply to Sami Kerola--- disk-utils/elvtune.8 | 2 +- libuuid/man/uuid_generate.3 | 2 +- sys-utils/cytune.8 | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-)
disk-utils/elvtune.8 +1 -1
@@ -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
libuuid/man/uuid_generate.3 +1 -1
@@ -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
sys-utils/cytune.8 +1 -1
@@ -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
Signature · 1 line
1.8.2.1
PATCH 12/14 tools: make checkmans.sh to find missing manuals
In reply to Sami KerolaFinding missing manuals is loosely based on ideas in man-page-day-1.sh, wrote by Peter Schiffer.
--- tools/checkmans.sh | 44 ++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 40 insertions(+), 4 deletions(-)
tools/checkmans.sh +40 -4
@@ -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
Signature · 1 line
1.8.2.1
PATCH 13/14 docs: add mkfs.cramfs manual page
In reply to Sami Kerola--- disk-utils/Makemodule.am | 1 + disk-utils/mkfs.cramfs.8 | 90 ++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 91 insertions(+) create mode 100644 disk-utils/mkfs.cramfs.8
disk-utils/Makemodule.am +1 -0
@@ -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)
disk-utils/mkfs.cramfs.8 new file +90 -0
90 lines not on this page · raw message
Signature · 1 line
1.8.2.1
PATCH 14/14 docs: add fsck.cramfs manual page
In reply to Sami Kerola--- disk-utils/Makemodule.am | 1 + disk-utils/fsck.cramfs.8 | 57 ++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 58 insertions(+) create mode 100644 disk-utils/fsck.cramfs.8
disk-utils/Makemodule.am +1 -0
@@ -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)
disk-utils/fsck.cramfs.8 new file +57 -0
57 lines not on this page · raw message
Signature · 1 line
1.8.2.1
Karel Zak
maintainerQuoted 1 line · Sami Kerola
Sami Kerola (14):
All applied, thanks.
Quoted 13 lines
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: makecheckmans.shto find missing manuals
Quoted 2 lines
docs: add mkfs.cramfs manual page
docs: add fsck.cramfs manual page
extra thanks for the new man pages!
Karel
Signature · 2 lines
Karel Zak <[email protected]> http://karelzak.blogspot.com