Commit Graph

986 Commits

Author SHA1 Message Date
Sami Kerola a587cc5520 textual: use manual tail usage() macro
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2014-10-01 12:33:24 +02:00
Andreas Henriksson 5ec85227ad logger: gettimeofday needs <sys/time.h>
Either works on linux, but kfreebsd build fails
if we don't use the <sys/time.h> include.

According to man gettimeofday the correct include is <sys/time.h>

Signed-off-by: Andreas Henriksson <andreas@fatal.se>
2014-09-22 12:54:11 +02:00
Eugene Yunak d106c83b19 cal: `color` option documentation should match actual behaviour 2014-09-21 15:51:57 +03:00
Karel Zak 3c2e64b0ca lsblk: add notes about udev to the man page
Reported-by: Francis Moreau <francis.moro@gmail.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
2014-09-05 10:02:45 +02:00
Karel Zak 59c6ac0b92 logger: use generic --id=<id>
Signed-off-by: Karel Zak <kzak@redhat.com>
2014-08-20 12:24:40 +02:00
Sami Kerola b09697c3e0 docs: mentintion default udp and tcp ports logger is using
The fact that 'syslog tcp/514' does not exist in RFS's, which has lead
to 'syslog-conn 601/tcp' be used in place could be a suprice and should
be told in manual.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2014-08-15 21:52:12 +01:00
Sami Kerola 46ee14df66 logger: set function arguments read-only when possible
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2014-08-15 21:52:12 +01:00
Sami Kerola 77c3bd5bf6 logger: optimize string initializations
Setting whole array to be completely full of nulls cannot be as quick as
making the only significant member of the array when needed.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2014-08-15 21:52:12 +01:00
Sami Kerola 35d3619793 logger: remove openlog(3) options
One variable less, and more importantly bit operations become unnecessary
in if statements.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2014-08-15 21:52:12 +01:00
Sami Kerola 1d57503378 logger: allow use of --id=ppid when logging locally
There is no obvious way to make syslog(3) to print both pid or ppid, so
duplicate the libc syslog() to logger.  Making the ppid printing work
using unix socket has side effect of local becoming capable to use both
rfc format output, which is hopefully seen as good thing.  The
syslog_local() is format wise one-to-one copy with glibc syslog(3)
format.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2014-08-15 21:52:12 +01:00
Benno Schulenberg 1d23119072 textual: remove some inconsistent periods from error messages
While doing so, also improve translatability and some wordings.

Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
2014-08-11 14:51:54 +02:00
Benno Schulenberg ae4cc2adea docs: sort the options in the man pages of hwclock and uuidd
Also improve the formatting a bit.

Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
2014-07-29 12:14:56 +02:00
Karel Zak 7eec45f2d8 logger: fix untranslated message
Signed-off-by: Karel Zak <kzak@redhat.com>
2014-07-29 12:13:24 +02:00
Karel Zak 1042ce18df logger: require --{server,socket} to remote rfc542/rfc3164 log
Signed-off-by: Karel Zak <kzak@redhat.com>
2014-07-29 12:08:47 +02:00
Karel Zak e598686d3c logger: fix -i=ppid
For short options (-i) the optional argument contains '='.

Signed-off-by: Karel Zak <kzak@redhat.com>
2014-07-29 11:49:00 +02:00
Karel Zak 852feb7299 logger: clean up strings usage
- use allocated buffers to compose the final messages

 - initialize static buffers to zero

 - remove strlen-after-sprintf

Signed-off-by: Karel Zak <kzak@redhat.com>
2014-07-29 11:43:01 +02:00
Sami Kerola 133bf77bc2 logger: add hostname to rfc3164 message
This makes the obsolete protocol a little bit more compliant with the
internet standard, but few should care now when we have rfc5424 support,
and rfc3164 feels broken.  For example it requires hostname to be not
fully qualified, which is hard to understand, and should make users to
prefer the new protocol.

Reported-by: Frank Thilo <thilo@unix-ag.org>
Bug-Debian: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=705217
CC: Andreas Henriksson <andreas@fatal.se>
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2014-07-28 21:15:18 +01:00
Sami Kerola 3d9f4b1d23 logger: warn when --file and command line message are combined
When --file is combined with command line arguments the later has
silently been ignored.  This commit makes user to be aware the logger
will not use command line arguments when --file is specified.

