Util-Linux package development
 help / color / mirror / Atom feed
* [PATCH 6/6] sfdisk: fix for data type mismatches
From: Sami Kerola @ 2011-06-06 19:07 UTC (permalink / raw)
  To: util-linux; +Cc: kerolasa
In-Reply-To: <1307387239-9022-1-git-send-email-kerolasa@iki.fi>

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
---
 fdisk/sfdisk.c |   12 ++++++------
 1 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/fdisk/sfdisk.c b/fdisk/sfdisk.c
index afecb93..d761032 100644
--- a/fdisk/sfdisk.c
+++ b/fdisk/sfdisk.c
@@ -1409,7 +1409,7 @@ extended_partition(char *dev, int fd, struct part_desc *ep, struct disk_desc *z)
 
 	cp = s->data + 0x1be;
 
-	if (pno+4 >= ARRAY_SIZE(z->partitions)) {
+	if ((unsigned long) pno+4 >= ARRAY_SIZE(z->partitions)) {
 	    do_warn(_("too many partitions - ignoring those past nr (%d)\n"),
 		   pno-1);
 	    break;
@@ -1486,7 +1486,7 @@ bsd_partition(char *dev, int fd, struct part_desc *ep, struct disk_desc *z) {
 
 	bp = bp0 = &l->d_partitions[0];
 	while (bp - bp0 < BSD_MAXPARTITIONS && bp - bp0 < l->d_npartitions) {
-		if (pno+1 >= ARRAY_SIZE(z->partitions)) {
+		if ((unsigned long) pno+1 >= ARRAY_SIZE(z->partitions)) {
 			do_warn(_("too many partitions - ignoring those "
 			       "past nr (%d)\n"), pno-1);
 			break;
@@ -1762,7 +1762,7 @@ read_stdin(char **fields, char *line, int fieldssize, int linesize) {
 	      ip++;
 	    if (*ip == 0)
 	      return fno;
-	    for(d = dumpflds; d-dumpflds < ARRAY_SIZE(dumpflds); d++) {
+	    for(d = dumpflds; d-dumpflds < (long) ARRAY_SIZE(dumpflds); d++) {
 		if (!strncmp(ip, d->fldname, strlen(d->fldname))) {
 		    ip += strlen(d->fldname);
 		    while(isspace(*ip))
@@ -1957,7 +1957,7 @@ compute_start_sect(struct part_desc *p, struct part_desc *ep) {
 	p->size += delta;
 	if (is_extended(p->p.sys_type) && boxes == ONESECTOR)
 	  p->size = inc;
-	else if (old_size <= -delta) {
+	else if ((ssize_t) old_size <= (ssize_t) -delta) {
 	    my_warn(_("no room for partition descriptor\n"));
 	    return 0;
 	}
@@ -2256,7 +2256,7 @@ read_partition_chain(char *dev, int interactive, struct part_desc *ep,
     eob = 0;
     while (1) {
 	base = z->partno;
-	if (base+4 > ARRAY_SIZE(z->partitions)) {
+	if ((unsigned long) base+4 > ARRAY_SIZE(z->partitions)) {
 	    do_warn(_("too many partitions\n"));
 	    break;
 	}
@@ -2285,7 +2285,7 @@ read_input(char *dev, int interactive, struct disk_desc *z) {
     int i;
     struct part_desc *partitions = &(z->partitions[0]), *ep;
 
-    for (i=0; i < ARRAY_SIZE(z->partitions); i++)
+    for (i=0; (unsigned long) i < ARRAY_SIZE(z->partitions); i++)
       partitions[i] = zero_part_desc;
     z->partno = 0;
 
-- 
1.7.5.2


^ permalink raw reply related

* [PATCH 5/6] sfdisk: fix implicit overflow
From: Sami Kerola @ 2011-06-06 19:07 UTC (permalink / raw)
  To: util-linux; +Cc: kerolasa
In-Reply-To: <1307387239-9022-1-git-send-email-kerolasa@iki.fi>

sfdisk.c:1650:6: warning: overflow in implicit constant conversion [-Woverflow]

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
---
 fdisk/sfdisk.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/fdisk/sfdisk.c b/fdisk/sfdisk.c
index d4dbcca..afecb93 100644
--- a/fdisk/sfdisk.c
+++ b/fdisk/sfdisk.c
@@ -1647,7 +1647,7 @@ write_partitions(char *dev, int fd, struct disk_desc *z) {
 	if (p->ptype == DOS_TYPE) {
 	    copy_from_part(&(p->p), s->data + p->offset);
 	    s->data[510] = 0x55;
-	    s->data[511] = 0xaa;
+	    s->data[511] = (unsigned char) 0xaa;
 	}
     }
     if (save_sector_file) {
-- 
1.7.5.2


^ permalink raw reply related

* [PATCH 4/6] docs: sfdisk manual update
From: Sami Kerola @ 2011-06-06 19:07 UTC (permalink / raw)
  To: util-linux; +Cc: kerolasa
In-Reply-To: <1307387239-9022-1-git-send-email-kerolasa@iki.fi>

Add to manual page previously unmentioned options and few missing
long options.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
---
 fdisk/sfdisk.8 |   53 ++++++++++++++++++++++++++++++++++++++++++-----------
 1 files changed, 42 insertions(+), 11 deletions(-)

diff --git a/fdisk/sfdisk.8 b/fdisk/sfdisk.8
index f6e98c1..c3f06b3 100644
--- a/fdisk/sfdisk.8
+++ b/fdisk/sfdisk.8
@@ -165,7 +165,7 @@ Print version number of
 .B sfdisk
 and exit immediately.
 .TP
-.BR \-? " or " \-\-help
+.BR \-h " or " \-\-help
 Print a usage message and exit immediately.
 .TP
 .BR \-T " or " \-\-list\-types
@@ -184,7 +184,7 @@ the partition table.
 .BR \-l " or " \-\-list
 List the partitions of a device.
 .TP
-.BR \-d
+.BR \-d " or " \-\-dump
 Dump the partitions of a device in a format useful as input
 to sfdisk. For example,
 .br
@@ -218,7 +218,7 @@ and change nothing else. (Probably this fifth partition
 is called /dev/hdb5, but you are free to call it something else,
 like `/my_equipment/disks/2/5' or so).
 .TP
-.BI \-A " number"
+.BI \-A " or " \-\-activate " number"
 Make the indicated partition(s) active, and all others inactive.
 .TP
 .BI \-c "\fR or " \-\-id " number [Id]"
@@ -238,22 +238,22 @@ For example:
 .fi
 first reports that /dev/hdb5 has Id 6, and then changes that into 83.
 .TP
-.BR \-uS " or " \-uB " or " \-uC " or " \-uM
-Accept or report in units of sectors (blocks, cylinders, megabytes,
-respectively). The default is cylinders, at least when the geometry
-is known.
+.BR \-u " or " \-\-unit " SBCM"
+Accept as input, or when reporting show, in units of Sectors
+(Blocks, Cylinders, Megabytes, respectively). The default is
+cylinders, at least when the geometry is known.
 .TP
 .BR \-x " or " \-\-show\-extended
 Also list non-primary extended partitions on output,
 and expect descriptors for them on input.
 .TP
-.BI \-C " cylinders"
+.BI \-C " or " \-\-cylinders " cylinders"
 Specify the number of cylinders, possibly overriding what the kernel thinks.
 .TP
-.BI \-H " heads"
+.BI \-H " or " \-\-heads " heads"
 Specify the number of heads, possibly overriding what the kernel thinks.
 .TP
-.BI \-S " sectors"
+.BI \-S " or " \-\-sectors " sectors"
 Specify the number of sectors, possibly overriding what the kernel thinks.
 .TP
 .BR \-f " or " \-\-force
@@ -301,7 +301,7 @@ Sometimes the last cylinder contains a bad sector table.
 .B \-n
 Go through all the motions, but do not actually write to disk.
 .TP
-.B \-R
+.B \-R " or " \-\-re-read
 Only execute the BLKRRPART ioctl (to make the kernel re-read
 the partition table). This can be useful for checking in advance
 that the final BLKRRPART will be successful, and also when you
@@ -316,6 +316,33 @@ is not mounted, or in use as a swap device, and refuses to continue
 if it is. This option suppresses the test. (On the other hand, the \-f
 option would force sfdisk to continue even when this test fails.)
 .TP
+.B \-\-in\-order
+Caution, see warning section. To be documented.
+.TP
+.B \-\-not\-in\-order
+Caution, see warning section. To be documented.
+.TP
+.B \-\-inside\-order
+Caution, see warning section. Chaining order.
+.TP
+.B \-\-not\-inside\-order
+Caution, see warning section. Chaining order.
+.TP
+.B \-\-nested
+Caution, see warning section. Every partition is contained in the
+surrounding partitions and is disjoint from all others.
+.TP
+.B \-\-chained
+Caution, see warning section. Every data partition is contained in
+the surrounding partitions and disjoint from all others, but
+extended partitions may lie outside (insofar as allowed by
+all_logicals_inside_outermost_extended).
+.TP
+.B \-\-onesector
+Caution, see warning section. All data partitions are mutually
+disjoint; extended partitions each use one sector only (except
+perhaps for the outermost one).
+.TP
 .BI \-O " file"
 Just before writing the new partition, output the sectors
 that are going to be overwritten to
@@ -479,7 +506,11 @@ and terminate with end-of-file (^D).
 .B sfdisk
 will assume that your input line represents the first of four,
 that the second one is extended, and the 3rd and 4th are empty.)
+.SH "CAUTION WARNIGNS"
 
+The options marked with caution in the manual page are dangerous.
+For example all functionality is not completely implemented,
+which can be a reason for unexpected results.
 .SH "DOS 6.x WARNING"
 
 The DOS 6.x FORMAT command looks for some information in the first
-- 
1.7.5.2


^ permalink raw reply related

* [PATCH 3/6] sfdisk: previously undocumented options to usage
From: Sami Kerola @ 2011-06-06 19:07 UTC (permalink / raw)
  To: util-linux; +Cc: kerolasa
In-Reply-To: <1307387239-9022-1-git-send-email-kerolasa@iki.fi>

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
---
 fdisk/sfdisk.c |   71 +++++++++++++++++++++++++++++++++++++++----------------
 1 files changed, 50 insertions(+), 21 deletions(-)

diff --git a/fdisk/sfdisk.c b/fdisk/sfdisk.c
index 1b35f66..d4dbcca 100644
--- a/fdisk/sfdisk.c
+++ b/fdisk/sfdisk.c
@@ -2319,26 +2319,43 @@ static void usage(FILE * out)
 	fprintf(out, _("\nOptions:\n"
 		       "  -s, --show-size         list size of a partition\n"
 		       "  -c, --id                change or print partition Id\n"
+		       "      --change-id         change Id\n"
+		       "      --print-id          print Id\n"
 		       "  -l, --list              list partitions of each device\n"
 		       "  -d, --dump              idem, but in a format suitable for later input\n"
 		       "  -i, --increment         number cylinders etc. from 1 instead of from 0\n"
 		       "  -u, --unit=[SBCM]       units in sectors, blocks, cylinders or MB\n"
+		       "  -1, --one-only          reserved option that does nothing currently\n"
 		       "  -T, --list-types        list the known partition types\n"
 		       "  -D, --DOS               for DOS-compatibility: waste a little space\n"
+		       "  -E, --DOS-extended      DOS extended partition compatibility\n"
 		       "  -R, --re-read           make kernel reread partition table\n"
 		       "  -N=NUM                  change only the partition with number NUM\n"
 		       "  -n                      do not actually write to disk\n"
 		       "  -O FILE                 save the sectors that will be overwritten to file\n"
 		       "  -I FILE                 restore sectors from file\n"
+		       "  -V, --verify            check that listed partition is reasonable\n"
 		       "  -v, --version           print version\n"
 		       "  -h, --help              print this message\n"));
 
 	fprintf(out, _("\nDangerous options:\n"
 		       "  -f, --force             disable all consistency checking\n"
 		       "  -g, --show-geometry     print the kernel's idea of the geometry\n"
+		       "  -A, --activate[=device] activate bootable flag\n"
 		       "  -G, --show-pt-geometry  print geometry guessed from the partition table\n"
+		       "  -U, --unhide[=device]   set partition unhidden\n"
+		       "      --no-reread         skip partition re-read at boot\n"
 		       "  -x, --show-extended     also list extended partitions on output\n"
 		       "                          or expect descriptors for them on input\n"
+		       "      --leave-last        do not allocate the last cylinder\n"
+		       "      --IBM               same as --leave-last\n"
+		       "      --in-order          partitions are in order\n"
+		       "      --not-in-order      partitions are not in order\n"
+		       "      --inside-order      all logicals inside outermost extended\n"
+		       "      --not-inside-order  not all logicals inside outermost extended\n"
+		       "      --nested            every partition is disjoint from all others\n"
+		       "      --chained           like nested, but extended partitions may lie outside\n"
+		       "      --onesector         partitions are mutually disjoint\n"
 		       "  -L, --Linux             do not complain about things irrelevant for Linux\n"
 		       "  -q, --quiet             suppress warning messages\n"
 		       "\n  Override the detected geometry using:\n"
@@ -2369,6 +2386,18 @@ static const char short_opts[] = "cdfghilnqsu:vx1A::C:DGH:I:LN:O:RS:TU::V";
 #define PRINT_ID 0400
 #define CHANGE_ID 01000
 
+enum {
+    OPT_NO_REREAD = CHAR_MAX + 1,
+    OPT_LEAVE_LAST,
+    OPT_IN_ORDER,
+    OPT_NOT_IN_ORDER,
+    OPT_INSIDE_OUTER,
+    OPT_NOT_INSIDE_OUTER,
+    OPT_NESTED,
+    OPT_CHAINED,
+    OPT_ONESECTOR
+};
+
 static const struct option long_opts[] = {
     { "change-id",	  no_argument, NULL, 'c' + CHANGE_ID },
     { "print-id",	  no_argument, NULL, 'c' + PRINT_ID },
@@ -2396,17 +2425,17 @@ static const struct option long_opts[] = {
     { "re-read",          no_argument, NULL, 'R' },
     { "list-types",       no_argument, NULL, 'T' },
     { "unhide",     optional_argument, NULL, 'U' },
-    { "no-reread",        no_argument, NULL, 160 },
-    { "IBM",              no_argument, NULL, 161 },
-    { "leave-last",       no_argument, NULL, 161 },
-/* undocumented flags - not all completely implemented */
-    { "in-order",         no_argument, NULL, 128 },
-    { "not-in-order",     no_argument, NULL, 129 },
-    { "inside-outer",     no_argument, NULL, 130 },
-    { "not-inside-outer", no_argument, NULL, 131 },
-    { "nested",           no_argument, NULL, 132 },
-    { "chained",          no_argument, NULL, 133 },
-    { "onesector",        no_argument, NULL, 134 },
+    { "no-reread",        no_argument, NULL, OPT_NO_REREAD },
+    { "IBM",              no_argument, NULL, OPT_LEAVE_LAST },
+    { "leave-last",       no_argument, NULL, OPT_LEAVE_LAST },
+/* dangerous flags - not all completely implemented */
+    { "in-order",         no_argument, NULL, OPT_IN_ORDER },
+    { "not-in-order",     no_argument, NULL, OPT_NOT_IN_ORDER },
+    { "inside-outer",     no_argument, NULL, OPT_INSIDE_OUTER },
+    { "not-inside-outer", no_argument, NULL, OPT_NOT_INSIDE_OUTER },
+    { "nested",           no_argument, NULL, OPT_NESTED },
+    { "chained",          no_argument, NULL, OPT_CHAINED },
+    { "onesector",        no_argument, NULL, OPT_ONESECTOR },
     { NULL, 0, NULL, 0 }
 };
 
@@ -2598,26 +2627,26 @@ main(int argc, char **argv) {
 	  default:
 	    usage(stderr); break;
 
-	  /* undocumented flags */
-	  case 128:
+	  /* dangerous flags */
+	  case OPT_IN_ORDER:
 	    partitions_in_order = 1; break;
-	  case 129:
+	  case OPT_NOT_IN_ORDER:
 	    partitions_in_order = 0; break;
-	  case 130:
+	  case OPT_INSIDE_OUTER:
 	    all_logicals_inside_outermost_extended = 1; break;
-	  case 131:
+	  case OPT_NOT_INSIDE_OUTER:
 	    all_logicals_inside_outermost_extended = 0; break;
-	  case 132:
+	  case OPT_NESTED:
 	    boxes = NESTED; break;
-	  case 133:
+	  case OPT_CHAINED:
 	    boxes = CHAINED; break;
-	  case 134:
+	  case OPT_ONESECTOR:
 	    boxes = ONESECTOR; break;
 
 	  /* more flags */
-	  case 160:
+	  case OPT_NO_REREAD:
 	    no_reread = 1; break;
-	  case 161:
+	  case OPT_LEAVE_LAST:
 	    leave_last = 1; break;
 	}
     }
-- 
1.7.5.2


^ permalink raw reply related

* [PATCH 2/6] sfdisk: help screen format
From: Sami Kerola @ 2011-06-06 19:07 UTC (permalink / raw)
  To: util-linux; +Cc: kerolasa
In-Reply-To: <1307387239-9022-1-git-send-email-kerolasa@iki.fi>

Readability improvement by making the help screen to look like
majority of command line utilities.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
---
 fdisk/sfdisk.c |   93 +++++++++++++++++++++++++++++---------------------------
 1 files changed, 48 insertions(+), 45 deletions(-)

diff --git a/fdisk/sfdisk.c b/fdisk/sfdisk.c
index 8d8ccea..1b35f66 100644
--- a/fdisk/sfdisk.c
+++ b/fdisk/sfdisk.c
@@ -2308,47 +2308,47 @@ read_input(char *dev, int interactive, struct disk_desc *z) {
 /*
  *  G. The command line
  */
+static void usage(FILE * out)
+{
 
-static void version(void) {
-    printf("sfdisk (%s)\n", PACKAGE_STRING);
+	fprintf(out, _("\nUsage:\n"
+		       "  %s [options] device [...]\n"),
+		program_invocation_short_name);
+	fprintf(out, _("Device is something like /dev/hda or /dev/sda\n"));
+
+	fprintf(out, _("\nOptions:\n"
+		       "  -s, --show-size         list size of a partition\n"
+		       "  -c, --id                change or print partition Id\n"
+		       "  -l, --list              list partitions of each device\n"
+		       "  -d, --dump              idem, but in a format suitable for later input\n"
+		       "  -i, --increment         number cylinders etc. from 1 instead of from 0\n"
+		       "  -u, --unit=[SBCM]       units in sectors, blocks, cylinders or MB\n"
+		       "  -T, --list-types        list the known partition types\n"
+		       "  -D, --DOS               for DOS-compatibility: waste a little space\n"
+		       "  -R, --re-read           make kernel reread partition table\n"
+		       "  -N=NUM                  change only the partition with number NUM\n"
+		       "  -n                      do not actually write to disk\n"
+		       "  -O FILE                 save the sectors that will be overwritten to file\n"
+		       "  -I FILE                 restore sectors from file\n"
+		       "  -v, --version           print version\n"
+		       "  -h, --help              print this message\n"));
+
+	fprintf(out, _("\nDangerous options:\n"
+		       "  -f, --force             disable all consistency checking\n"
+		       "  -g, --show-geometry     print the kernel's idea of the geometry\n"
+		       "  -G, --show-pt-geometry  print geometry guessed from the partition table\n"
+		       "  -x, --show-extended     also list extended partitions on output\n"
+		       "                          or expect descriptors for them on input\n"
+		       "  -L, --Linux             do not complain about things irrelevant for Linux\n"
+		       "  -q, --quiet             suppress warning messages\n"
+		       "\n  Override the detected geometry using:\n"
+		       "  -C, --cylinders=NUM     set the number of cylinders to use\n"
+		       "  -H, --heads=NUM         set the number of heads to use\n"
+		       "  -S, --sectors=NUM       set the number of sectors to use\n\n"));
+
+	exit(out == stderr ? EXIT_FAILURE : EXIT_SUCCESS);
 }
 
-static void
-usage(void) {
-    version();
-    printf(_("Usage: %s [options] device ...\n"), PROGNAME);
-    puts (_("device: something like /dev/hda or /dev/sda"));
-    puts (_("useful options:"));
-    puts (_("    -s [or --show-size]: list size of a partition"));
-    puts (_("    -c [or --id]:        print or change partition Id"));
-    puts (_("    -l [or --list]:      list partitions of each device"));
-    puts (_("    -d [or --dump]:      idem, but in a format suitable for later input"));
-    puts (_("    -i [or --increment]: number cylinders etc. from 1 instead of from 0"));
-    puts (_("    -uS, -uB, -uC, -uM:  accept/report in units of sectors/blocks/cylinders/MB"));
-    puts (_("    -T [or --list-types]:list the known partition types"));
-    puts (_("    -D [or --DOS]:       for DOS-compatibility: waste a little space"));
-    puts (_("    -R [or --re-read]:   make kernel reread partition table"));
-    puts (_("    -N# :                change only the partition with number #"));
-    puts (_("    -n :                 do not actually write to disk"));
-    puts (_("    -O file :            save the sectors that will be overwritten to file"));
-    puts (_("    -I file :            restore these sectors again"));
-    puts (_("    -v [or --version]:   print version"));
-    puts (_("    -? [or --help]:      print this message"));
-    puts (_("dangerous options:"));
-    puts (_("    -g [or --show-geometry]: print the kernel's idea of the geometry"));
-    puts (_("    -G [or --show-pt-geometry]: print geometry guessed from the partition table"));
-    puts (_("    -x [or --show-extended]: also list extended partitions on output\n"
-          "                             or expect descriptors for them on input"));
-    puts (_("    -L  [or --Linux]:      do not complain about things irrelevant for Linux"));
-    puts (_("    -q  [or --quiet]:      suppress warning messages"));
-    puts (_("    You can override the detected geometry using:"));
-    puts (_("    -C# [or --cylinders #]:set the number of cylinders to use"));
-    puts (_("    -H# [or --heads #]:    set the number of heads to use"));
-    puts (_("    -S# [or --sectors #]:  set the number of sectors to use"));
-    puts (_("You can disable all consistency checking with:"));
-    puts (_("    -f  [or --force]:      do what I say, even if it is stupid"));
-    exit(1);
-}
 
 static void
 activate_usage(char *progn) {
@@ -2364,7 +2364,7 @@ unhide_usage(char *progn __attribute__ ((__unused__))) {
     exit(1);
 }
 
-static char short_opts[] = "cdfgilnqsu:vx?1A::C:DGH:I:LN:O:RS:TU::V";
+static const char short_opts[] = "cdfghilnqsu:vx1A::C:DGH:I:LN:O:RS:TU::V";
 
 #define PRINT_ID 0400
 #define CHANGE_ID 01000
@@ -2376,6 +2376,7 @@ static const struct option long_opts[] = {
     { "dump",             no_argument, NULL, 'd' },
     { "force",            no_argument, NULL, 'f' },
     { "show-geometry",	  no_argument, NULL, 'g' },
+    { "help",	          no_argument, NULL, 'h' },
     { "increment",        no_argument, NULL, 'i' },
     { "list",             no_argument, NULL, 'l' },
     { "quiet",            no_argument, NULL, 'q' },
@@ -2383,7 +2384,6 @@ static const struct option long_opts[] = {
     { "unit",       required_argument, NULL, 'u' },
     { "version",          no_argument, NULL, 'v' },
     { "show-extended",    no_argument, NULL, 'x' },
-    { "help",	          no_argument, NULL, '?' },
     { "one-only",         no_argument, NULL, '1' },
     { "cylinders",  required_argument, NULL, 'C' },
     { "heads",      required_argument, NULL, 'H' },
@@ -2556,8 +2556,12 @@ main(int argc, char **argv) {
 	  case 'u':
 	    set_format(*optarg); break;
 	  case 'v':
-	    version();
-	    exit(0);
+	    printf(_("%s from %s\n"), program_invocation_short_name,
+	                              PACKAGE_STRING);
+	    return EXIT_SUCCESS;
+	  case 'h':
+	    usage(stdout);
+	    return EXIT_SUCCESS;
 	  case 'x':
 	    show_extended = 1; break;
 	  case 'A':
@@ -2591,9 +2595,8 @@ main(int argc, char **argv) {
 	    unhide = 1; break;
 	  case 'V':
 	    verify = 1; break;
-	  case '?':
 	  default:
-	    usage(); break;
+	    usage(stderr); break;
 
 	  /* undocumented flags */
 	  case 128:
@@ -2659,7 +2662,7 @@ main(int argc, char **argv) {
 	else if (unhide)
 	  unhide_usage(fdisk ? "sfdisk -U" : progn);
 	else
-	  usage();
+	  usage(stderr);
     }
 
     if (opt_list || opt_out_geom || opt_out_pt_geom || opt_size || verify) {
-- 
1.7.5.2


^ permalink raw reply related

* [PATCH 1/6] sfdisk: declare unused function attributes
From: Sami Kerola @ 2011-06-06 19:07 UTC (permalink / raw)
  To: util-linux; +Cc: kerolasa
In-Reply-To: <1307387239-9022-1-git-send-email-kerolasa@iki.fi>

Add `__attribute__ ((__unused__))' where needed.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
---
 fdisk/sfdisk.c |   20 ++++++++++++++++----
 1 files changed, 16 insertions(+), 4 deletions(-)

diff --git a/fdisk/sfdisk.c b/fdisk/sfdisk.c
index c38128a..8d8ccea 100644
--- a/fdisk/sfdisk.c
+++ b/fdisk/sfdisk.c
@@ -1590,17 +1590,29 @@ msdos_partition(char *dev, int fd, unsigned long start, struct disk_desc *z) {
 }
 
 static int
-osf_partition(char *dev, int fd, unsigned long start, struct disk_desc *z) {
+osf_partition(char *dev __attribute__ ((__unused__)),
+	      int fd __attribute__ ((__unused__)),
+	      unsigned long start __attribute__ ((__unused__)),
+	      struct disk_desc *z __attribute__ ((__unused__)))
+{
 	return 0;
 }
 
 static int
-sun_partition(char *dev, int fd, unsigned long start, struct disk_desc *z) {
+sun_partition(char *dev __attribute__ ((__unused__)),
+	      int fd __attribute__ ((__unused__)),
+	      unsigned long start __attribute__ ((__unused__)),
+	      struct disk_desc *z __attribute__ ((__unused__)))
+{
 	return 0;
 }
 
 static int
-amiga_partition(char *dev, int fd, unsigned long start, struct disk_desc *z) {
+amiga_partition(char *dev __attribute__ ((__unused__)),
+		int fd __attribute__ ((__unused__)),
+		unsigned long start __attribute__ ((__unused__)),
+		struct disk_desc *z __attribute__ ((__unused__)))
+{
 	return 0;
 }
 
@@ -2348,7 +2360,7 @@ activate_usage(char *progn) {
 }
 
 static void
-unhide_usage(char *progn) {
+unhide_usage(char *progn __attribute__ ((__unused__))) {
     exit(1);
 }
 
-- 
1.7.5.2


^ permalink raw reply related

* [PATCH 0/6] sfdisk: few maintenance patches
From: Sami Kerola @ 2011-06-06 19:07 UTC (permalink / raw)
  To: util-linux; +Cc: kerolasa

I almost forgot these, mostly uninteresting, sfdisk patches. The
fifth patch is the only one which I'm interested to hear wherther
I got it right, or did I made a mess again. Priority / urgency of
the other patches is in somewhere between trivial and
unnecessary.

Also available from:
'sfdisk' of git://github.com/kerolasa/lelux-utiliteetit.git


^ permalink raw reply

* Re: [PATCH 1/3] minix: add common functionality
From: Davidlohr Bueso @ 2011-06-06 13:52 UTC (permalink / raw)
  To: Karel Zak; +Cc: util-linux
In-Reply-To: <20110602113358.GH25562@nb.net.home>

On Thu, 2011-06-02 at 13:33 +0200, Karel Zak wrote:
> On Wed, Jun 01, 2011 at 06:32:56PM -0400, Davidlohr Bueso wrote:
> > Unite common features and code present in mkfs.minix and fsck.minix
> > into a single minix.h header.
> 
>  All three patches applied, but...
> 
>   CC     fsck.minix.o
> In file included from fsck.minix.c:105:0:
> minix.h: In function ‘inode_blocks’:
> minix.h:126:16: warning: unused variable ‘ret’
> fsck.minix.c: In function ‘map_block2’:
> fsck.minix.c:467:9: warning: array subscript is above array bounds
>   CC     ismounted.o
>   CCLD   fsck.minix
>   CC     mkfs.minix.o
> In file included from mkfs.minix.c:76:0:
> minix.h: In function ‘inode_blocks’:
> minix.h:126:16: warning: unused variable ‘ret’
> 
> 
>  ... I guess you will fix these warnings in some next cleanup patches.
> 

The array subscript warning is old, here's a patch that silences the
unused variable one. I will look into the first shortly.

From: Davidlohr Bueso <dave@gnu.org>
Date: Mon, 6 Jun 2011 09:48:25 -0400
Subject: [PATCH] minix: fix warning

This patch fixes an unused variable warning.

Signed-off-by: Davidlohr Bueso <dave@gnu.org>
---
 disk-utils/minix.h |    2 --
 1 files changed, 0 insertions(+), 2 deletions(-)

diff --git a/disk-utils/minix.h b/disk-utils/minix.h
index 4e670ba..0ebaa26 100644
--- a/disk-utils/minix.h
+++ b/disk-utils/minix.h
@@ -123,8 +123,6 @@ static inline unsigned long get_max_size(void)
 
 static unsigned long inode_blocks(void)
 {
-	unsigned long ret;
-
 	if (fs_version == 2)
 		return UPPER(get_ninodes(), MINIX2_INODES_PER_BLOCK);
 	else
-- 
1.7.4.1




^ permalink raw reply related

* Fwd: [PATCH 00/13]: text-utils fixes
From: Sami Kerola @ 2011-06-05 18:47 UTC (permalink / raw)
  To: util-linux
In-Reply-To: <20110601081046.GE25562@nb.net.home>

On Wed, Jun 1, 2011 at 10:10, Karel Zak <kzak@redhat.com> wrote:
>> All patches are available from github in branch text-utils.
>> git://github.com/kerolasa/lelux-utiliteetit.git
>
>  All applied, except patches 8, 9 and 10.

I took a look of the rejected patches.

[PATCH 08/13] col
> Why we need this magical (INT_MAX / 2) limit?

The col command is counting stuff in half lines i.e. the counts are
double what one would intuitively think. I wrote the code segment
different way, and commented it. Perhaps the lines are more
understandable now.

[PATCH 09/13] colrm
> and
> bindtextdomain(PACKAGE, LOCALEDIR);
> textdomain(PACKAGE);
> right?

Wilco.

I amend the fixes, and pushed with force to repository.

-- 
   Sami Kerola
   http://www.iki.fi/kerolasa/

^ permalink raw reply

* [PATCH] mkfs.minix: use inode wrappers
From: Davidlohr Bueso @ 2011-06-02 23:11 UTC (permalink / raw)
  To: Karel Zak; +Cc: util-linux

From: Davidlohr Bueso <dave@gnu.org>
Date: Thu, 2 Jun 2011 19:08:46 -0400

Use a common function for creating the root and bad inode, without worring about the fs version.

Signed-off-by: Davidlohr Bueso <dave@gnu.org>
---
 disk-utils/mkfs.minix.c |   32 +++++++++++++++++++++-----------
 1 files changed, 21 insertions(+), 11 deletions(-)

diff --git a/disk-utils/mkfs.minix.c b/disk-utils/mkfs.minix.c
index 3de1d66..d2d800f 100644
--- a/disk-utils/mkfs.minix.c
+++ b/disk-utils/mkfs.minix.c
@@ -217,7 +217,7 @@ static inline int next(int zone) {
 	return 0;
 }
 
-static void make_bad_inode(void) {
+static void make_bad_inode_v1(void) {
 	struct minix_inode * inode = &Inode[MINIX_BAD_INO];
 	int i,j,zone;
 	int ind=0,dind=0;
@@ -266,7 +266,7 @@ end_bad:
 		write_block(dind, (char *) dind_block);
 }
 
-static void make_bad_inode2 (void) {
+static void make_bad_inode_v2 (void) {
 	struct minix2_inode *inode = &Inode2[MINIX_BAD_INO];
 	int i, j, zone;
 	int ind = 0, dind = 0;
@@ -314,7 +314,14 @@ static void make_bad_inode2 (void) {
 		write_block (dind, (char *) dind_block);
 }
 
-static void make_root_inode(void) {
+static void make_bad_inode(void)
+{
+	if (fs_version < 2)
+		return make_bad_inode_v1();
+	return make_bad_inode_v2();
+}
+
+static void make_root_inode_v1(void) {
 	struct minix_inode * inode = &Inode[MINIX_ROOT_INO];
 
 	mark_inode(MINIX_ROOT_INO);
@@ -335,7 +342,7 @@ static void make_root_inode(void) {
 	write_block(inode->i_zone[0],root_block);
 }
 
-static void make_root_inode2 (void) {
+static void make_root_inode_v2 (void) {
 	struct minix2_inode *inode = &Inode2[MINIX_ROOT_INO];
 
 	mark_inode (MINIX_ROOT_INO);
@@ -356,6 +363,13 @@ static void make_root_inode2 (void) {
 	write_block (inode->i_zone[0], root_block);
 }
 
+static void make_root_inode(void)
+{
+	if (fs_version < 2)
+		return make_root_inode_v1();
+	return make_root_inode_v2();
+}
+
 static void setup_tables(void) {
 	int i;
 	unsigned long inodes, zmaps, imaps, zones;
@@ -651,13 +665,9 @@ int main(int argc, char ** argv) {
 		check_blocks();
 	else if (listfile)
 		get_list_blocks(listfile);
-	if (fs_version == 2) {
-		make_root_inode2 ();
-		make_bad_inode2 ();
-	} else {
-		make_root_inode();
-		make_bad_inode();
-	}
+
+	make_root_inode();
+	make_bad_inode();
 
 	mark_good_blocks();
 	write_tables();
-- 
1.7.4.1




^ permalink raw reply related

* Re: [PATCH] simpleinit: remove NLS support
From: Francesco Cosoleto @ 2011-06-02 19:33 UTC (permalink / raw)
  To: util-linux
In-Reply-To: <1307042126-7242-1-git-send-email-cosoleto@gmail.com>

There is a little mistake in the commit message, initctl doesn't need changes:

About 50 messages to translate less.

shutdown(1) is deprecated since July 2007, simpleinit(1) is deprecated
since December 2010. They are marked as deprecated why nobody
uses these implementations.

^ permalink raw reply

* [PATCH] fstrim, setarch: replace error() with err()
From: Francesco Cosoleto @ 2011-06-02 19:17 UTC (permalink / raw)
  To: util-linux; +Cc: Francesco Cosoleto

This should improve a bit the portability as error() is a GNU extension and
util-linux provides fallbacks for err.h functions.

Fix compilation with icc, broken due to a reference to `__builtin_va_arg_pack'
in error.h using the -gcc default option.

Signed-off-by: Francesco Cosoleto <cosoleto@gmail.com>
---
 sys-utils/fstrim.c  |   10 +++-------
 sys-utils/setarch.c |   17 ++++++++---------
 2 files changed, 11 insertions(+), 16 deletions(-)

diff --git a/sys-utils/fstrim.c b/sys-utils/fstrim.c
index d4fb0c3..fd113ae 100644
--- a/sys-utils/fstrim.c
+++ b/sys-utils/fstrim.c
@@ -32,8 +32,6 @@
 #include <fcntl.h>
 #include <limits.h>
 #include <getopt.h>
-#include <error.h>
-#include <errno.h>
 
 #include <sys/ioctl.h>
 #include <sys/stat.h>
@@ -141,11 +139,9 @@ int main(int argc, char **argv)
 	if (fd < 0)
 		err(EXIT_FAILURE, _("%s: open failed"), path);
 
-	if (ioctl(fd, FITRIM, &range)) {
-		int errsv = errno;
-		close(fd);
-		error(EXIT_FAILURE, errsv, _("%s: FITRIM ioctl failed"), path);
-	}
+	if (ioctl(fd, FITRIM, &range))
+		err(EXIT_FAILURE, _("%s: FITRIM ioctl failed"), path);
+
 	if (verbose)
 		printf(_("%s: %" PRIu64 " bytes was trimmed\n"),
 						path, range.len);
diff --git a/sys-utils/setarch.c b/sys-utils/setarch.c
index 76f743f..5f187a7 100644
--- a/sys-utils/setarch.c
+++ b/sys-utils/setarch.c
@@ -30,12 +30,11 @@
 #include <stdio.h>
 #include <string.h>
 #include <stdlib.h>
-#include <errno.h>
-#include <error.h>
 #include <getopt.h>
 #include <limits.h>
 #include <sys/utsname.h>
 #include "nls.h"
+#include "c.h"
 
 #define set_pers(pers) ((long)syscall(SYS_personality, pers))
 
@@ -212,7 +211,7 @@ int set_arch(const char *pers, unsigned long options)
 	break;
 
   if(transitions[i].perval < 0)
-    error(EXIT_FAILURE, 0, _("%s: Unrecognized architecture"), pers);
+    errx(EXIT_FAILURE, _("%s: Unrecognized architecture"), pers);
 
   pers_value = transitions[i].perval | options;
   res = set_pers(pers_value);
@@ -228,7 +227,7 @@ int set_arch(const char *pers, unsigned long options)
 	   && strcmp(un.machine, "i586")
 	   && strcmp(un.machine, "i686")
 	   && strcmp(un.machine, "athlon")))
-      error(EXIT_FAILURE, 0, _("%s: Unrecognized architecture"), pers);
+      errx(EXIT_FAILURE, _("%s: Unrecognized architecture"), pers);
   }
 
   return 0;
@@ -262,9 +261,9 @@ int main(int argc, char *argv[])
   #if defined(__sparc64__) || defined(__sparc__)
    if (!strcmp(p, "sparc32bash")) {
        if (set_arch(p, 0L))
-           error(EXIT_FAILURE, errno, _("Failed to set personality to %s"), p);
+           err(EXIT_FAILURE, _("Failed to set personality to %s"), p);
        execl("/bin/bash", NULL);
-       error(EXIT_FAILURE, errno, "/bin/bash");
+       err(EXIT_FAILURE, "/bin/bash");
    }
   #endif
 
@@ -315,14 +314,14 @@ int main(int argc, char *argv[])
   argv += optind;
 
   if (set_arch(p, options))
-    error(EXIT_FAILURE, errno, _("Failed to set personality to %s"), p);
+    err(EXIT_FAILURE, _("Failed to set personality to %s"), p);
 
   if (!argc) {
     execl("/bin/sh", "-sh", NULL);
-    error(EXIT_FAILURE, errno, "/bin/sh");
+    err(EXIT_FAILURE, "/bin/sh");
   }
 
   execvp(argv[0], argv);
-  error(EXIT_FAILURE, errno, "%s", argv[0]);
+  err(EXIT_FAILURE, "%s", argv[0]);
   return EXIT_FAILURE;
 }
-- 
1.7.3.4


^ permalink raw reply related

* [PATCH] simpleinit: remove NLS support
From: Francesco Cosoleto @ 2011-06-02 19:15 UTC (permalink / raw)
  To: util-linux; +Cc: Francesco Cosoleto

About 50 messages to translate less.

shutdown(1) is deprecated since July 2007, simpleinit(1), initctl(1)
are deprecated since December 2010. They are marked as deprecated why
nobody uses these implementations.

Signed-off-by: Francesco Cosoleto <cosoleto@gmail.com>
---
 simpleinit/shutdown.c   |   64 ++++++++++++++++++++++------------------------
 simpleinit/simpleinit.c |   42 ++++++++++++++----------------
 2 files changed, 51 insertions(+), 55 deletions(-)

diff --git a/simpleinit/shutdown.c b/simpleinit/shutdown.c
index 9bb121c..6c6fe52 100644
--- a/simpleinit/shutdown.c
+++ b/simpleinit/shutdown.c
@@ -113,7 +113,7 @@ void
 usage(void)
 {
 	fprintf(stderr,
-		_("Usage: shutdown [-h|-r] [-fqs] [now|hh:ss|+mins]\n"));
+		"Usage: shutdown [-h|-r] [-fqs] [now|hh:ss|+mins]\n");
 	exit(EXIT_FAILURE);
 }
 
@@ -131,7 +131,7 @@ int_handler(int sig)
 {
 	unlink(_PATH_NOLOGIN);
 	signal(SIGINT, SIG_DFL);
-	my_puts(_("Shutdown process aborted"));
+	my_puts("Shutdown process aborted");
 	_exit(EXIT_FAILURE);
 }
 
@@ -157,12 +157,10 @@ main(int argc, char *argv[])
 	for (i = 1; i < NSIG; i++) signal (i, SIG_DFL);
 
         setlocale(LC_ALL, "");
-        bindtextdomain(PACKAGE, LOCALEDIR);
-        textdomain(PACKAGE);
 
 #ifndef DEBUGGING
 	if(setreuid (0, 0))
-		errx(EXIT_FAILURE, _("only root can shut a system down."));
+		errx(EXIT_FAILURE, "only root can shut a system down.");
 #endif
 
 	if(*argv[0] == '-') argv[0]++;	/* allow shutdown as login shell */
@@ -252,8 +250,8 @@ main(int argc, char *argv[])
 			then = 3600 * hour + 60 * minute;
 			timeout = then - now;
 			if(timeout < 0)
-				errx(EXIT_FAILURE, _("that must be tomorrow, "
-					          "can't you wait till then?"));
+				errx(EXIT_FAILURE, "that must be tomorrow, "
+					          "can't you wait till then?");
 		} else {
 			xstrncpy(message, argv[c], sizeof(message));
 			opt_msgset = 1;
@@ -301,7 +299,7 @@ main(int argc, char *argv[])
 		}
 		*ptr = '\0';
 	} else if (!opt_msgset) {
-		strcpy(message, _("for maintenance; bounce, bounce"));
+		strcpy(message, "for maintenance; bounce, bounce");
 	}
 
 #ifdef DEBUGGING
@@ -329,11 +327,11 @@ main(int argc, char *argv[])
 	if((fd = open(_PATH_NOLOGIN, O_WRONLY|O_CREAT, 0644)) >= 0) {
 		/* keep xgettext happy and leave \r\n outside strings */
 		WRCRLF;
-		WR(_("The system is being shut down within 5 minutes"));
+		WR("The system is being shut down within 5 minutes");
 		WRCRLF;
 		write(fd, message, strlen(message));
 		WRCRLF;
-		WR(_("Login is therefore prohibited."));
+		WR("Login is therefore prohibited.");
 		WRCRLF;
 		close(fd);
 	}
@@ -355,10 +353,10 @@ main(int argc, char *argv[])
 	/* do syslog message... */
 	openlog(prog, LOG_CONS, LOG_AUTH);
 	if (opt_reboot)
-		syslog(LOG_NOTICE, _("rebooted by %s: %s"), 
+		syslog(LOG_NOTICE, "rebooted by %s: %s",
 		       whom, message);
 	else
-		syslog(LOG_NOTICE, _("halted by %s: %s"), 
+		syslog(LOG_NOTICE, "halted by %s: %s",
 		       whom, message);
 	closelog();
 
@@ -422,9 +420,9 @@ main(int argc, char *argv[])
 
 	if(opt_reboot) {
 		my_reboot(LINUX_REBOOT_CMD_RESTART); /* RB_AUTOBOOT */
-		my_puts(_("\nWhy am I still alive after reboot?"));
+		my_puts("\nWhy am I still alive after reboot?");
 	} else {
-		my_puts(_("\nNow you can turn off the power..."));
+		my_puts("\nNow you can turn off the power...");
 
 		/* allow C-A-D now, faith@cs.unc.edu, re-fixed 8-Jul-96 */
 		my_reboot(LINUX_REBOOT_CMD_CAD_ON); /* RB_ENABLE_CAD */
@@ -440,10 +438,10 @@ main(int argc, char *argv[])
 void
 do_halt(char *action) {
 	if (strcasecmp (action, "power_off") == 0) {
-		printf(_("Calling kernel power-off facility...\n"));
+		printf("Calling kernel power-off facility...\n");
 		fflush(stdout);
 		my_reboot(LINUX_REBOOT_CMD_POWER_OFF);
-		printf(_("Error powering off\t%s\n"), ERRSTRING);
+		printf("Error powering off\t%s\n", ERRSTRING);
 		fflush(stdout);
 		sleep (2);
 	} else
@@ -451,10 +449,10 @@ do_halt(char *action) {
 	/* This should be improved; e.g. Mike Jagdis wants "/sbin/mdstop -a" */
 	/* Maybe we should also fork and wait */
 	if (action[0] == '/') {
-		printf(_("Executing the program \"%s\" ...\n"), action);
+		printf("Executing the program \"%s\" ...\n", action);
 		fflush(stdout);
 		execl(action, action, NULL);
-		printf(_("Error executing\t%s\n"), ERRSTRING);
+		printf("Error executing\t%s\n", ERRSTRING);
 		fflush(stdout);
 		sleep (2);
 	}
@@ -481,29 +479,29 @@ write_user(struct utmp *ut)
 	        return;
 
 	msg[0] = '\007';	/* gettext crashes on \a */
-	sprintf(msg+1, _("URGENT: broadcast message from %s:"), whom);
+	sprintf(msg+1, "URGENT: broadcast message from %s:", whom);
 	WRCRLF;
 	WR(msg);
 	WRCRLF;
 
 	if (hours > 1)
-		sprintf(msg, _("System going down in %d hours %d minutes"),
+		sprintf(msg, "System going down in %d hours %d minutes",
 			hours, minutes);
 	else if (hours == 1)
-		sprintf(msg, _("System going down in 1 hour %d minutes"),
+		sprintf(msg, "System going down in 1 hour %d minutes",
 			minutes);
 	else if (minutes > 1)
-		sprintf(msg, _("System going down in %d minutes\n"),
+		sprintf(msg, "System going down in %d minutes\n",
 			minutes);
 	else if (minutes == 1)
-		sprintf(msg, _("System going down in 1 minute\n"));
+		sprintf(msg, "System going down in 1 minute\n");
 	else
-		sprintf(msg, _("System going down IMMEDIATELY!\n"));
+		sprintf(msg, "System going down IMMEDIATELY!\n");
 
 	WR(msg);
 	WRCRLF;
 
-	sprintf(msg, _("\t... %s ...\n"), message);
+	sprintf(msg, "\t... %s ...\n", message);
 	WR(msg);
 	WRCRLF;
 
@@ -560,7 +558,7 @@ swap_off(void)
 
 	sync();
 	if ((pid = fork()) < 0) {
-		my_puts(_("Cannot fork for swapoff. Shrug!"));
+		my_puts("Cannot fork for swapoff. Shrug!");
 		return;
 	}
 	if (!pid) {
@@ -568,8 +566,8 @@ swap_off(void)
 		execl("/etc/swapoff", SWAPOFF_ARGS, NULL);
 		execl("/bin/swapoff", SWAPOFF_ARGS, NULL);
 		execlp("swapoff", SWAPOFF_ARGS, NULL);
-		my_puts(_("Cannot exec swapoff, "
-			  "hoping umount will do the trick."));
+		my_puts("Cannot exec swapoff, "
+			  "hoping umount will do the trick.");
 		exit(EXIT_SUCCESS);
 	}
 	while ((result = wait(&status)) != -1 && result != pid)
@@ -587,7 +585,7 @@ unmount_disks(void)
 
 	sync();
 	if ((pid = fork()) < 0) {
-		my_puts(_("Cannot fork for umount, trying manually."));
+		my_puts("Cannot fork for umount, trying manually.");
 		unmount_disks_ourselves();
 		return;
 	}
@@ -596,16 +594,16 @@ unmount_disks(void)
 
 		/* need my_printf instead of my_puts here */
 		freopen(_PATH_CONSOLE, "w", stdout);
-		printf(_("Cannot exec %s, trying umount.\n"), _PATH_UMOUNT);
+		printf("Cannot exec %s, trying umount.\n", _PATH_UMOUNT);
 		fflush(stdout);
 
 		execlp("umount", UMOUNT_ARGS, NULL);
-		my_puts(_("Cannot exec umount, giving up on umount."));
+		my_puts("Cannot exec umount, giving up on umount.");
 		exit(EXIT_SUCCESS);
 	}
 	while ((result = wait(&status)) != -1 && result != pid)
 		;
-	my_puts(_("Unmounting any remaining filesystems..."));
+	my_puts("Unmounting any remaining filesystems...");
 	unmount_disks_ourselves();
 }
 
@@ -652,7 +650,7 @@ unmount_disks_ourselves(void)
 		printf("umount %s\n", filesys);
 #else
 		if (umount(mntlist[i]) < 0)
-			printf(_("shutdown: Couldn't umount %s: %s\n"),
+			printf("shutdown: Couldn't umount %s: %s\n",
 			       filesys, ERRSTRING);
 #endif
 	}
diff --git a/simpleinit/simpleinit.c b/simpleinit/simpleinit.c
index d7f9655..8493d70 100644
--- a/simpleinit/simpleinit.c
+++ b/simpleinit/simpleinit.c
@@ -134,15 +134,15 @@ static void enter_single (void)
     pid_t pid;
     int i;
 
-    err(_("Booting to single user mode.\n"));
+    err("Booting to single user mode.\n");
     if((pid = fork()) == 0) {
 	/* the child */
 	execl(_PATH_BSHELL, _PATH_BSHELL, NULL);
-	err(_("exec of single user shell failed\n"));
+	err("exec of single user shell failed\n");
     } else if(pid > 0) {
 	while (waitpid (pid, &i, 0) != pid)  /*  Nothing  */;
     } else if(pid < 0) {
-	err(_("fork of single user shell failed\n"));
+	err("fork of single user shell failed\n");
     }
     unlink(_PATH_SINGLE);
 }
@@ -173,8 +173,6 @@ int main(int argc, char *argv[])
 	sigaction (SIGQUIT, &sa, NULL);
 
 	setlocale(LC_ALL, "");
-	bindtextdomain(PACKAGE, LOCALEDIR);
-	textdomain(PACKAGE);
 
 	my_reboot (LINUX_REBOOT_CMD_CAD_OFF);
 	/*  Find script to run. Command-line overrides config file overrides
@@ -210,11 +208,11 @@ int main(int argc, char *argv[])
 	if ( ( initctl_fd = open (initctl_name, O_RDWR, 0) ) < 0 ) {
 		mkfifo (initctl_name, S_IRUSR | S_IWUSR);
 		if ( ( initctl_fd = open (initctl_name, O_RDWR, 0) ) < 0 )
-			err ( _("error opening fifo\n") );
+			err ("error opening fifo\n");
 	}
 
 	if (initctl_fd >= 0 && fcntl(initctl_fd, F_SETFD, FD_CLOEXEC) != 0) {
-		err ( _("error setting close-on-exec on /dev/initctl") );
+		err ("error setting close-on-exec on /dev/initctl");
 
 		/* Can the fcntl ever fail?  If it does, and we leave
 		   the descriptor open in child processes, then any
@@ -261,11 +259,11 @@ int main(int argc, char *argv[])
 		{
 		  case 0:   /*  Child   */
 		    execl (final_prog, final_prog, "start", NULL);
-		    err ( _("error running finalprog\n") );
+		    err ("error running finalprog\n");
 		    _exit (EXIT_FAILURE);
 		    break;
 		  case -1:  /*  Error   */
-		    err ( _("error forking finalprog\n") );
+		    err ("error forking finalprog\n");
 		    break;
 		  default:  /*  Parent  */
 		    break;
@@ -342,12 +340,12 @@ static int check_single_ok (void)
 
     for (i = 0; i < MAXTRIES; i++)
     {
-	pass = getpass (_("Password: "));
+	pass = getpass ("Password: ");
 	if (pass == NULL) continue;
 
 	if ( !strcmp (crypt (pass, rootpass), rootpass) ) return 1;
 
-	puts (_("\nWrong password.\n"));
+	puts ("\nWrong password.\n");
     }
     return 0;
 }
@@ -420,7 +418,7 @@ static int process_path (const char *path, int (*func) (const char *path),
 
     if (lstat (path, &statbuf) != 0)
     {
-	err (_("lstat of path failed\n") );
+	err ("lstat of path failed\n");
 	return 1;
     }
     if ( S_ISLNK (statbuf.st_mode) )
@@ -428,7 +426,7 @@ static int process_path (const char *path, int (*func) (const char *path),
 	if (stat (path, &statbuf) != 0)
 	{
 	    if ( (errno == ENOENT) && ignore_dangling_symlink ) return 0;
-	    err (_("stat of path failed\n") );
+	    err ("stat of path failed\n");
 	    return 1;
 	}
     }
@@ -436,7 +434,7 @@ static int process_path (const char *path, int (*func) (const char *path),
     if ( !S_ISDIR (statbuf.st_mode) ) return (*func) (path);
     if ( ( dp = opendir (path) ) == NULL )
     {
-	err (_("open of directory failed\n") );
+	err ("open of directory failed\n");
 	return 1;
     }
     while ( ( de = readdir (dp) ) != NULL )
@@ -503,7 +501,7 @@ static void spawn (int i)
 		inittab[i].pid = -1;
 		inittab[i].rate = 0;
 		snprintf (txt, sizeof(txt),
-			_("respawning: \"%s\" too fast: quenching entry\n"),
+			"respawning: \"%s\" too fast: quenching entry\n",
 			 inittab[i].tty);
 		err (txt);
 		return;
@@ -511,7 +509,7 @@ static void spawn (int i)
 
 	if((pid = fork()) < 0) {
 		inittab[i].pid = -1;
-		err(_("fork failed\n"));
+		err("fork failed\n");
 		return;
 	}
 	if(pid) {
@@ -542,7 +540,7 @@ static void spawn (int i)
 		env[2] = (char *)0;
 
 		execve(inittab[i].toks[0], inittab[i].toks, env);
-		err(_("exec failed\n"));
+		err("exec failed\n");
 		sleep(5);
 		_exit(EXIT_FAILURE);
 	}
@@ -566,7 +564,7 @@ static void read_inittab (void)
 	/* termenv = "vt100"; */
 			
 	if(!(f = fopen(_PATH_INITTAB, "r"))) {
-		err(_("cannot open inittab\n"));
+		err("cannot open inittab\n");
 		return;
 	}
 
@@ -633,7 +631,7 @@ static void read_inittab (void)
 		/* special-case termcap for the console ttys */
 		snprintf(tty, sizeof(tty), "/dev/%s", inittab[i].tty);
 		if(!termenv || stat(tty, &stb) < 0) {
-			err(_("no TERM or cannot stat tty\n"));
+			err("no TERM or cannot stat tty\n");
 		} else {
 			/* is it a console tty? */
 			if(major(stb.st_rdev) == 4 && minor(stb.st_rdev) < 64)
@@ -940,7 +938,7 @@ static void process_command (const struct command_struct *command)
 		execlp (get_path (victim->first_service->name),
 			victim->first_service->name, "stop", NULL);
 		snprintf (txt, sizeof(txt),
-			_("error at stopping service \"%s\"\n"),
+			"error at stopping service \"%s\"\n",
 			 victim->first_service->name);
 		err (txt);
 		_exit (SIG_NOT_STOPPED);
@@ -952,7 +950,7 @@ static void process_command (const struct command_struct *command)
 		if ( WIFEXITED (ival) && (WEXITSTATUS (ival) == 0) )
 		{
 		    snprintf (txt, sizeof(txt),
-			     _("Stopped service: %s\n"),
+			     "Stopped service: %s\n",
 			     victim->first_service->name);
 		    remove_entry (&available_list, victim);
 		    free (victim);
@@ -1072,7 +1070,7 @@ static int run_command (const char *file, const char *name, pid_t pid)
 	    for (i = 1; i < NSIG; i++) signal (i, SIG_DFL);
 	    execlp (get_path (file), service->name, "start", NULL);
 	    snprintf (txt, sizeof(txt),
-		_("error at starting service \"%s\"\n"), service->name);
+		"error at starting service \"%s\"\n", service->name);
 	    err (txt);
 	    _exit (SIG_FAILED);
 	    break;
-- 
1.7.3.4


^ permalink raw reply related

* Re: [PATCH 09/13] colrm: gotos, long options and argument checking
From: Karel Zak @ 2011-06-01  8:13 UTC (permalink / raw)
  To: Sami Kerola; +Cc: util-linux
In-Reply-To: <1306270604-6154-10-git-send-email-kerolasa@iki.fi>

On Tue, May 24, 2011 at 10:56:40PM +0200, Sami Kerola wrote:
> +int main(int argc, char **argv)
> +{
> +	unsigned long first = 0, last = 0;
> +	int opt;
> +
> +	static const struct option longopts[] = {
> +		{"version", no_argument, 0, 'V'},
> +		{"help", no_argument, 0, 'h'},
> +		{NULL, 0, 0, 0}
> +	};
> +
> +	setlocale(LC_ALL, "");
 
and

    bindtextdomain(PACKAGE, LOCALEDIR);
    textdomain(PACKAGE);

right?

    Karel


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

^ permalink raw reply

* Re: [PATCH 08/13] col: check with strtol_or_err option argument
From: Karel Zak @ 2011-06-01  8:12 UTC (permalink / raw)
  To: Sami Kerola; +Cc: util-linux
In-Reply-To: <1306270604-6154-9-git-send-email-kerolasa@iki.fi>

On Tue, May 24, 2011 at 10:56:39PM +0200, Sami Kerola wrote:
>  		case 'l':		/* buffered line count */
> -			if ((max_bufd_lines = atoi(optarg)) <= 0)
> -				errx(EXIT_FAILURE, _("bad -l argument %s."), optarg);
> +			tmplong = strtoul_or_err(optarg, _("bad -l argument"));
> +			if ((INT_MAX / 2) < tmplong)

 Why we need this magical (INT_MAX / 2) limit?

    Karel

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

^ permalink raw reply

* Re: Using /proc/mounts in mountlist.c for linux
From: Karel Zak @ 2011-06-01  7:56 UTC (permalink / raw)
  To: James Youngman; +Cc: Pádraig Brady, Philipp Thomas, bug-gnulib, util-linux
In-Reply-To: <BANLkTimyv2MLLb7iJbxa9U+=jFAgg3mSrA@mail.gmail.com>

On Wed, Jun 01, 2011 at 12:28:46AM +0100, James Youngman wrote:
> 2011/5/31 Karel Zak <kzak@redhat.com>:
> > On Tue, May 31, 2011 at 10:31:17AM +0100, Pádraig Brady wrote:
> >> On 31/05/11 01:14, James Youngman wrote:
> >> > On Tue, Apr 5, 2011 at 1:36 PM, Philipp Thomas <pth@suse.de> wrote:
> >> >> GNU find will not recognize file systems of type autofs on newer Linux
> >> >> kernels as autofs entries are only listed in /proc/mounts and mountlist.c
> >> >> includes glibc mntent.h which takes the _PATH_MOUNTED from paths.h and that
> >> >> is /etc/mtab.
> >> >>
> >> >> After a longer discussion, we (SUSE) chose to patch mountlist.c in findutils
> >> >> to use proc/mounts instead of /etc/mtab which fixed ou problem.
> >> >>
> >> >> Would gnulib accept the attached patch to mountlist.c?
> >> >
> >> > I don't know if this patch was accepted, but it shouldn't be.   The
> >> > problem is that /proc/mounts has incomplete data for /.   This will
> >> > break gnulib's mountlist, at least with the current form of the patch,
> >> > because mountlist will have an incorrect idea of the type of the root
> >> > filesystem.   Here's an example showing the problem:
> >> >
> >> > ~$ cat tryit.sh
> >> > #! /bin/sh
> >> > f() {
> >> >     echo "$1"
> >> >     ( ls -l /etc/mtab; find / -maxdepth 0 -printf '%p %F\n' ) |
> >> >     sed -e 's_^_    _'
> >> > }
> >> >
> >> > set -e
> >> > cd /etc
> >> > f "regular /etc/mtab"
> >> >
> >> > mv mtab mtab.old; ln -s ../proc/mounts mtab
> >> > f "with /proc/mounts"
> >> > rm mtab; mv mtab.old mtab
> >> > ~$ sudo sh tryit.sh
> >> > regular /etc/mtab
> >> >     -rw-r--r-- 1 root root 1869 May 30 23:53 /etc/mtab
> >> >     / ext3
> >> > with /proc/mounts
> >> >     lrwxrwxrwx 1 root root 14 May 31 01:12 /etc/mtab -> ../proc/mounts
> >> >     / rootfs
> >
> >
> >  That's strange, why for "/" it does not search in the file (mtab) in reverse
> >  order?
> >
> > example A)
> >
> >         # mount -t ext3 /dev/sda6 /mnt/test
> >         # mount -t ext4 /dev/mapper/kzak-home /mnt/test
> >
> >  ... so I have two entries for the same mountpoint:
> >
> >         # grep /mnt/test /proc/mounts
> >         /dev/sda6 /mnt/test ext3  rw,relatime,errors=continue,barrier=0,data=ordered 0 0
> >         /dev/mapper/kzak-home /mnt/test ext4 rw,relatime,barrier=1,data=ordered 0 0
> >
> >
> >  this is correct (ext4 is the second entry):
> >
> >         # find /mnt/test -maxdepth 0 -printf '%p %F\n'
> >         /mnt/test ext4
> >
> >
> > example B)
> >
> >  the same thing with root FS:
> >
> >         # grep -E '(/dev/sda4|rootfs)' /proc/mounts
> >         rootfs / rootfs rw 0 0
> >         /dev/sda4 / ext3  rw,noatime,errors=continue,user_xattr,acl,barrier=0,data=ordered 0 0
> >
> >  ... so I have two entries for the same mountpoint:
> >
> >
> >         # find / -maxdepth 0 -printf '%p %F\n'
> >         / rootfs
> >
> >  why does it return the first entry? It seems like obvious bug. You
> >  have to read entries in the mtab file in reverse order.
> 
> I find this claim most surprising, since getmntent is intended for use
> on both /etc/mtab and /etc/fstab and it reads them forwards.   As a
> system administrator, I would consider it a bug for there to be a
> duplicate entry in /etc/mtab, and if as a sysadmin I had actually

 /dev/sda1 /foo  ext2 defaults
 /dev/sda2 /foo  ext3 defaults

 there is nothing duplicated, this maybe unusual, but valid setup

> somehow put two similar entries into /etc/fstab,

 Don't care about fstab, you can mount whatever manually and I think
 that basic system tools should be able to follow VFS.

> I'd expect mount(8)
> to use the first match (and mount -a to use all matches).

 We are not talking about fstab, but about list of already mounted
 filesystem. The order is important, because you can mount more
 filesystems on the same mountpoint. The visible filesystem is the
 filesystem on the top of the hierarchy.

 And yes, "mount [-a]" reads fstab in normal order (forward), but when
 mount(8) or umount(8) work with lists of the mounted filesystes (e.g.
 /etc/mtab, /proc/mounts, /proc/self/mountinfo ) then we use reverse order.

    Karel

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

^ permalink raw reply

* Re: Using /proc/mounts in mountlist.c for linux
From: James Youngman @ 2011-05-31 23:28 UTC (permalink / raw)
  To: Karel Zak; +Cc: Pádraig Brady, Philipp Thomas, bug-gnulib, util-linux
In-Reply-To: <20110531111003.GB25562@nb.net.home>

2011/5/31 Karel Zak <kzak@redhat.com>:
> On Tue, May 31, 2011 at 10:31:17AM +0100, Pádraig Brady wrote:
>> On 31/05/11 01:14, James Youngman wrote:
>> > On Tue, Apr 5, 2011 at 1:36 PM, Philipp Thomas <pth@suse.de> wrote:
>> >> GNU find will not recognize file systems of type autofs on newer Linux
>> >> kernels as autofs entries are only listed in /proc/mounts and mountlist.c
>> >> includes glibc mntent.h which takes the _PATH_MOUNTED from paths.h and that
>> >> is /etc/mtab.
>> >>
>> >> After a longer discussion, we (SUSE) chose to patch mountlist.c in findutils
>> >> to use proc/mounts instead of /etc/mtab which fixed ou problem.
>> >>
>> >> Would gnulib accept the attached patch to mountlist.c?
>> >
>> > I don't know if this patch was accepted, but it shouldn't be.   The
>> > problem is that /proc/mounts has incomplete data for /.   This will
>> > break gnulib's mountlist, at least with the current form of the patch,
>> > because mountlist will have an incorrect idea of the type of the root
>> > filesystem.   Here's an example showing the problem:
>> >
>> > ~$ cat tryit.sh
>> > #! /bin/sh
>> > f() {
>> >     echo "$1"
>> >     ( ls -l /etc/mtab; find / -maxdepth 0 -printf '%p %F\n' ) |
>> >     sed -e 's_^_    _'
>> > }
>> >
>> > set -e
>> > cd /etc
>> > f "regular /etc/mtab"
>> >
>> > mv mtab mtab.old; ln -s ../proc/mounts mtab
>> > f "with /proc/mounts"
>> > rm mtab; mv mtab.old mtab
>> > ~$ sudo sh tryit.sh
>> > regular /etc/mtab
>> >     -rw-r--r-- 1 root root 1869 May 30 23:53 /etc/mtab
>> >     / ext3
>> > with /proc/mounts
>> >     lrwxrwxrwx 1 root root 14 May 31 01:12 /etc/mtab -> ../proc/mounts
>> >     / rootfs
>
>
>  That's strange, why for "/" it does not search in the file (mtab) in reverse
>  order?
>
> example A)
>
>         # mount -t ext3 /dev/sda6 /mnt/test
>         # mount -t ext4 /dev/mapper/kzak-home /mnt/test
>
>  ... so I have two entries for the same mountpoint:
>
>         # grep /mnt/test /proc/mounts
>         /dev/sda6 /mnt/test ext3  rw,relatime,errors=continue,barrier=0,data=ordered 0 0
>         /dev/mapper/kzak-home /mnt/test ext4 rw,relatime,barrier=1,data=ordered 0 0
>
>
>  this is correct (ext4 is the second entry):
>
>         # find /mnt/test -maxdepth 0 -printf '%p %F\n'
>         /mnt/test ext4
>
>
> example B)
>
>  the same thing with root FS:
>
>         # grep -E '(/dev/sda4|rootfs)' /proc/mounts
>         rootfs / rootfs rw 0 0
>         /dev/sda4 / ext3  rw,noatime,errors=continue,user_xattr,acl,barrier=0,data=ordered 0 0
>
>  ... so I have two entries for the same mountpoint:
>
>
>         # find / -maxdepth 0 -printf '%p %F\n'
>         / rootfs
>
>  why does it return the first entry? It seems like obvious bug. You
>  have to read entries in the mtab file in reverse order.

I find this claim most surprising, since getmntent is intended for use
on both /etc/mtab and /etc/fstab and it reads them forwards.   As a
system administrator, I would consider it a bug for there to be a
duplicate entry in /etc/mtab, and if as a sysadmin I had actually
somehow put two similar entries into /etc/fstab, I'd expect mount(8)
to use the first match (and mount -a to use all matches).

>  Anyway, /proc/self/mountinfo is definitely more sexy... :-)
>
>    Karel
>
> --
>  Karel Zak  <kzak@redhat.com>
>  http://karelzak.blogspot.com
>

^ permalink raw reply

* [PATCH] tests: add lscpu dumps from three Dell's & a Xen
From: Sami Kerola @ 2011-05-31 18:31 UTC (permalink / raw)
  To: util-linux; +Cc: kerolasa, Sami Kerola

From: Sami Kerola <sami.kerola@tomtom.com>

x86_64-dell_poweredgeR610
	Ubuntu 11.04 kernel 2.6.38-8

x86_64-dell_poweredge1950
	Red Hat EL 4.5 kernel 2.6.9-55.ELsmp

x86_64-dell_e4310
	Red Hat EL 5.3 kernel 2.6.18-194.17.4.el5

x86_64-el5xen
	Red Hat EL 5.6 kernel 2.6.18-238.el5xen

Signed-off-by: Sami Kerola <sami.kerola@tomtom.com>
---
 tests/expected/lscpu/lscpu-x86_64-dell_e4310       |   28 ++++++++++++++
 .../expected/lscpu/lscpu-x86_64-dell_poweredge1950 |   23 +++++++++++
 .../expected/lscpu/lscpu-x86_64-dell_poweredgeR610 |   40 ++++++++++++++++++++
 tests/expected/lscpu/lscpu-x86_64-el5xen           |   30 +++++++++++++++
 tests/ts/lscpu/dumps/x86_64-dell_e4310.tar.gz      |  Bin 0 -> 12933 bytes
 .../lscpu/dumps/x86_64-dell_poweredge1950.tar.gz   |  Bin 0 -> 1492 bytes
 .../lscpu/dumps/x86_64-dell_poweredgeR610.tar.gz   |  Bin 0 -> 14095 bytes
 tests/ts/lscpu/dumps/x86_64-el5xen.tar.gz          |  Bin 0 -> 7296 bytes
 8 files changed, 121 insertions(+), 0 deletions(-)
 create mode 100644 tests/expected/lscpu/lscpu-x86_64-dell_e4310
 create mode 100644 tests/expected/lscpu/lscpu-x86_64-dell_poweredge1950
 create mode 100644 tests/expected/lscpu/lscpu-x86_64-dell_poweredgeR610
 create mode 100644 tests/expected/lscpu/lscpu-x86_64-el5xen
 create mode 100644 tests/ts/lscpu/dumps/x86_64-dell_e4310.tar.gz
 create mode 100644 tests/ts/lscpu/dumps/x86_64-dell_poweredge1950.tar.gz
 create mode 100644 tests/ts/lscpu/dumps/x86_64-dell_poweredgeR610.tar.gz
 create mode 100644 tests/ts/lscpu/dumps/x86_64-el5xen.tar.gz

diff --git a/tests/expected/lscpu/lscpu-x86_64-dell_e4310 b/tests/expected/lscpu/lscpu-x86_64-dell_e4310
new file mode 100644
index 0000000..7131e3e
--- /dev/null
+++ b/tests/expected/lscpu/lscpu-x86_64-dell_e4310
@@ -0,0 +1,28 @@
+CPU op-mode(s):        32-bit, 64-bit
+CPU(s):                4
+On-line CPU(s) list:   0-3
+Thread(s) per core:    2
+Core(s) per socket:    2
+CPU socket(s):         1
+NUMA node(s):          1
+Vendor ID:             GenuineIntel
+CPU family:            6
+Model:                 37
+Stepping:              5
+CPU MHz:               1199.000
+BogoMIPS:              5319.97
+Virtualization:        VT-x
+L1d cache:             32K
+L1i cache:             32K
+L2 cache:              256K
+L3 cache:              3072K
+NUMA node0 CPU(s):     0-3
+
+# The following is the parsable format, which can be fed to other
+# programs. Each different item in every column has an unique ID
+# starting from zero.
+# CPU,Core,Socket,Node,,L1d,L1i,L2,L3
+0,0,0,0,,0,0,0,0
+1,1,0,0,,1,1,1,0
+2,0,0,0,,0,0,0,0
+3,1,0,0,,1,1,1,0
diff --git a/tests/expected/lscpu/lscpu-x86_64-dell_poweredge1950 b/tests/expected/lscpu/lscpu-x86_64-dell_poweredge1950
new file mode 100644
index 0000000..64c5a9c
--- /dev/null
+++ b/tests/expected/lscpu/lscpu-x86_64-dell_poweredge1950
@@ -0,0 +1,23 @@
+CPU op-mode(s):        32-bit, 64-bit
+CPU(s):                8
+NUMA node(s):          1
+Vendor ID:             GenuineIntel
+CPU family:            6
+Model:                 15
+Stepping:              7
+CPU MHz:               2327.526
+BogoMIPS:              4655.08
+NUMA node0 CPU(s):     0-7
+
+# The following is the parsable format, which can be fed to other
+# programs. Each different item in every column has an unique ID
+# starting from zero.
+# CPU,Core,Socket,Node
+0,,,0
+1,,,0
+2,,,0
+3,,,0
+4,,,0
+5,,,0
+6,,,0
+7,,,0
diff --git a/tests/expected/lscpu/lscpu-x86_64-dell_poweredgeR610 b/tests/expected/lscpu/lscpu-x86_64-dell_poweredgeR610
new file mode 100644
index 0000000..55791ce
--- /dev/null
+++ b/tests/expected/lscpu/lscpu-x86_64-dell_poweredgeR610
@@ -0,0 +1,40 @@
+CPU op-mode(s):        32-bit, 64-bit
+CPU(s):                16
+Thread(s) per core:    2
+Core(s) per socket:    4
+CPU socket(s):         2
+NUMA node(s):          2
+Vendor ID:             GenuineIntel
+CPU family:            6
+Model:                 26
+Stepping:              5
+CPU MHz:               2261.056
+BogoMIPS:              4522.04
+Virtualization:        VT-x
+L1d cache:             32K
+L1i cache:             32K
+L2 cache:              256K
+L3 cache:              8192K
+NUMA node0 CPU(s):     0,2,4,6,8,10,12,14
+NUMA node1 CPU(s):     1,3,5,7,9,11,13,15
+
+# The following is the parsable format, which can be fed to other
+# programs. Each different item in every column has an unique ID
+# starting from zero.
+# CPU,Core,Socket,Node,,L1d,L1i,L2,L3
+0,0,0,0,,0,0,0,0
+1,1,1,1,,1,1,1,1
+2,2,0,0,,2,2,2,0
+3,3,1,1,,3,3,3,1
+4,4,0,0,,4,4,4,0
+5,5,1,1,,5,5,5,1
+6,6,0,0,,6,6,6,0
+7,7,1,1,,7,7,7,1
+8,0,0,0,,0,0,0,0
+9,1,1,1,,1,1,1,1
+10,2,0,0,,2,2,2,0
+11,3,1,1,,3,3,3,1
+12,4,0,0,,4,4,4,0
+13,5,1,1,,5,5,5,1
+14,6,0,0,,6,6,6,0
+15,7,1,1,,7,7,7,1
diff --git a/tests/expected/lscpu/lscpu-x86_64-el5xen b/tests/expected/lscpu/lscpu-x86_64-el5xen
new file mode 100644
index 0000000..c801b23
--- /dev/null
+++ b/tests/expected/lscpu/lscpu-x86_64-el5xen
@@ -0,0 +1,30 @@
+CPU op-mode(s):        32-bit, 64-bit
+CPU(s):                8
+Thread(s) per core:    1
+Core(s) per socket:    1
+CPU socket(s):         8
+Vendor ID:             GenuineIntel
+CPU family:            6
+Model:                 26
+Stepping:              5
+CPU MHz:               2393.998
+BogoMIPS:              5986.29
+Hypervisor vendor:     Xen
+Virtualization type:   para
+L1d cache:             32K
+L1i cache:             32K
+L2 cache:              256K
+L3 cache:              8192K
+
+# The following is the parsable format, which can be fed to other
+# programs. Each different item in every column has an unique ID
+# starting from zero.
+# CPU,Core,Socket,Node,,L1d,L1i,L2,L3
+0,0,0,,,0,0,0,0
+1,1,1,,,0,0,0,0
+2,2,2,,,1,1,1,0
+3,3,3,,,1,1,1,0
+4,4,4,,,2,2,2,0
+5,5,5,,,2,2,2,0
+6,6,6,,,3,3,3,0
+7,7,7,,,3,3,3,0
diff --git a/tests/ts/lscpu/dumps/x86_64-dell_e4310.tar.gz b/tests/ts/lscpu/dumps/x86_64-dell_e4310.tar.gz
new file mode 100644
index 0000000000000000000000000000000000000000..2988cbc52d5c1580634140b3f044224386c22bb6
GIT binary patch
literal 12933
zcmdU#c{o*F|L_q>l5Q%ZIt?`3rK3C1KwG0!k|aqvBvToZGKDRa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~?YsU(z48gynIdv?9tH{d!!zpI&2hRN9$FI)>OJh4nHLq1T-ITtc
zDL)vNZWVosz1%4vU%AcUyL<^NT(H&JdD7x{5{oPSI<F`1=#VNcl%EDRN9`PsZ$376
zG~1i?!mn(NaH}6pc-Sgn&(7l3p^38oiqBoQ+IfbKbEnIf4kmI<Ek+!|z<UJiT%|J_
zeB;Z^<#Y>o?8*sm&6<ui0mu5~OO)tWLN~tu`b^oXw>8)B`rvf;<7$OQ_Frb=8|4%@
z+ShV+%v^e|b0Iy_o6@>zHa44bHL`YTn(<9o6R}K70ms)3;?3m2nXCT1Z#NUy{Mh;F
zv;9+=@P^>teTxy=^_$5nK3MoAb;Pf+5EA#frIxTSVA2P>R3%q6_YQ;HcBxyLoIy`l
zlZjJ(v$n4qH1LtWLeFiylXDfD!>L}V<tb=eXjr^XZp<L*!Q#$MGC67ST<uLWYs*J1
z6r9KGi_O_Cx)@foLC^SU4mudTb;kG9ZEkrQ^KU%nKOgPfF7+j3`x~~$#2uR_#>+W2
zag==GQIoJ>o%and)hL`baDsiru%DiyM&65f{4`?avL5*qHCEX2%TOIPewy+2)vjav
t6r!{uBi>Ss45=JLPjf@<C`t9@%X&Uk)QJ84C$N%-CkkB?#HL7#{VzC96!icA

literal 0
HcmV?d00001

diff --git a/tests/ts/lscpu/dumps/x86_64-dell_poweredge1950.tar.gz b/tests/ts/lscpu/dumps/x86_64-dell_poweredge1950.tar.gz
new file mode 100644
index 0000000000000000000000000000000000000000..ef3f73ea23667abdb7583d0e86ade215bc8a64b1
GIT binary patch
literal 1492
zcmV;_1uOa=iwFScp5#pc1MOT}kE1pio!9Uy{MbtE)Hb#u`&6}E?T)HSt4fvjEpm*>
zAaN^@+06d>+9YHqnPC!`jMI#Lq$I?E;XCK>`2xu*WHUy7j%1q7%Ho@>WVDcIO5rb8
zCj(RnC~ZF#_CMQYglK>e3Vae=K|~-5t^hsVDfDAmH@pJisw#@+rR@%_zfi1t^)IVJ
zoW=wr^bZ(z`kTN3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QiLEMFpEeszk(G>+DgosWaHRDmJvZES3
z_E!>%P`<Xch{g0ti-QhUicir<g}RPRE_lV0Xjb#ugSrhuh%w~}8wZP2hfgFyjEKpj
zo^2eq8WGcHhM~#c$UI+R53)@%^feh44w+OM?BW*|UIM{Zeq^Qm0SvqNiH-4xcDDf2
zofhCh{+QU)0tn3k3<6C2C(jDV$6fkZP}RjhF)6WN&xDNj3dkFf(n>t}H|1C@X&TT2
z4PuXmaF2%Y-O?a84FZC6XOI{Rf4B3i3dEB$j^1E`@JZ+Qx!&+m6GDdzr0$Dr63_z)
zVuu92PeS+%38$YOG*1G8EL0Z+#1ttKqDKRzb&lE{D2d%ff#TDrvGBRvxOasd9!ec9
zSTpOM$-ZFpKmS?ZpWxB&7Q>(aC90R{p8qw0m-XK~_WMd74A-Aw>i+-92#(WVEjKb7
zYlGqX2MoI3e;C0a{YAMP<AK5YV?E*S^f!UQ`m5K_{{|ecKf(k#{Y_wu{>X&>?)o=^
zG5TW@`n&eu2*&8|o6w&){Y_wu{=|g-Zv1ZqWAvvc^mo7iHi9wwGZXr|`5z+~qkmvP
ze+r%cCNN0<yolt8383NnL+U&IjbOO``fb<@(1`1wy8Az7Fjjxn3}n1K?igC&{{Mf`
u@b~n`>hsF||BC^{vAccm;Nalk;Nalk;Nalk;Nal!p79?w?Ssw$cmM!n2L&Mj

literal 0
HcmV?d00001

diff --git a/tests/ts/lscpu/dumps/x86_64-dell_poweredgeR610.tar.gz b/tests/ts/lscpu/dumps/x86_64-dell_poweredgeR610.tar.gz
new file mode 100644
index 0000000000000000000000000000000000000000..2f9fccdb9e33534cac231162373cbd1a1a0ac4bc
GIT binary patch
literal 14095
zcmcJ0d0b8T|9@JP!QA3Q8OF^%Xq07S>C?&14EkV*AvaqXa+9H=I!dImWDljAZ5k7@
z7pW6bwp^rzmK$kNT5os1=e&NebM9@i&CKWXo!>v7$LD%<&pG$JU$5uuxx9wI!_44q
z<eO;*Mpef=!t%b~cUlum4{TU#dHC(JzV{FO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{ErP>yZbN$gD=(z4;jWp_)qt|2kk4MZWgQit+s4uM4Y*^ED|@W8#L`trlBG5<)YQv
ltLczJ^Nj=Rs1-#@XR{u`=3_tp9|IMn8OKgAsQtp={{hlBqA36X

literal 0
HcmV?d00001

diff --git a/tests/ts/lscpu/dumps/x86_64-el5xen.tar.gz b/tests/ts/lscpu/dumps/x86_64-el5xen.tar.gz
new file mode 100644
index 0000000000000000000000000000000000000000..2ad47dd6402148564f806c282d9528f01455a875
GIT binary patch
literal 7296
zcmdT}c~}$I-exOAOAQn&h}wW!v8@%jt)jI$2u1W(i!Cl#paH2%MOn0p3VPTiRF>Gf
z(YgdGtqKZ=6;afHAW;yZDg<Q-5HT#W8A8Z1=l7i<w6%Nh^WA%&@B43<XJ&HF%=`Y{
z1x^A>&-j~1OY{u8jx_{J7jC;D+e)u&bJU+{F(!dCFz>lVCIv}ukv7hTJ1o}kJrI9r
z(fssvb#gK9fcvqavVhzyuaoZiGLze0c>Q_r!@P?b-KV{|-TSw`NWXWEFC489;zxT@
z?UJPTM92F?_W}c2?x$24&4(?e=~1drU(%>LBPzGltr1msoD8`4Sr1)*Um1MBUUCCM
zHa=|)Hc$@o7L9hqtj2h>dwW(#?y7EU*T@s|QiDa36dP+1HL`dfF4~OtNZfa5dGVH;
z>c&I=;pHL9_dW>zT6+0mzkt4QN~1{~^a{IyvxIgl)(kA`;;MTlhj~<dR|}`nSUj+E
z`8p3bP_>_gc7%5*gl?W}4oHR6SuB9WfN^J5K;B4{94*9M;)1-_NAWTm2hdydd>;w%
zKxe!1p@~LbTul2OZ!K6|y+SxjNH@L{n<)fMgTM0biXC~}WB8jQU+=ly8t&ZzK}x}u
z*<*^G-j|Hs-P*fH9DI-`Yc98Un{&m-lKZr!YWWhnP8>H5oquR4?1wxos%W4_aZ!Xo
zA-o3ZuqAWJxsHbsiu*6G<el+q<#w-pkXE*GQ>a&~M}<ATvS9f&du3%;(7{&T21S4W
zn&rFO(X~wp&B7dzY!IJ)csLK%_4hO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{wAm
zKNA~fGKYYm4-4WoXuhfXq*gJJ7$X`@AAplSAR3m8KcU1`U~6FYpHd<OTl`VF$c2F0
zq;K^<O0tC2P??ihi4vwMQ9%3)U7W9p&(Wwn&VXN&%466mk<j&1#Qs?#WK<|v8r{K6
z4kchFLe7-53&FSv{J`=VI_m0AUH$9y32@8~HBifRH!0Xfv1jxGbxw_xKsnl>D5atP
zh=P9L!6H?OE)}(^sY)p7Jr`6U-7;@+<KX0_@e4t}5X|op(poVs*Bu~Xlkk@)q_Uf|
zNnD-2F}1T)A-QQyTK^DwrLOp5+TU*b;r5L<yP9EV$7}wx66#+Nh}XIeSM+ZEqj=%L
UvW+$SCIJlDbh^J@>T`Pk14lI|F8}}l

literal 0
HcmV?d00001

-- 
1.7.4.1


^ permalink raw reply related

* Re: Using /proc/mounts in mountlist.c for linux
From: Karel Zak @ 2011-05-31 11:10 UTC (permalink / raw)
  To: Pádraig Brady; +Cc: James Youngman, Philipp Thomas, bug-gnulib, util-linux
In-Reply-To: <4DE4B565.6040504@draigBrady.com>

On Tue, May 31, 2011 at 10:31:17AM +0100, Pádraig Brady wrote:
> On 31/05/11 01:14, James Youngman wrote:
> > On Tue, Apr 5, 2011 at 1:36 PM, Philipp Thomas <pth@suse.de> wrote:
> >> GNU find will not recognize file systems of type autofs on newer Linux
> >> kernels as autofs entries are only listed in /proc/mounts and mountlist.c
> >> includes glibc mntent.h which takes the _PATH_MOUNTED from paths.h and that
> >> is /etc/mtab.
> >>
> >> After a longer discussion, we (SUSE) chose to patch mountlist.c in findutils
> >> to use proc/mounts instead of /etc/mtab which fixed ou problem.
> >>
> >> Would gnulib accept the attached patch to mountlist.c?
> > 
> > I don't know if this patch was accepted, but it shouldn't be.   The
> > problem is that /proc/mounts has incomplete data for /.   This will
> > break gnulib's mountlist, at least with the current form of the patch,
> > because mountlist will have an incorrect idea of the type of the root
> > filesystem.   Here's an example showing the problem:
> > 
> > ~$ cat tryit.sh
> > #! /bin/sh
> > f() {
> >     echo "$1"
> >     ( ls -l /etc/mtab; find / -maxdepth 0 -printf '%p %F\n' ) |
> >     sed -e 's_^_    _'
> > }
> > 
> > set -e
> > cd /etc
> > f "regular /etc/mtab"
> > 
> > mv mtab mtab.old; ln -s ../proc/mounts mtab
> > f "with /proc/mounts"
> > rm mtab; mv mtab.old mtab
> > ~$ sudo sh tryit.sh
> > regular /etc/mtab
> >     -rw-r--r-- 1 root root 1869 May 30 23:53 /etc/mtab
> >     / ext3
> > with /proc/mounts
> >     lrwxrwxrwx 1 root root 14 May 31 01:12 /etc/mtab -> ../proc/mounts
> >     / rootfs


 That's strange, why for "/" it does not search in the file (mtab) in reverse
 order?

example A)

         # mount -t ext3 /dev/sda6 /mnt/test
         # mount -t ext4 /dev/mapper/kzak-home /mnt/test

  ... so I have two entries for the same mountpoint:

         # grep /mnt/test /proc/mounts 
         /dev/sda6 /mnt/test ext3  rw,relatime,errors=continue,barrier=0,data=ordered 0 0
         /dev/mapper/kzak-home /mnt/test ext4 rw,relatime,barrier=1,data=ordered 0 0


  this is correct (ext4 is the second entry):

         # find /mnt/test -maxdepth 0 -printf '%p %F\n'
         /mnt/test ext4


example B)

  the same thing with root FS:

         # grep -E '(/dev/sda4|rootfs)' /proc/mounts 
         rootfs / rootfs rw 0 0
         /dev/sda4 / ext3  rw,noatime,errors=continue,user_xattr,acl,barrier=0,data=ordered 0 0

  ... so I have two entries for the same mountpoint:


         # find / -maxdepth 0 -printf '%p %F\n'
         / rootfs

  why does it return the first entry? It seems like obvious bug. You
  have to read entries in the mtab file in reverse order.


  Anyway, /proc/self/mountinfo is definitely more sexy... :-)

    Karel

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

^ permalink raw reply

* Re: Using /proc/mounts in mountlist.c for linux
From: James Youngman @ 2011-05-31  9:42 UTC (permalink / raw)
  To: Pádraig Brady; +Cc: Philipp Thomas, bug-gnulib, util-linux
In-Reply-To: <4DE4B565.6040504@draigBrady.com>

2011/5/31 Pádraig Brady <P@draigbrady.com>:
> On 31/05/11 01:14, James Youngman wrote:
>> On Tue, Apr 5, 2011 at 1:36 PM, Philipp Thomas <pth@suse.de> wrote:
>>> GNU find will not recognize file systems of type autofs on newer Linux
>>> kernels as autofs entries are only listed in /proc/mounts and mountlist.c
>>> includes glibc mntent.h which takes the _PATH_MOUNTED from paths.h and that
>>> is /etc/mtab.
>>>
>>> After a longer discussion, we (SUSE) chose to patch mountlist.c in findutils
>>> to use proc/mounts instead of /etc/mtab which fixed ou problem.
>>>
>>> Would gnulib accept the attached patch to mountlist.c?
>>
>> I don't know if this patch was accepted, but it shouldn't be.   The
>> problem is that /proc/mounts has incomplete data for /.   This will
>> break gnulib's mountlist, at least with the current form of the patch,
>> because mountlist will have an incorrect idea of the type of the root
>> filesystem.   Here's an example showing the problem:
>>
>> ~$ cat tryit.sh
>> #! /bin/sh
>> f() {
>>     echo "$1"
>>     ( ls -l /etc/mtab; find / -maxdepth 0 -printf '%p %F\n' ) |
>>     sed -e 's_^_    _'
>> }
>>
>> set -e
>> cd /etc
>> f "regular /etc/mtab"
>>
>> mv mtab mtab.old; ln -s ../proc/mounts mtab
>> f "with /proc/mounts"
>> rm mtab; mv mtab.old mtab
>> ~$ sudo sh tryit.sh
>> regular /etc/mtab
>>     -rw-r--r-- 1 root root 1869 May 30 23:53 /etc/mtab
>>     / ext3
>> with /proc/mounts
>>     lrwxrwxrwx 1 root root 14 May 31 01:12 /etc/mtab -> ../proc/mounts
>>     / rootfs
>
> Well I didn't merge it, but for more generic reasons.
> It seemed like a bit of a layering violation to me,
> and I was unsure that other users of gnulib may need
> access to /etc/mtab specific stuff (on older systems).
>
> Here is related output on my Fedora 15 system
> which does link /etc/mtab -> /proc/mounts
>
> $ df /
> Filesystem           1K-blocks      Used Available Use% Mounted on
> /dev/sdb2             13102208   3210896   9758244  25% /
> $ df -t rootfs
> Filesystem           1K-blocks      Used Available Use% Mounted on
> rootfs                13102208   3210896   9758244  25% /
> $ find / -maxdepth 0 -printf "%p %F\n"
> / rootfs

Thanks for the additional info.   I think that would be a bug in
Fedora 15, then.

James.

^ permalink raw reply

* Re: Using /proc/mounts in mountlist.c for linux
From: Pádraig Brady @ 2011-05-31  9:31 UTC (permalink / raw)
  To: James Youngman; +Cc: Philipp Thomas, bug-gnulib, util-linux
In-Reply-To: <BANLkTin=pcsJ-b2y=GN3BpXsx8p+zgnJWA@mail.gmail.com>

On 31/05/11 01:14, James Youngman wrote:
> On Tue, Apr 5, 2011 at 1:36 PM, Philipp Thomas <pth@suse.de> wrote:
>> GNU find will not recognize file systems of type autofs on newer Linux
>> kernels as autofs entries are only listed in /proc/mounts and mountlist.c
>> includes glibc mntent.h which takes the _PATH_MOUNTED from paths.h and that
>> is /etc/mtab.
>>
>> After a longer discussion, we (SUSE) chose to patch mountlist.c in findutils
>> to use proc/mounts instead of /etc/mtab which fixed ou problem.
>>
>> Would gnulib accept the attached patch to mountlist.c?
> 
> I don't know if this patch was accepted, but it shouldn't be.   The
> problem is that /proc/mounts has incomplete data for /.   This will
> break gnulib's mountlist, at least with the current form of the patch,
> because mountlist will have an incorrect idea of the type of the root
> filesystem.   Here's an example showing the problem:
> 
> ~$ cat tryit.sh
> #! /bin/sh
> f() {
>     echo "$1"
>     ( ls -l /etc/mtab; find / -maxdepth 0 -printf '%p %F\n' ) |
>     sed -e 's_^_    _'
> }
> 
> set -e
> cd /etc
> f "regular /etc/mtab"
> 
> mv mtab mtab.old; ln -s ../proc/mounts mtab
> f "with /proc/mounts"
> rm mtab; mv mtab.old mtab
> ~$ sudo sh tryit.sh
> regular /etc/mtab
>     -rw-r--r-- 1 root root 1869 May 30 23:53 /etc/mtab
>     / ext3
> with /proc/mounts
>     lrwxrwxrwx 1 root root 14 May 31 01:12 /etc/mtab -> ../proc/mounts
>     / rootfs

Well I didn't merge it, but for more generic reasons.
It seemed like a bit of a layering violation to me,
and I was unsure that other users of gnulib may need
access to /etc/mtab specific stuff (on older systems).

Here is related output on my Fedora 15 system
which does link /etc/mtab -> /proc/mounts

$ df /
Filesystem           1K-blocks      Used Available Use% Mounted on
/dev/sdb2             13102208   3210896   9758244  25% /
$ df -t rootfs
Filesystem           1K-blocks      Used Available Use% Mounted on
rootfs                13102208   3210896   9758244  25% /
$ find / -maxdepth 0 -printf "%p %F\n"
/ rootfs

cheers,
Pádraig.

^ permalink raw reply

* [PATCH 10/13] docs: colrm manual update
From: Sami Kerola @ 2011-05-24 20:56 UTC (permalink / raw)
  To: util-linux; +Cc: kerolasa
In-Reply-To: <1306270604-6154-1-git-send-email-kerolasa@iki.fi>

Inform about long, help & version and options.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
---
 text-utils/colrm.1 |    8 ++++++++
 1 files changed, 8 insertions(+), 0 deletions(-)

diff --git a/text-utils/colrm.1 b/text-utils/colrm.1
index 1f3d4b0..04a41b1 100644
--- a/text-utils/colrm.1
+++ b/text-utils/colrm.1
@@ -51,6 +51,14 @@ If called with two parameters the columns from the first column
 to the last column will be removed.
 .Pp
 Column numbering starts with column 1.
+.Pp
+The options are as follows:
+.Bl -tag -width "-lnum"
+.It Fl V, Fl Fl version
+Output version information and exit.
+.It Fl H, Fl Fl help
+Output help and exit.
+.El
 .Sh SEE ALSO
 .Xr awk 1 ,
 .Xr column 1 ,
-- 
1.7.5.2


^ permalink raw reply related

* [PATCH 09/13] colrm: gotos, long options and argument checking
From: Sami Kerola @ 2011-05-24 20:56 UTC (permalink / raw)
  To: util-linux; +Cc: kerolasa
In-Reply-To: <1306270604-6154-1-git-send-email-kerolasa@iki.fi>

Unnecessary goto jumps where replaced by a simple function, and
two loops. Long options support help and version, and the two
arguments this command has are now validated with strtoul_or_err.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
---
 text-utils/Makefile.am |    2 +
 text-utils/colrm.c     |  143 ++++++++++++++++++++++++++++++++---------------
 2 files changed, 99 insertions(+), 46 deletions(-)

diff --git a/text-utils/Makefile.am b/text-utils/Makefile.am
index 8700889..0255033 100644
--- a/text-utils/Makefile.am
+++ b/text-utils/Makefile.am
@@ -6,6 +6,8 @@ usrbin_exec_PROGRAMS = col colcrt colrm column hexdump rev line tailf
 
 col_SOURCES = col.c $(top_srcdir)/lib/strutils.c
 
+colrm_SOURCES = colrm.c $(top_srcdir)/lib/strutils.c
+
 hexdump_SOURCES = hexdump.c conv.c display.c hexsyntax.c parse.c \
 		  hexdump.h $(top_srcdir)/lib/strutils.c
 
diff --git a/text-utils/colrm.c b/text-utils/colrm.c
index e8b1ea4..fa56f2d 100644
--- a/text-utils/colrm.c
+++ b/text-utils/colrm.c
@@ -40,67 +40,80 @@
 
 #include <stdio.h>
 #include <stdlib.h>
+#include <getopt.h>
 
 #include "nls.h"
 #include "widechar.h"
+#include "strutils.h"
+#include "c.h"
 
 /*
 COLRM removes unwanted columns from a file
 	Jeff Schriebman  UC Berkeley 11-74
 */
 
-int
-main(int argc, char **argv)
+static void __attribute__ ((__noreturn__)) usage(FILE * out)
 {
-	register int ct, first, last;
-	register wint_t c;
-	int i, w;
+	fprintf(out, _("\nUsage:\n"
+		       " %s [startcol [endcol]]\n"),
+		       program_invocation_short_name);
+
+	fprintf(out, _("\nOptions:\n"
+		       " -V, --version   output version information and exit\n"
+		       " -h, --help      display this help and exit\n\n"));
+
+	fprintf(out, _("%s reads from standard input and writes to standard output\n\n"),
+		       program_invocation_short_name);
+
+	exit(out == stderr ? EXIT_FAILURE : EXIT_SUCCESS);
+}
+
+int process_input(unsigned long first, unsigned long last)
+{
+	unsigned long ct = 0;
+	wint_t c;
+	unsigned long i;
+	int w;
 	int padding;
 
-	setlocale(LC_ALL, "");
+	for (;;) {
+		c = getwc(stdin);
+		if (c == WEOF)
+			return 0;
+		if (c == '\t')
+			w = ((ct + 8) & ~7) - ct;
+		else if (c == '\b')
+			w = (ct ? ct - 1 : 0) - ct;
+		else {
+			w = wcwidth(c);
+			if (w < 0)
+				w = 0;
+		}
+		ct += w;
+		if (c == '\n') {
+			putwc(c, stdout);
+			ct = 0;
+			continue;
 
-	first = 0;
-	last = 0;
-	if (argc > 1)
-		first = atoi(*++argv);
-	if (argc > 2)
-		last = atoi(*++argv);
-
-start:
-	ct = 0;
-loop1:
-	c = getwc(stdin);
-	if (c == WEOF)
-		goto fin;
-	if (c == '\t')
-		w = ((ct + 8) & ~7) - ct;
-	else if (c == '\b')
-		w = (ct ? ct - 1 : 0) - ct;
-	else {
-		w = wcwidth(c);
-		if (w < 0)
-			w = 0;
-	}
-	ct += w;
-	if (c == '\n') {
-		putwc(c, stdout);
-		goto start;
-	}
-	if (!first || ct < first) {
-		putwc(c, stdout);
-		goto loop1;
+		}
+		if (!first || ct < first) {
+			putwc(c, stdout);
+			continue;
+		}
+		break;
 	}
-	for (i = ct-w+1; i < first; i++)
+
+	for (i = ct - w + 1; i < first; i++)
 		putwc(' ', stdout);
 
-/* Loop getting rid of characters */
+	/* Loop getting rid of characters */
 	while (!last || ct < last) {
 		c = getwc(stdin);
 		if (c == WEOF)
-			goto fin;
+			return 0;
 		if (c == '\n') {
 			putwc(c, stdout);
-			goto start;
+			return 1;
 		}
 		if (c == '\t')
 			ct = (ct + 8) & ~7;
@@ -116,25 +129,63 @@ loop1:
 
 	padding = 0;
 
-/* Output last of the line */
+	/* Output last of the line */
 	for (;;) {
 		c = getwc(stdin);
 		if (c == WEOF)
 			break;
 		if (c == '\n') {
 			putwc(c, stdout);
-			goto start;
+			return 1;
 		}
 		if (padding == 0 && last < ct) {
-			for (i = last; i <ct; i++)
+			for (i = last; i < ct; i++)
 				putwc(' ', stdout);
 			padding = 1;
 		}
 		putwc(c, stdout);
 	}
-fin:
+	return 0;
+}
+
+int main(int argc, char **argv)
+{
+	unsigned long first = 0, last = 0;
+	int opt;
+
+	static const struct option longopts[] = {
+		{"version", no_argument, 0, 'V'},
+		{"help", no_argument, 0, 'h'},
+		{NULL, 0, 0, 0}
+	};
+
+	setlocale(LC_ALL, "");
+
+	while ((opt =
+		getopt_long(argc, argv, "bfhl:pxVH", longopts,
+			    NULL)) != -1)
+		switch (opt) {
+		case 'V':
+			printf(_("%s from %s\n"),
+			       program_invocation_short_name,
+			       PACKAGE_STRING);
+			return EXIT_SUCCESS;
+		case 'h':
+			usage(stdout);
+		default:
+			usage(stderr);
+		}
+
+	if (argc > 1)
+		first = strtoul_or_err(*++argv, _("first argument"));
+	if (argc > 2)
+		last = strtoul_or_err(*++argv, _("second argument"));
+
+	while (process_input(first, last))
+		;
+
 	fflush(stdout);
 	if (ferror(stdout) || fclose(stdout))
-		return 1;
-	return 0;
+		return EXIT_FAILURE;
+	return EXIT_SUCCESS;
 }
-- 
1.7.5.2


^ permalink raw reply related

* [PATCH 08/13] col: check with strtol_or_err option argument
From: Sami Kerola @ 2011-05-24 20:56 UTC (permalink / raw)
  To: util-linux; +Cc: kerolasa
In-Reply-To: <1306270604-6154-1-git-send-email-kerolasa@iki.fi>

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
---
 text-utils/Makefile.am |    2 ++
 text-utils/col.c       |    8 ++++++--
 2 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/text-utils/Makefile.am b/text-utils/Makefile.am
index 513f1c3..8700889 100644
--- a/text-utils/Makefile.am
+++ b/text-utils/Makefile.am
@@ -4,6 +4,8 @@ EXTRA_DIST = README.clear README.col
 
 usrbin_exec_PROGRAMS = col colcrt colrm column hexdump rev line tailf
 
+col_SOURCES = col.c $(top_srcdir)/lib/strutils.c
+
 hexdump_SOURCES = hexdump.c conv.c display.c hexsyntax.c parse.c \
 		  hexdump.h $(top_srcdir)/lib/strutils.c
 
diff --git a/text-utils/col.c b/text-utils/col.c
index 0740687..cdf0036 100644
--- a/text-utils/col.c
+++ b/text-utils/col.c
@@ -55,6 +55,7 @@
 #include "nls.h"
 #include "xalloc.h"
 #include "widechar.h"
+#include "strutils.h"
 
 #define	BS	'\b'		/* backspace */
 #define	TAB	'\t'		/* tab */
@@ -155,6 +156,7 @@ int main(int argc, char **argv)
 	int this_line;			/* line l points to */
 	int nflushd_lines;		/* number of lines that were flushed */
 	int adjust, opt, warned;
+	unsigned long tmplong;
 	int ret = EXIT_SUCCESS;
 
 	static const struct option longopts[] = {
@@ -189,8 +191,10 @@ int main(int argc, char **argv)
 			compress_spaces = 1;
 			break;
 		case 'l':		/* buffered line count */
-			if ((max_bufd_lines = atoi(optarg)) <= 0)
-				errx(EXIT_FAILURE, _("bad -l argument %s."), optarg);
+			tmplong = strtoul_or_err(optarg, _("bad -l argument"));
+			if ((INT_MAX / 2) < tmplong)
+				errx(EXIT_FAILURE, _("argument %lu is too large"), tmplong);
+			max_bufd_lines = (int) tmplong;
 			break;
 		case 'p':
 			pass_unknown_seqs = 1;
-- 
1.7.5.2


^ permalink raw reply related

* [PATCH 00/13]: text-utils fixes
From: Sami Kerola @ 2011-05-24 20:56 UTC (permalink / raw)
  To: util-linux; +Cc: kerolasa

Three first patches are warnign removals.

The col and colctr fixes are are mostly about getting --help &
--version to work, plus some coding style fixes, argument
checking etc trivial stuff.

Patch 9 is unusual. It removes all goto statements from colrm
which, I hope, makes the code more understandable. Due the
unusuality of the patch I made basic regression test.

All patches are available from github in branch text-utils.
git://github.com/kerolasa/lelux-utiliteetit.git


^ permalink raw reply


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