All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 00/13] pull: fixes in preparation to v2.23 release
@ 2013-04-02 19:42 Sami Kerola
  2013-04-02 19:42 ` [PATCH 01/13] docs: fix type in mkfs.8 Sami Kerola
                   ` (13 more replies)
  0 siblings, 14 replies; 16+ messages in thread
From: Sami Kerola @ 2013-04-02 19:42 UTC (permalink / raw)
  To: util-linux; +Cc: kerolasa

Hello Karel, and others.

While doing the bash-completion patches I ran many of the commands, and
found few inconveniences.  These fixes are an attempt to take care most
of them, and hopefully most, if not all, of them get merged before next
release is out.


The following changes since commit c7e76cd145b0c40e1d346203f3222f5937146939:

  lsblk: add --paths (2013-03-29 17:16:09 +0100)

are available in the git repository at:

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

for you to fetch changes up to 6329a948bdf6f2b12a6ec3caa568f5c71e7bbbfd:

  logger: make local sockets to try both stream and datagram (2013-04-02 20:28:51 +0100)

----------------------------------------------------------------
Sami Kerola (13):
      docs: fix type in mkfs.8
      newgrp: use xstrdup to check allocation succeeded
      agetty: add -h and -V options
      dmesg: fix usage() output consistancy
      fsfreeze: tell user when mandatory option is not specified
      losetup: allow -j option argument to be relative path
      lscpu: fix error message
      partx: remove deprecated option from usage()
      setarch: add option to list settable architectures
      setterm: fix various color option argument lists
      vipw: add usage() function
      chrt: make command syntax easier to understand in usage()
      logger: make local sockets to try both stream and datagram

 disk-utils/mkfs.8    |  1 -
 disk-utils/partx.c   |  1 -
 login-utils/newgrp.c |  3 ++-
 login-utils/vipw.c   | 23 +++++++++++++---
 misc-utils/logger.c  | 42 +++++++++++++++++------------
 schedutils/chrt.1    | 11 +++++---
 schedutils/chrt.c    |  4 +--
 sys-utils/dmesg.c    |  4 +--
 sys-utils/fsfreeze.c | 25 +++++++++++++-----
 sys-utils/losetup.c  | 13 ++++++---
 sys-utils/lscpu.c    |  2 +-
 sys-utils/setarch.8  |  3 +++
 sys-utils/setarch.c  | 18 ++++++++++---
 term-utils/agetty.c  |  5 ++--
 term-utils/setterm.c | 74 ++++++++++++++++++++++++++--------------------------
 15 files changed, 144 insertions(+), 85 deletions(-)



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

* [PATCH 01/13] docs: fix type in mkfs.8
  2013-04-02 19:42 [PATCH 00/13] pull: fixes in preparation to v2.23 release Sami Kerola
@ 2013-04-02 19:42 ` Sami Kerola
  2013-04-02 19:42 ` [PATCH 02/13] newgrp: use xstrdup to check allocation succeeded Sami Kerola
                   ` (12 subsequent siblings)
  13 siblings, 0 replies; 16+ messages in thread
From: Sami Kerola @ 2013-04-02 19:42 UTC (permalink / raw)
  To: util-linux; +Cc: kerolasa

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
---
 disk-utils/mkfs.8 | 1 -
 1 file changed, 1 deletion(-)

diff --git a/disk-utils/mkfs.8 b/disk-utils/mkfs.8
index a4cdf71..4bc45ff 100644
--- a/disk-utils/mkfs.8
+++ b/disk-utils/mkfs.8
@@ -3,7 +3,6 @@
 .SH NAME
 mkfs \- build a Linux filesystem
 .SH SYNOPSIS
-.SH SYNOPSIS
 .B mkfs
 .RI [ options ]
 .RB [ \-t
-- 
1.8.2


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

* [PATCH 02/13] newgrp: use xstrdup to check allocation succeeded
  2013-04-02 19:42 [PATCH 00/13] pull: fixes in preparation to v2.23 release Sami Kerola
  2013-04-02 19:42 ` [PATCH 01/13] docs: fix type in mkfs.8 Sami Kerola
@ 2013-04-02 19:42 ` Sami Kerola
  2013-04-02 19:42 ` [PATCH 03/13] agetty: the command does not have -h and -V options Sami Kerola
                   ` (11 subsequent siblings)
  13 siblings, 0 replies; 16+ messages in thread
From: Sami Kerola @ 2013-04-02 19:42 UTC (permalink / raw)
  To: util-linux; +Cc: kerolasa

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
---
 login-utils/newgrp.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/login-utils/newgrp.c b/login-utils/newgrp.c
index 6269547..55dad1b 100644
--- a/login-utils/newgrp.c
+++ b/login-utils/newgrp.c
@@ -32,6 +32,7 @@
 #include "closestream.h"
 #include "nls.h"
 #include "pathnames.h"
+#include "xalloc.h"
 
 /* try to read password from gshadow */
 static char *get_gshadow_pwd(char *groupname)
@@ -67,7 +68,7 @@ static char *get_gshadow_pwd(char *groupname)
 		}
 	}
 	fclose(f);
-	return pwd ? strdup(pwd) : NULL;
+	return pwd ? xstrdup(pwd) : NULL;
 }
 
 static int allow_setgid(struct passwd *pe, struct group *ge)
-- 
1.8.2


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

* [PATCH 03/13] agetty: the command does not have -h and -V options
  2013-04-02 19:42 [PATCH 00/13] pull: fixes in preparation to v2.23 release Sami Kerola
  2013-04-02 19:42 ` [PATCH 01/13] docs: fix type in mkfs.8 Sami Kerola
  2013-04-02 19:42 ` [PATCH 02/13] newgrp: use xstrdup to check allocation succeeded Sami Kerola
@ 2013-04-02 19:42 ` Sami Kerola
  2013-04-02 19:42 ` [PATCH 04/13] dmesg: fix usage() output consistancy Sami Kerola
                   ` (10 subsequent siblings)
  13 siblings, 0 replies; 16+ messages in thread