Reported-by: "Daniel 'DaB.' Baur" <debian@daniel.baur4.info>
Bug-Debian: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=467244
CC: Andreas Henriksson <andreas@fatal.se>
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2014-07-28 21:15:18 +01:00
Sami Kerola 2e0fd22d5d logger: improve readablity of pencode() function
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2014-07-28 21:15:18 +01:00
Sami Kerola 4288f9f12c logger: make --stderr print remote server messages
Users wish to see the message should include also remote messages, not
only the one sent to locally via libc function.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2014-07-28 21:15:18 +01:00
Sami Kerola aab5b44405 logger: add process --id=parent optional argument
When scripts send several messages they will be easier to group together
when parent process id is printed rather than id of the each logger
process.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2014-07-28 21:15:18 +01:00
Sami Kerola d9b38f6baf docs: add logger protocol notes to manual page
Inform about rfc5424 support, how to control what it includes to
submission, and that it is the new default when sending syslog messages
to remote server without specifying protocol.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2014-07-28 21:15:17 +01:00
Sami Kerola 4de2e8a038 logger: add rfc5424 support
Add support the more recent syslog protocol and make it default.  The
older BSD syslog protocol can still be used with option --rfc3164.
Protocols are meaningful only when messages are sent to remote syslog
server.

Requested-by: Kodiak Firesmith <ksf@sei.cmu.edu>
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2014-07-28 21:15:17 +01:00
Sami Kerola c68a1cb490 logger: tidy up main() by adding small functions and ctl data
Add logger_open(), logger_command_line(), logger_stdin(), and
logger_close() functions, and move all remaining option argument
assignments to control structure.

Proposed-by: Karel Zak <kzak@redhat.com>
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2014-07-28 21:15:17 +01:00
Sami Kerola cfa77d2643 logger: add function pointer to choose how logging is done
This change paves way to adding support for both RFC 3164 and RFC 5424
syslog protocols.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2014-07-28 21:15:17 +01:00
Sami Kerola 4c3ac8fe52 docs: make logger.1 facilities and levels easier to read
Most people read vertical list a lot quicker than horizontal.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2014-07-28 21:15:17 +01:00
Sami Kerola c462a8caf2 logger: refactor long if clause
When if clause that continues throughout whole function it usually can be
shorten to immediate action, e.g., in this case return on the spot not at
end of the function.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2014-07-28 21:15:17 +01:00
Sami Kerola 019b97024f logger: do not rely only getlogin(3) telling who ran the command
The getlogin(3) is known not to always work, and when that happens it is
reasonable to try determine user of name by looking process owner and
passwd information.

Reference: http://man7.org/linux/man-pages/man3/getlogin.3.html
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2014-07-28 21:15:16 +01:00
Sami Kerola d8b616c216 logger: fix indentation issues
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2014-07-28 21:15:16 +01:00
Sami Kerola 633493beaf logger: ensure program writes everything to syslog file descriptor
It is fair assumption messages an user is asking to be wrote will be
attempted to be wrote as hard as possible.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2014-07-28 21:15:16 +01:00
Bernhard Voelker ada74f3f32 mcookie: avoid format warning
"gcc (SUSE Linux) 4.8.1 20130909 [gcc-4_8-branch revision 202388]"
issued the following warning:

  warning: format ‘%zu’ expects argument of type ‘size_t’, \
  but argument 3 has type ‘int’ [-Wformat=]

* misc-utils/mcookie.c (main): Change format from %zu to %d.
RAND_BYTES is an enum, thus of type int.

Signed-off-by: Bernhard Voelker <mail@bernhard-voelker.de>
2014-07-28 11:09:49 +02:00
Benno Schulenberg 09af3db48e textual: fix some typos and inconsistencies in various messages
Fixing plain typos, miswordings, inconsistent periods, some missing
angular brackets, and a proper pluralization (even when it involves
a constant, because for some languages the precise value matters).

Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
2014-07-23 08:56:00 +02:00
Karel Zak bd86cb1679 Merge branch 'rename' of git://github.com/kerolasa/lelux-utiliteetit
* 'rename' of git://github.com/kerolasa/lelux-utiliteetit:
  tests: add rename(1) return value check
  rename: use function pointer to select file or symlink operation
  rename: continue despite something failed
  tests: add rename(1) checks
  tests: use ts_cd everywhere to change direcrory
  tests: add function to change directory reliable way
  rename: allow renaming in subdirectories
2014-07-22 12:12:52 +02:00
Karel Zak ccef45168b Merge branch 'master' of https://github.com/yurchor/util-linux
* 'master' of https://github.com/yurchor/util-linux:
  Fix typos in user visible messages
2014-07-22 12:01:50 +02:00
Karel Zak 3df45c7cdc Merge branch 'ioclt' of https://github.com/lanurmi/util-linux 2014-07-22 11:58:21 +02:00
Sami Kerola 5651128abd rename: use function pointer to select file or symlink operation
Add separate functions to different functionality, and add a function for
the stuff that is in common for both.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2014-07-18 18:34:15 +01:00
Sami Kerola d6cf9e1669 rename: continue despite something failed
Try to do all file operations even when one or some of them fail, and
use exit value to inform what happen.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2014-07-18 18:34:15 +01:00
Sami Kerola bd9ced628b rename: allow renaming in subdirectories
Earlier the rename(1) considered path as possible string to be renamed,
could lead to an issue with none existing destination.  See below for
demonstration of this issue.  After this change all directory elements
are ignored when the match finding happens.