From: Sami Kerola @ 2013-04-02 19:42 UTC (permalink / raw)
  To: util-linux; +Cc: kerolasa

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
---
 term-utils/agetty.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/term-utils/agetty.c b/term-utils/agetty.c
index f745e68..311582c 100644
--- a/term-utils/agetty.c
+++ b/term-utils/agetty.c
@@ -1662,9 +1662,8 @@ static void __attribute__ ((__noreturn__)) usage(FILE *out)
 	fputs(_("     --long-hostname        show full qualified hostname\n"), out);
 	fputs(_("     --erase-chars <string> additional backspace chars\n"), out);
 	fputs(_("     --kill-chars <string>  additional kill chars\n"), out);
-	fputs(USAGE_SEPARATOR, out);
-	fputs(USAGE_HELP, out);
-	fputs(USAGE_VERSION, out);
+	fputs(_("     --help                 display this help and exit\n"), out);
+	fputs(_("     --version              output version information and exit\n"), out);
 	fprintf(out, USAGE_MAN_TAIL("agetty(8)"));
 
 	exit(out == stderr ? EXIT_FAILURE : EXIT_SUCCESS);
-- 
1.8.2


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

* [PATCH 04/13] dmesg: fix usage() output consistancy
  2013-04-02 19:42 [PATCH 00/13] pull: fixes in preparation to v2.23 release Sami Kerola
                   ` (2 preceding siblings ...)
  2013-04-02 19:42 ` [PATCH 03/13] agetty: the command does not have -h and -V options Sami Kerola
@ 2013-04-02 19:42 ` Sami Kerola
  2013-04-02 19:42 ` [PATCH 05/13] fsfreeze: tell user when mandatory option is not specified Sami Kerola
                   ` (9 subsequent siblings)
  13 siblings, 0 replies; 16+ messages in thread
From: Sami Kerola @ 2013-04-02 19:42 UTC (permalink / raw)
  To: util-linux; +Cc: kerolasa

Possible facilities and levels are meant to be printed to same file as
the rest of the usage output.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
---
 sys-utils/dmesg.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/sys-utils/dmesg.c b/sys-utils/dmesg.c
index 3387ea4..6c7f7ed 100644
--- a/sys-utils/dmesg.c
+++ b/sys-utils/dmesg.c
@@ -254,13 +254,13 @@ static void __attribute__((__noreturn__)) usage(FILE *out)
 	fputs(USAGE_VERSION, out);
 	fputs(_("\nSupported log facilities:\n"), out);
 	for (i = 0; i < ARRAY_SIZE(level_names); i++)
-		fprintf(stderr, " %7s - %s\n",
+		fprintf(out, " %7s - %s\n",
 			facility_names[i].name,
 			_(facility_names[i].help));
 
 	fputs(_("\nSupported log levels (priorities):\n"), out);
 	for (i = 0; i < ARRAY_SIZE(level_names); i++)
-		fprintf(stderr, " %7s - %s\n",
+		fprintf(out, " %7s - %s\n",
 			level_names[i].name,
 			_(level_names[i].help));
 	fputs(USAGE_SEPARATOR, out);
-- 
1.8.2


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

* [PATCH 05/13] fsfreeze: tell user when mandatory option is not specified
  2013-04-02 19:42 [PATCH 00/13] pull: fixes in preparation to v2.23 release Sami Kerola
                   ` (3 preceding siblings ...)
  2013-04-02 19:42 ` [PATCH 04/13] dmesg: fix usage() output consistancy Sami Kerola
@ 2013-04-02 19:42 ` Sami Kerola
  2013-04-02 19:42 ` [PATCH 06/13] losetup: allow -j option argument to be relative path Sami Kerola
                   ` (8 subsequent siblings)
  13 siblings, 0 replies; 16+ messages in thread
From: Sami Kerola @ 2013-04-02 19:42 UTC (permalink / raw)
  To: util-linux; +Cc: kerolasa

This commit also removes use of internal magic values by replacing them
with a enum definition.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
---
 sys-utils/fsfreeze.c | 25 ++++++++++++++++++-------
 1 file changed, 18 insertions(+), 7 deletions(-)

diff --git a/sys-utils/fsfreeze.c b/sys-utils/fsfreeze.c
index 122d95c..961f8c1 100644
--- a/sys-utils/fsfreeze.c
+++ b/sys-utils/fsfreeze.c
@@ -27,6 +27,12 @@
 #include "closestream.h"
 #include "optutils.h"
 
+enum fs_operation {
+	NOOP,
+	FREEZE,
+	UNFREEZE
+};
+
 static int freeze_f(int fd)
 {
 	return ioctl(fd, FIFREEZE, 0);
@@ -56,7 +62,7 @@ static void __attribute__((__noreturn__)) usage(FILE *out)
 int main(int argc, char **argv)
 {
 	int fd = -1, c;
-	int freeze = -1, rc = EXIT_FAILURE;
+	int action = NOOP, rc = EXIT_FAILURE;
 	char *path;
 	struct stat sb;
 
@@ -88,10 +94,10 @@ int main(int argc, char **argv)
 			usage(stdout);
 			break;
 		case 'f':
-			freeze = TRUE;
+			action = FREEZE;
 			break;
 		case 'u':
-			freeze = FALSE;
+			action = UNFREEZE;
 			break;
 		case 'V':
 			printf(UTIL_LINUX_VERSION);
@@ -102,8 +108,8 @@ int main(int argc, char **argv)
 		}
 	}
 
-	if (freeze == -1)
-		usage(stderr);
+	if (action == NOOP)
+		errx(EXIT_FAILURE, _("neither --freeze or --unfreeze specified"));
 	if (optind == argc)
 		errx(EXIT_FAILURE, _("no filename specified"));
 	path = argv[optind++];
@@ -127,16 +133,21 @@ int main(int argc, char **argv)
 		goto done;
 	}
 
-	if (freeze) {
+	switch (action) {
+	case FREEZE:
 		if (freeze_f(fd)) {
 			warn(_("%s: freeze failed"), path);
 			goto done;
 		}
-	} else {
+		break;
+	case UNFREEZE:
 		if (unfreeze_f(fd)) {
 			warn(_("%s: unfreeze failed"), path);
 			goto done;
 		}
+		break;
+	default:
+		abort();
 	}
 
 	rc = EXIT_SUCCESS;
-- 
1.8.2


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

* [PATCH 06/13] losetup: allow -j option argument to be relative path
  2013-04-02 19:42 [PATCH 00/13] pull: fixes in preparation to v2.23 release Sami Kerola
                   ` (4 preceding siblings ...)
  2013-04-02 19:42 ` [PATCH 05/13] fsfreeze: tell user when mandatory option is not specified Sami Kerola
@ 2013-04-02 19:42 ` Sami Kerola
  2013-04-02 19:42 ` [PATCH 07/13] lscpu: fix error message Sami Kerola
                   ` (7 subsequent siblings)
  13 siblings, 0 replies; 16+ messages in thread
From: Sami Kerola @ 2013-04-02 19:42 UTC (permalink / raw)
  To: util-linux; +Cc: kerolasa

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
---
 sys-utils/losetup.c | 13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)

diff --git a/sys-utils/losetup.c b/sys-utils/losetup.c
index 45e46c8..8f3614e 100644
--- a/sys-utils/losetup.c
+++ b/sys-utils/losetup.c
@@ -23,6 +23,7 @@
 #include "closestream.h"
 #include "optutils.h"
 #include "xalloc.h"
+#include "canonicalize.h"
 
 enum {
 	A_CREATE = 1,		/* setup a new device */
@@ -167,9 +168,15 @@ static int show_all_loops(struct loopdev_cxt *lc, const char *file,
 		st = NULL;
 
 	while (loopcxt_next(lc) == 0) {
-
-		if (file && !loopcxt_is_used(lc, st, file, offset, flags))
-			continue;
+		if (file && !loopcxt_is_used(lc, st, file, offset, flags)) {
+			char *canonized;
+			int ret;
+			canonized = canonicalize_path(file);
+			ret = loopcxt_is_used(lc, st, canonized, offset, flags);
+			free(canonized);
+			if (!ret)
+				continue;
+		}
 		printf_loopdev(lc);
 	}
 	loopcxt_deinit_iterator(lc);
-- 
1.8.2


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

* [PATCH 07/13] lscpu: fix error message
  2013-04-02 19:42 [PATCH 00/13] pull: fixes in preparation to v2.23 release Sami Kerola
                   ` (5 preceding siblings ...)
  2013-04-02 19:42 ` [PATCH 06/13] losetup: allow -j option argument to be relative path Sami Kerola
@ 2013-04-02 19:42 ` Sami Kerola
  2013-04-02 19:42 ` [PATCH 08/13] partx: remove deprecated option from usage() Sami Kerola
                   ` (6 subsequent siblings)
  13 siblings, 0 replies; 16+ messages in thread
From: Sami Kerola @ 2013-04-02 19:42 UTC (permalink / raw)
  To: util-linux; +Cc: kerolasa

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

diff --git a/sys-utils/lscpu.c b/sys-utils/lscpu.c
index 46f9e35..e90e8f5 100644
--- a/sys-utils/lscpu.c
+++ b/sys-utils/lscpu.c
@@ -1357,7 +1357,7 @@ int main(int argc, char *argv[])
 	if (cpu_modifier_specified && mod->mode == OUTPUT_SUMMARY) {
 		fprintf(stderr,
 			_("%s: options --all, --online and --offline may only "
-			  "be used with options --extended or --parsable.\n"),
+			  "be used with options --extended or --parse.\n"),
 			program_invocation_short_name);
 		return EXIT_FAILURE;
 	}
-- 
1.8.2


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