$ cd $(mktemp -d)
$ mkdir aa ab
$ touch a{a,b}/aa
$ rename -v a x */aa
rename: aa/aa: rename to xa/aa failed: No such file or directory

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2014-07-18 18:34:14 +01:00
Karel Zak edaf38cf8c findmnt: more robust usage of columns[]
For more details see commit dcc8dbdc8137cb3da5100158639b565565b89875.

Signed-off-by: Karel Zak <kzak@redhat.com>
2014-07-18 13:49:40 +02:00
Karel Zak 21abf83d6d lslocks: clean up columns[] usage
Signed-off-by: Karel Zak <kzak@redhat.com>
2014-07-18 13:48:31 +02:00
Karel Zak b6327c6fd8 lsblk: check number of used columns
The current code does not check size of the columns[] array when add
the next on command line specified column. We check the array size for
"-o <columns>" but not for another options.

Old version:

   $ for x in $(seq 0 100); do echo "-t"; done | xargs lsblk
   xargs: lsblk: terminated by signal 11

new version:

  $ for x in $(seq 0 100); do echo "-t"; done | xargs lsblk
  lsblk: too many columns specified, the limit is 83 columns.

Signed-off-by: Karel Zak <kzak@redhat.com>
2014-07-18 13:47:53 +02:00
Karel Zak 03df0d1150 lsblk: differentiate between infos[] and columns[]
Signed-off-by: Karel Zak <kzak@redhat.com>
2014-07-18 13:45:32 +02:00
Karel Zak 5ffe4d514c Merge branch 'patch-1' of https://github.com/bneijt/util-linux 2014-07-18 12:59:46 +02:00
Karel Zak aea3a3ba2c findmnt: fix memory leak [coverity scan]
Signed-off-by: Karel Zak <kzak@redhat.com>
2014-07-17 15:00:17 +02:00
A. Bram Neijt 9d2926bf12 Add missing paragraph mark before -f
the sections on -P and -f where glued together.
2014-07-16 21:07:04 +02:00
Benno Schulenberg 36a3cd56ab textual: fix the usage message of kill
Using angular brackets around each individual argument, indenting a
continuation line, not using a space before =, improving some wordings,
and the argument of --queue is a value (a piece of data), not a signal.

Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
2014-07-14 16:13:37 +02:00
Karel Zak 2fa32bea49 Merge branch 'minor-fixes' of git://github.com/kerolasa/lelux-utiliteetit
* 'minor-fixes' of git://github.com/kerolasa/lelux-utiliteetit:
  lscpu: avoid double free
  libsmartcols: avoid variable dereference after release
  libfdisk: do not do the same thing twice in single if statement
  whereis: avoid printing uninitialized string
  setpriv: avoid alloca() use xmalloc() instead
  dmesg: avoid unnecessary variable assignment
  fdisk: avoid code duplication
  mkfs.cramfs: use defined failure name rather than magic value
  fdformat: match variable and print format types
  cfdisk: add braces to ensure operation order
  lscpu: avoid use of bzero() in favor of memset()
  setterm: remove unnecessary variable
  cal: remove unnused structure and definition
  textual: fix some typos
2014-07-14 16:03:48 +02:00
Andreas Henriksson 89c80bd25a uuidd.rc: Requires remote_fs
The Debian package checking tool lintian thinks that the script is
missing Requires on $remote_fs because it pokes at stuff under /usr
and it's probably right.

Signed-off-by: Andreas Henriksson <andreas@fatal.se>
2014-07-14 15:55:45 +02:00
Andreas Henriksson 928601e630 uuidd.rc: drop on-demand mode from script
The on-demand mode was dropped from libuuid in
commit ea4f8845f0 "libuuid: don't exec uuidd"

You now need systemd (socket activation) to use
uuidd on demand.

Signed-off-by: Andreas Henriksson <andreas@fatal.se>
2014-07-14 15:55:34 +02:00
Sami Kerola a3443c3067 kill: use --queue option argument as sigval integer value
The sigqueue(3) takes two values, signal and sigval.  Contents of the
signal can be altered with --signal option argument, so the --queue
argument should be reserved to affect sigval_int.

This is regression fix introduced by commit
9e8dffd5cd.

Reference: http://man7.org/linux/man-pages/man3/sigqueue.3.html
Reported-by: Benno Schulenberg <bensberg@justemail.net>
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2014-07-14 15:49:35 +02:00