* [PATCH 08/13] partx: remove deprecated option from usage()
  2013-04-02 19:42 [PATCH 00/13] pull: fixes in preparation to v2.23 release Sami Kerola
                   ` (6 preceding siblings ...)
  2013-04-02 19:42 ` [PATCH 07/13] lscpu: fix error message Sami Kerola
@ 2013-04-02 19:42 ` Sami Kerola
  2013-04-02 19:42 ` [PATCH 09/13] setarch: add option to list settable architectures Sami Kerola
                   ` (5 subsequent siblings)
  13 siblings, 0 replies; 16+ messages in thread
From: Sami Kerola @ 2013-04-02 19:42 UTC (permalink / raw)
  To: util-linux; +Cc: kerolasa

The fact that -l, --list is deprecated will remain in manual page till
unforeseeable future.  Meanwhile the usage() can be made shorter.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
---
 disk-utils/partx.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/disk-utils/partx.c b/disk-utils/partx.c
index 9fa9587..49ef1dc 100644
--- a/disk-utils/partx.c
+++ b/disk-utils/partx.c
@@ -706,7 +706,6 @@ static void __attribute__((__noreturn__)) usage(FILE *out)
 	fputs(USAGE_OPTIONS, out);
 	fputs(_(" -a, --add            add specified partitions or all of them\n"), out);
 	fputs(_(" -d, --delete         delete specified partitions or all of them\n"), out);
-	fputs(_(" -l, --list           list partitions (DEPRECATED)\n"), out);
 	fputs(_(" -s, --show           list partitions\n\n"), out);
 	fputs(_(" -u, --update         update specified partitions or all of them\n"), out);
 	fputs(_(" -b, --bytes          print SIZE in bytes rather than in human readable format\n"), out);
-- 
1.8.2


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

* [PATCH 09/13] setarch: add option to list settable architectures
  2013-04-02 19:42 [PATCH 00/13] pull: fixes in preparation to v2.23 release Sami Kerola
                   ` (7 preceding siblings ...)
  2013-04-02 19:42 ` [PATCH 08/13] partx: remove deprecated option from usage() Sami Kerola
@ 2013-04-02 19:42 ` Sami Kerola
  2013-04-05 12:04   ` Karel Zak
  2013-04-02 19:42 ` [PATCH 10/13] setterm: fix various color option argument lists Sami Kerola
                   ` (4 subsequent siblings)
  13 siblings, 1 reply; 16+ messages in thread
From: Sami Kerola @ 2013-04-02 19:42 UTC (permalink / raw)
  To: util-linux; +Cc: kerolasa

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
---
 sys-utils/setarch.8 |  3 +++
 sys-utils/setarch.c | 18 +++++++++++++++---
 2 files changed, 18 insertions(+), 3 deletions(-)

diff --git a/sys-utils/setarch.8 b/sys-utils/setarch.8
index d206f2c..c5a5368 100644
--- a/sys-utils/setarch.8
+++ b/sys-utils/setarch.8
@@ -35,6 +35,9 @@ Output version information and exit.
 .I "\-\-uname\-2.6"
 Causes the program to see a kernel version number beginning with 2.6.
 .TP
+.I "\-\-list"
+List architectures that can be set.
+.TP
 .I "\-3," "\-\-3gb"
 Specifies that processes should use a maximum of 3GB of address space on systems where it is supported (ADDR_LIMIT_3GB).
 .TP
diff --git a/sys-utils/setarch.c b/sys-utils/setarch.c
index afa2d1b..f6c0e20 100644
--- a/sys-utils/setarch.c
+++ b/sys-utils/setarch.c
@@ -110,6 +110,8 @@ show_help(void)
    " -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"));
 
   printf(USAGE_SEPARATOR);
   printf(USAGE_HELP);
@@ -136,7 +138,7 @@ show_version(void)
 }
 
 static int
-set_arch(const char *pers, unsigned long options)
+set_arch(const char *pers, unsigned long options, int list)
 {
   struct utsname un;
   int i;
@@ -198,6 +200,12 @@ set_arch(const char *pers, unsigned long options)
     {-1, NULL, NULL}
   };
 
+  if (list) {
+    for(i = 0; transitions[i].target_arch != NULL; i++)
+      printf("%s\n", transitions[i].target_arch);
+    return 0;
+  }
+
   for(i = 0; transitions[i].perval >= 0; i++)
       if(!strcmp(pers, transitions[i].target_arch))
 	break;
@@ -273,10 +281,14 @@ int main(int argc, char *argv[])
       show_help();
     else if (!strcmp(p, "-V") || !strcmp(p, "--version"))
       show_version();
+    else if (!strcmp(p, "--list")) {
+      set_arch(argv[0], 0L, 1);
+      return EXIT_SUCCESS;
+    }
   }
   #if defined(__sparc64__) || defined(__sparc__)
    if (!strcmp(p, "sparc32bash")) {
-       if (set_arch(p, 0L))
+       if (set_arch(p, 0L, 0))
            err(EXIT_FAILURE, _("Failed to set personality to %s"), p);
        execl("/bin/bash", NULL);
        err(EXIT_FAILURE, _("failed to execute %s"), "/bin/bash");
@@ -337,7 +349,7 @@ int main(int argc, char *argv[])
   argc -= optind;
   argv += optind;
 
-  if (set_arch(p, options))
+  if (set_arch(p, options, 0))
     err(EXIT_FAILURE, _("Failed to set personality to %s"), p);
 
   if (!argc) {
-- 
1.8.2


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

* [PATCH 10/13] setterm: fix various color option argument lists
  2013-04-02 19:42 [PATCH 00/13] pull: fixes in preparation to v2.23 release Sami Kerola
                   ` (8 preceding siblings ...)
  2013-04-02 19:42 ` [PATCH 09/13] setarch: add option to list settable architectures Sami Kerola
@ 2013-04-02 19:42 ` Sami Kerola
  2013-04-02 19:42 ` [PATCH 11/13] vipw: add usage() function Sami Kerola
                   ` (3 subsequent siblings)
  13 siblings, 0 replies; 16+ messages in thread
From: Sami Kerola @ 2013-04-02 19:42 UTC (permalink / raw)
  To: util-linux; +Cc: kerolasa

The lists did not have correct colors in usage().  Because the usage()
had to be fixed, it is best to make the output easy for translators to
work with.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
---
 term-utils/setterm.c | 74 ++++++++++++++++++++++++++--------------------------
 1 file changed, 37 insertions(+), 37 deletions(-)

diff --git a/term-utils/setterm.c b/term-utils/setterm.c
index 0e72cf0..310c3fa 100644
--- a/term-utils/setterm.c
+++ b/term-utils/setterm.c
@@ -678,43 +678,43 @@ usage(FILE *out) {
 	      _(" %s [options]\n"), program_invocation_short_name);
 
 	fputs(_("\nOptions:\n"), out);
-	fputs(_(" -term <terminal_name>\n"
-		" -reset\n"
-		" -initialize\n"
-		" -cursor <on|off>\n"
-		" -repeat <on|off>\n"
-		" -appcursorkeys <on|off>\n"
-		" -linewrap <on|off>\n"
-		" -default\n"
-		" -foreground <black|blue|green|cyan|red|magenta|yellow|white|default>\n"
-		" -background <black|blue|green|cyan|red|magenta|yellow|white|default>\n"
-		" -ulcolor <black|grey|blue|green|cyan|red|magenta|yellow|white>\n"
-		" -ulcolor <bright blue|green|cyan|red|magenta|yellow|white>\n"
-		" -hbcolor <black|grey|blue|green|cyan|red|magenta|yellow|white>\n"
-		" -hbcolor <bright blue|green|cyan|red|magenta|yellow|white>\n"
-		" -inversescreen <on|off>\n"
-		" -bold <on|off>\n"
-		" -half-bright <on|off>\n"
-		" -blink <on|off>\n"
-		" -reverse <on|off>\n"
-		" -underline <on|off>\n"
-		" -store >\n"
-		" -clear <all|rest>\n"
-		" -tabs < tab1 tab2 tab3 ... >      (tabn = 1-160)\n"
-		" -clrtabs < tab1 tab2 tab3 ... >   (tabn = 1-160)\n"
-		" -regtabs <1-160>\n"
-		" -blank <0-60|force|poke>\n"
-		" -dump   <1-NR_CONSOLES>\n"
-		" -append <1-NR_CONSOLES>\n"
-		" -file dumpfilename\n"
-		" -msg <on|off>\n"
-		" -msglevel <0-8>\n"
-		" -powersave <on|vsync|hsync|powerdown|off>\n"
-		" -powerdown <0-60>\n"
-		" -blength <0-2000>\n"
-		" -bfreq freqnumber\n"
-		" -version\n"
-		" -help\n"), out);
+	fputs(_(" -term <terminal_name>\n"), out);
+	fputs(_(" -reset\n"), out);
+	fputs(_(" -initialize\n"), out);
+	fputs(_(" -cursor <on|off>\n"), out);
+	fputs(_(" -repeat <on|off>\n"), out);
+	fputs(_(" -appcursorkeys <on|off>\n"), out);
+	fputs(_(" -linewrap <on|off>\n"), out);
+	fputs(_(" -default\n"), out);
+	fputs(_(" -foreground <default|black|blue|cyan|green|magenta|red|white|yellow>\n"), out);
+	fputs(_(" -background <default|black|blue|cyan|green|magenta|red|white|yellow>\n"), out);
+	fputs(_(" -ulcolor <black|blue|bright|cyan|green|grey|magenta|red|white|yellow>\n"), out);
+	fputs(_(" -ulcolor <black|blue|bright|cyan|green|grey|magenta|red|white|yellow>\n"), out);
+	fputs(_(" -hbcolor <black|blue|bright|cyan|green|grey|magenta|red|white|yellow>\n"), out);
+	fputs(_(" -hbcolor <black|blue|bright|cyan|green|grey|magenta|red|white|yellow>\n"), out);
+	fputs(_(" -inversescreen <on|off>\n"), out);
+	fputs(_(" -bold <on|off>\n"), out);
+	fputs(_(" -half-bright <on|off>\n"), out);
+	fputs(_(" -blink <on|off>\n"), out);
+	fputs(_(" -reverse <on|off>\n"), out);
+	fputs(_(" -underline <on|off>\n"), out);
+	fputs(_(" -store\n"), out);
+	fputs(_(" -clear <all|rest>\n"), out);
+	fputs(_(" -tabs <tab1 tab2 tab3 ...>      (tabn = 1-160)\n"), out);
+	fputs(_(" -clrtabs <tab1 tab2 tab3 ...>   (tabn = 1-160)\n"), out);
+	fputs(_(" -regtabs <1-160>\n"), out);
+	fputs(_(" -blank <0-60|force|poke>\n"), out);
+	fputs(_(" -dump   <1-NR_CONSOLES>\n"), out);
+	fputs(_(" -append <1-NR_CONSOLES>\n"), out);
+	fputs(_(" -file dumpfilename\n"), out);
+	fputs(_(" -msg <on|off>\n"), out);
+	fputs(_(" -msglevel <0-8>\n"), out);
+	fputs(_(" -powersave <on|vsync|hsync|powerdown|off>\n"), out);
+	fputs(_(" -powerdown <0-60>\n"), out);
+	fputs(_(" -blength <0-2000>\n"), out);
+	fputs(_(" -bfreq freqnumber\n"), out);
+	fputs(_(" -version\n"), out);
+	fputs(_(" -help\n"), out);
 
 	fprintf(out, USAGE_MAN_TAIL("setterm(1)"));
 
-- 
1.8.2


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

* [PATCH 11/13] vipw: add usage() function
  2013-04-02 19:42 [PATCH 00/13] pull: fixes in preparation to v2.23 release Sami Kerola
                   ` (9 preceding siblings ...)
  2013-04-02 19:42 ` [PATCH 10/13] setterm: fix various color option argument lists Sami Kerola
@ 2013-04-02 19:42 ` Sami Kerola
  2013-04-02 19:42 ` [PATCH 12/13] chrt: make command syntax easier to understand in usage() Sami Kerola
                   ` (2 subsequent siblings)
  13 siblings, 0 replies; 16+ messages in thread
From: Sami Kerola @ 2013-04-02 19:42 UTC (permalink / raw)
  To: util-linux; +Cc: kerolasa

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
---
 login-utils/vipw.c | 23 +++++++++++++++++++----
 1 file changed, 19 insertions(+), 4 deletions(-)

diff --git a/login-utils/vipw.c b/login-utils/vipw.c
index 8c47801..6ca5f8c 100644
--- a/login-utils/vipw.c
+++ b/login-utils/vipw.c
@@ -302,6 +302,17 @@ static void edit_file(int is_shadow)
 	ulckpwdf();
 }
 
+static void __attribute__((__noreturn__)) usage(FILE *out)
+{
+	fputs(USAGE_HEADER, out);
+	fprintf(out, " %s\n", program_invocation_short_name);
+	fputs(USAGE_OPTIONS, out);
+	fputs(USAGE_HELP, out);
+	fputs(USAGE_VERSION, out);
+	fprintf(out, USAGE_MAN_TAIL("vipw(8)"));
+	exit(out == stderr ? EXIT_FAILURE : EXIT_SUCCESS);
+}
+
 int main(int argc, char *argv[])
 {
 	setlocale(LC_ALL, "");
@@ -317,10 +328,14 @@ int main(int argc, char *argv[])
 		xstrncpy(orig_file, PASSWD_FILE, sizeof(orig_file));
 	}
 
-	if ((argc > 1) &&
-	    (!strcmp(argv[1], "-V") || !strcmp(argv[1], "--version"))) {
-		printf(UTIL_LINUX_VERSION);
-		exit(EXIT_SUCCESS);
+	if (1 < argc) {
+		if (!strcmp(argv[1], "-V") || !strcmp(argv[1], "--version")) {
+			printf(UTIL_LINUX_VERSION);
+			exit(EXIT_SUCCESS);
+		}
+		if (!strcmp(argv[1], "-h") || !strcmp(argv[1], "--help"))
+			usage(stdout);
+		usage(stderr);
 	}
 
 	edit_file(0);
-- 
1.8.2


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

* [PATCH 12/13] chrt: make command syntax easier to understand in usage()
  2013-04-02 19:42 [PATCH 00/13] pull: fixes in preparation to v2.23 release Sami Kerola
                   ` (10 preceding siblings ...)
  2013-04-02 19:42 ` [PATCH 11/13] vipw: add usage() function Sami Kerola
@ 2013-04-02 19:42 ` Sami Kerola
  2013-04-02 19:42 ` [PATCH 13/13] logger: make local sockets to try both stream and datagram Sami Kerola
  2013-04-05 12:10 ` [PATCH 00/13] pull: fixes in preparation to v2.23 release Karel Zak
  13 siblings, 0 replies; 16+ messages in thread
From: Sami Kerola @ 2013-04-02 19:42 UTC (permalink / raw)
  To: util-linux; +Cc: kerolasa

And mention in manual that the default is referring to the internal
default of this command, not the Linux system default.  Manual page
example also tries to be a little more complete how to use the command.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
---
 schedutils/chrt.1 | 11 ++++++++---
 schedutils/chrt.c |  4 ++--
 2 files changed, 10 insertions(+), 5 deletions(-)

diff --git a/schedutils/chrt.1 b/schedutils/chrt.1
index b85717b..50aa841 100644
--- a/schedutils/chrt.1
+++ b/schedutils/chrt.1
@@ -91,8 +91,10 @@ Operate on an existing PID and do not launch a new task.
 .TP
 .B -r, --rr
 Set scheduling policy to
-.BR SCHED_RR
-(the default).
+.BR SCHED_RR .
+When policy is not defined the
+.B SCHED_RR
+is used as default.
 .TP
 .B -R, --reset-on-fork
 Add
@@ -123,7 +125,7 @@ You can also retrieve the real-time attributes of an existing task:
 .I pid
 .TP
 Or set them:
-.B chrt \-p
+.B chrt \-r \-p
 .I prio pid
 .SH PERMISSIONS
 A user must possess
@@ -138,6 +140,9 @@ and
 .BR SCHED_RR
 are part of POSIX 1003.1b Process Scheduling. The other scheduling attributes
 may be ignored on some systems.
+.P
+Linux default scheduling policy is
+.BR SCHED_OTHER .
 .SH AUTHOR
 Written by Robert M. Love.
 .SH COPYRIGHT
diff --git a/schedutils/chrt.c b/schedutils/chrt.c
index 60ec73e..20df6fa 100644
--- a/schedutils/chrt.c
+++ b/schedutils/chrt.c
@@ -62,9 +62,9 @@ static void __attribute__((__noreturn__)) show_usage(int rc)
 	fprintf(out, _(
 	"\nchrt - manipulate real-time attributes of a process\n"
 	"\nSet policy:\n"
-	"  chrt [options] <policy> <priority> {<pid> | <command> [<arg> ...]}\n"
+	"  chrt [options] [-policy] <priority> [-p <pid> | <command> <arg> ...]\n"
 	"\nGet policy:\n"
-	"  chrt [options] {<pid> | <command> [<arg> ...]}\n"));
+	"  chrt [options] -p <pid>\n"));
 
 	fprintf(out, _(
 	"\nScheduling policies:\n"
-- 
1.8.2


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

* [PATCH 13/13] logger: make local sockets to try both stream and datagram
  2013-04-02 19:42 [PATCH 00/13] pull: fixes in preparation to v2.23 release Sami Kerola
                   ` (11 preceding siblings ...)
  2013-04-02 19:42 ` [PATCH 12/13] chrt: make command syntax easier to understand in usage() Sami Kerola
@ 2013-04-02 19:42 ` Sami Kerola
  2013-04-05 12:10 ` [PATCH 00/13] pull: fixes in preparation to v2.23 release Karel Zak
  13 siblings, 0 replies; 16+ messages in thread
From: Sami Kerola @ 2013-04-02 19:42 UTC (permalink / raw)
  To: util-linux; +Cc: kerolasa, Karel Zak

When journald, from systemd, is in use logger gave following error.

$ logger --socket /dev/log test logger: connect /dev/log: Protocol wrong
type for socket

The journald supports only AF_DGRAM, and nothing else.  Support for
AF_STREAM sockets was dropped because it messed up message ordering.

>From an users point of view necessity to add --udp (UNIX(TM) Datagram
Protocol?) option when talking to syslog via unix socket felt confusing
and wrong.  The command should know what is the socket type, and silently
use the correct one, unless the type is explicitely defined.

CC: Karel Zak <kzak@redhat.com>
Adviced-by: Lennart Poettering <lennart@poettering.net>
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
---
 misc-utils/logger.c | 42 +++++++++++++++++++++++++-----------------
 1 file changed, 25 insertions(+), 17 deletions(-)

diff --git a/misc-utils/logger.c b/misc-utils/logger.c
index 30e8fa4..a6fafc1 100644
--- a/misc-utils/logger.c
+++ b/misc-utils/logger.c
@@ -58,8 +58,6 @@
 #define	SYSLOG_NAMES
 #include <syslog.h>
 
-static int optd = 0;
-
 static int decode(char *name, CODE *codetab)
 {
 	register CODE *c;
@@ -98,23 +96,33 @@ static int pencode(char *s)
 }
 
 static int
-myopenlog(const char *sock) {
-       int fd;
-       static struct sockaddr_un s_addr; /* AF_UNIX address of local logger */
-
-       if (strlen(sock) >= sizeof(s_addr.sun_path))
-	       errx(EXIT_FAILURE, _("openlog %s: pathname too long"), sock);
+myopenlog(const char *sock, int optd)
+{
+	int fd;
+	static struct sockaddr_un s_addr;	/* AF_UNIX address of local logger */
 
-       s_addr.sun_family = AF_UNIX;
-       (void)strcpy(s_addr.sun_path, sock);
+	if (strlen(sock) >= sizeof(s_addr.sun_path))
+		errx(EXIT_FAILURE, _("openlog %s: pathname too long"), sock);
 
-       if ((fd = socket(AF_UNIX, optd ? SOCK_DGRAM : SOCK_STREAM, 0)) == -1)
-	       err(EXIT_FAILURE, _("socket %s"), sock);
+	s_addr.sun_family = AF_UNIX;
+	(void)strcpy(s_addr.sun_path, sock);
 
-       if (connect(fd, (struct sockaddr *) &s_addr, sizeof(s_addr)) == -1)
-	       err(EXIT_FAILURE, _("connect %s"), sock);
+	if (optd == 0) {
+		if ((fd = socket(AF_UNIX, SOCK_STREAM, 0)) == -1)
+			goto udp_socket;
+		if (connect(fd, (struct sockaddr *)&s_addr, sizeof(s_addr)) == -1) {
+			close(fd);
+			goto udp_socket;
+		}
+	} else {
+ udp_socket:
+		if ((fd = socket(AF_UNIX, SOCK_DGRAM, 0)) == -1)
+			err(EXIT_FAILURE, _("socket %s"), sock);
+		if (connect(fd, (struct sockaddr *)&s_addr, sizeof(s_addr)) == -1)
+			err(EXIT_FAILURE, _("connect %s"), sock);
+	}
 
-       return fd;
+	return fd;
 }
 
 static int
@@ -202,7 +210,7 @@ main(int argc, char **argv) {
 	char *usock = NULL;
 	char *udpserver = NULL;
 	char *udpport = NULL;
-	int LogSock = -1;
+	int LogSock = -1, optd = 0;
 
 	static const struct option longopts[] = {
 		{ "id",		no_argument,	    0, 'i' },
@@ -279,7 +287,7 @@ main(int argc, char **argv) {
 	else if (udpserver)
 		LogSock = udpopenlog(udpserver,udpport);
 	else
-		LogSock = myopenlog(usock);
+		LogSock = myopenlog(usock, optd);
 
 	/* log input line if appropriate */
 	if (argc > 0) {
-- 
1.8.2


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

* Re: [PATCH 09/13] setarch: add option to list settable architectures
  2013-04-02 19:42 ` [PATCH 09/13] setarch: add option to list settable architectures Sami Kerola
@ 2013-04-05 12:04   ` Karel Zak
  0 siblings, 0 replies; 16+ messages in thread
From: Karel Zak @ 2013-04-05 12:04 UTC (permalink / raw)
  To: Sami Kerola; +Cc: util-linux

On Tue, Apr 02, 2013 at 08:42:53PM +0100, Sami Kerola wrote:
>  sys-utils/setarch.8 |  3 +++
>  sys-utils/setarch.c | 18 +++++++++++++++---
>  2 files changed, 18 insertions(+), 3 deletions(-)

 Applied, thanks.

> @@ -110,6 +110,8 @@ show_help(void)
>     " -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"));
>  
>    printf(USAGE_SEPARATOR);
>    printf(USAGE_HELP);
> @@ -136,7 +138,7 @@ show_version(void)
>  }

 It would be nice to cleanup the usage() for 2.24 release.

    Karel

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

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

* Re: [PATCH 00/13] pull: fixes in preparation to v2.23 release
  2013-04-02 19:42 [PATCH 00/13] pull: fixes in preparation to v2.23 release Sami Kerola
                   ` (12 preceding siblings ...)
  2013-04-02 19:42 ` [PATCH 13/13] logger: make local sockets to try both stream and datagram Sami Kerola
@ 2013-04-05 12:10 ` Karel Zak
  13 siblings, 0 replies; 16+ messages in thread
From: Karel Zak @ 2013-04-05 12:10 UTC (permalink / raw)
  To: Sami Kerola; +Cc: util-linux

On Tue, Apr 02, 2013 at 08:42:44PM +0100, Sami Kerola wrote:
>       docs: fix type in mkfs.8

 already fixed

>       newgrp: use xstrdup to check allocation succeeded
>       agetty: add -h and -V options
>       dmesg: fix usage() output consistancy
>       fsfreeze: tell user when mandatory option is not specified
>       losetup: allow -j option argument to be relative path
>       lscpu: fix error message
>       partx: remove deprecated option from usage()
>       setarch: add option to list settable architectures
>       setterm: fix various color option argument lists
>       vipw: add usage() function
>       chrt: make command syntax easier to understand in usage()
>       logger: make local sockets to try both stream and datagram

 all applied, thanks!

    Karel

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

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

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

Thread overview: 16+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-04-02 19:42 [PATCH 00/13] pull: fixes in preparation to v2.23 release Sami Kerola
2013-04-02 19:42 ` [PATCH 01/13] docs: fix type in mkfs.8 Sami Kerola
2013-04-02 19:42 ` [PATCH 02/13] newgrp: use xstrdup to check allocation succeeded Sami Kerola
2013-04-02 19:42 ` [PATCH 03/13] agetty: the command does not have -h and -V options Sami Kerola
2013-04-02 19:42 ` [PATCH 04/13] dmesg: fix usage() output consistancy Sami Kerola
2013-04-02 19:42 ` [PATCH 05/13] fsfreeze: tell user when mandatory option is not specified Sami Kerola
2013-04-02 19:42 ` [PATCH 06/13] losetup: allow -j option argument to be relative path Sami Kerola
2013-04-02 19:42 ` [PATCH 07/13] lscpu: fix error message Sami Kerola
2013-04-02 19:42 ` [PATCH 08/13] partx: remove deprecated option from usage() Sami Kerola
2013-04-02 19:42 ` [PATCH 09/13] setarch: add option to list settable architectures Sami Kerola
2013-04-05 12:04   ` Karel Zak
2013-04-02 19:42 ` [PATCH 10/13] setterm: fix various color option argument lists Sami Kerola
2013-04-02 19:42 ` [PATCH 11/13] vipw: add usage() function Sami Kerola
2013-04-02 19:42 ` [PATCH 12/13] chrt: make command syntax easier to understand in usage() Sami Kerola
2013-04-02 19:42 ` [PATCH 13/13] logger: make local sockets to try both stream and datagram Sami Kerola
2013-04-05 12:10 ` [PATCH 00/13] pull: fixes in preparation to v2.23 release Karel Zak

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.