Commit Graph

8076 Commits

Author SHA1 Message Date
Karel Zak 3e55659feb losetup: return EXIT_FAILURE on unsuccessful -f
Reported-by: Ruediger Meier <sweet_f_a@gmx.de>
Signed-off-by: Karel Zak <kzak@redhat.com>
2014-05-13 11:34:30 +02:00
Werner Fink b9c7390948 agetty: beside virtual consoles support xvc and hvc device lines as well
For this approach do not use the ioctl TIOCMGET anymore as this
is for real serial lines only. But switch over to use the ioctl
KDGKBMODE as this is unique to the virtual console lines only.

Signed-off-by: Werner Fink <werner@suse.de>
2014-05-13 10:40:11 +02:00
Werner Fink f2bcda5183 agetty: better support of the special system consoles on S390
That is that there are several consoles, the /dev/ttyS0 which
is type of ibm3215 and a dumb terminal, then there is the device
/dev/3270/tty1 which can handle ANSI color escape sequences and is
a ibm327x terminal, and the /dev/ttyS1 which is a vt220 terminal.

The macro is_speed() in agetty.c allows to distinguish between the
terminal line (/dev)3270/tty1 and the speed options on the command
line used in

/run/systemd/generator/getty.target.wants/serial-getty@3270-tty1.service

which is a symbolic link to /usr/lib/systemd/system/serial-getty@.service

Signed-off-by: Werner Fink <werner@suse.de>
2014-05-13 10:39:40 +02:00
Werner Fink 624b204d7b sulogin: find a suitable console device
Enable sulogin to find a suitable console device even if the first line
in /proc/consoles does not have any major and minor number.

Signed-off-by: Werner Fink <werner@suse.de>
2014-05-13 10:38:06 +02:00
Werner Fink bb280f79f1 agetty: avoid that agetty nor sulogin are fooled by a running plymouth
The nowadays used plymouth locks the devices used for the system
console which causes that agetty as well as sulogin can not modify
the termios settings of e.g. the serial devices of the systenm console.

Signed-off-by: Werner Fink <werner@suse.de>
2014-05-13 10:36:49 +02:00
Karel Zak a08fa9ab57 cfdisk: fix compiler warning [-Wsign-compare]
Signed-off-by: Karel Zak <kzak@redhat.com>
2014-05-13 09:58:58 +02:00
Karel Zak 293eef71ea Revert "blkid: remove unused variable"
This reverts commit 0fd4b81325.
2014-05-13 09:55:10 +02:00
Karel Zak 73548d6e60 libfdisk: fix %ju -> %zu
Signed-off-by: Karel Zak <kzak@redhat.com>
2014-05-13 09:52:42 +02:00
Ruediger Meier b5eb509709 tests: ts_device_init remove useless error handling
Don't know why we should deinit the empty string.
This patch prepares further refactoring or error handling.

Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
2014-05-12 16:25:16 +02:00
Sami Kerola 3393c136a2 setterm: convert remaining magic values to symbolic references
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
Signed-off-by: Karel Zak <kzak@redhat.com>
2014-05-12 13:59:59 +02:00
Sami Kerola 010f219d5f setterm: convert various constant number definitions to enums
The enum strings are visible when using debugger.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2014-05-12 13:54:38 +02:00
Karel Zak 6ed37604fe setterm: cleanup printf() usage
Signed-off-by: Karel Zak <kzak@redhat.com>
2014-05-12 13:53:10 +02:00
Sami Kerola 45656c9fe1 setterm: remove unused code
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2014-05-12 13:38:53 +02:00
Sami Kerola 42e296b59d wall: replace magic number by named value
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
Signed-off-by: Karel Zak <kzak@redhat.com>
2014-05-12 13:38:25 +02:00
Sami Kerola afbdd44fe3 term-utils: avoid error message string length couting errors
Remove various magic numbers with either a string lenght count, or a
symbolic variable that is recognized by gdb.

[kzak@redhat.com: - use snprintf() everywhere,
                  - check snprintf() return code rather than mess up
                    the code with strlens]

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
Signed-off-by: Karel Zak <kzak@redhat.com>
2014-05-12 13:37:35 +02:00
Sami Kerola 89dda67868 build-sys: remove unnecessary void casts
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2014-05-12 13:07:12 +02:00
Sami Kerola 4d7d1af674 logger: check numeric priority and facility input values
Earlier use of unknown facility or priority number was accepted, and
resulted in unexpected result.  For example when looking journalctl
--priority=7.8 was converted to priotity 0 and facility 1.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2014-05-12 13:07:09 +02:00
Sami Kerola 047e2888a3 logger: fail when io vector number exceeds maximum
Earlier version silently failed without logging anything.

$ logger --journald=/etc/services ; echo $?
1

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2014-05-12 13:07:06 +02:00
Sami Kerola 0fd4b81325 blkid: remove unused variable
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2014-05-12 13:07:04 +02:00
Sami Kerola 198556b76c cytune: remove from util-linux
Assumption is there are not many who need this tool.  Whom ever they
might be the recommendation is to use the command from old util-linux
release.  Second reason to removal is difficulty to test hardware
specific command when none of the active project members does not seem to
have such.  Basically the command has reached dead end what comes to
maintainability of it.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2014-05-12 13:06:59 +02:00
Sami Kerola 1e29f37dde tests: check /proc availability, and go-around if it is incomplete
Unavailability of /proc is fatal for kill, and continuing with the test
in that case does not make sense as it will only mean false positive
errors.

Where /proc/<pid>/status file(s) does not exist the check will perform
opportunistic sleep with assumption the test_sigreceive will be ready to
be killed if it has some time to init.

[kzak@redhat.com: - remove dependence on gawk, just use shell
                  - fix typo in "test /proc"]

CC: Ruediger Meier <sweet_f_a@gmx.de>
Reference: https://travis-ci.org/rudimeier/util-linux/jobs/24561058
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
Signed-off-by: Karel Zak <kzak@redhat.com>
2014-05-12 13:02:52 +02:00
Karel Zak 8e3ac29e8b Merge branch 'tests-features' of https://github.com/rudimeier/util-linux
* 'tests-features' of https://github.com/rudimeier/util-linux:
  tests: style Makefile and make output
  tests: allow to add or override test suite options
  tests: add exit case "KNOWN FAILED"
  tests: fix var names
  tests: allow test options to be overridden by env
  tests: call ts_init_env as early as possible
2014-05-12 12:32:33 +02:00
Ruediger Meier 9b240fd03a tests: style Makefile and make output
We break long lines and make output sill looks nice with and without
V=1.

As a side effect we can now run
  make TS_COMMAND="true"
to do nothing but building all check_PROGRAMS.

Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
2014-05-12 09:57:14 +02:00
Ruediger Meier 8bb87440da tests: allow to add or override test suite options
Now we can do something like this
  make check TS_OPTS="--fake --parallel=32"

Note we still always set --parallel but the last one wins.

Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
2014-05-12 09:56:54 +02:00
Ruediger Meier 7641ccec60 tests: add exit case "KNOWN FAILED"
Now we can mark tests as known to be broken without bothering
users with exit failure. In the build log this "KNOWN FAILED"
may be interpreted as TODO ;)

The main advantage of "known-fail" instead of just skipping
is that we will still find the test diff.

Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
2014-05-12 09:56:08 +02:00
Ruediger Meier 6e69f1ee0f last: avoid leading "-" before "no logout"
This affects option --time-format=notime.

Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
2014-05-10 15:17:42 +02:00
Ruediger Meier c08863ff72 tests: fix var names
Translate "." and "-" to "_". We assume that nobody will add
completely stupid test file names.

Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
2014-05-10 09:08:31 +02:00
Ruediger Meier eac40eb009 tests: allow test options to be overridden by env
Specially for automated builds the user may want to have some
fine granulated influence like

export TS_OPT_libmount_verbose="yes"
export TS_OPT_ipcs_fake="yes"
export TS_OPT_ipcs_limits2_fake="no"
if <big endian> then
  export TS_OPT_hexdump_fake="yes"
fi
make check

Even for interactive developers this could be useful for example to
debug just one particuar test while having a regular run with stress:

TS_OPT_script_verbose="yes" \
TS_OPT_script_memcheck="yes" \
../tests/run.sh --parallel=256 --srcdir=.. --builddir=. --nonroot

Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
2014-05-10 05:56:43 +02:00
Ruediger Meier d9a9ff09b8 tests: call ts_init_env as early as possible
Soon we want to use some env vars within ts_has_option(). That's
why we move some lines to make this possible.

Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
2014-05-10 04:59:34 +02:00
Ruediger Meier 4fcbfaa81d last: minor cleanup if statements
Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
2014-05-08 22:14:27 +02:00
Ruediger Meier ce0aefbd0d tests: add test case for last -time-format=full
Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
2014-05-08 22:14:23 +02:00
Ruediger Meier f16d5044e1 last: --time-format=full should do the same like -F
For no reason "full" did something else than "iso" or -F as you
see here:
$ ./last  -f ../tests/ts/last/wtmp.LE  --time-format=full  | grep -A2 "no logout"
torvalds linux        hobby            Mon Aug 26 02:57:08 1991    gone                    - no logout
reboot   system boot  system-name      Wed Aug 28 20:00:00 2013   still                    running
reboot   system boot  system-name      Wed Aug 28 18:00:00 2013 - Wed Aug 28 19:00:00 2013  (01:00)
$ ./last  -f ../tests/ts/last/wtmp.LE  --time-format=iso  | grep -A2 "no logout"
torvalds linux        hobby            1991-08-26T02:57:08+0200   gone - no logout
reboot   system boot  system-name      2013-08-28T20:00:00+0200   still running
reboot   system boot  system-name      2013-08-28T18:00:00+0200 - 2013-08-28T19:00:00+0200  (01:00)
$ ./last  -f ../tests/ts/last/wtmp.LE  -F  | grep -A2 "no logout"
torvalds linux        hobby            Mon Aug 26 02:57:08 1991   gone - no logout
reboot   system boot  system-name      Wed Aug 28 20:00:00 2013   still running
reboot   system boot  system-name      Wed Aug 28 18:00:00 2013 - Wed Aug 28 19:00:00 2013  (01:00)

Also note the useless leading space before "gone"

The only thing which matters is fmt->out width when printing these
strings like "still running". Now ctl->fulltime flag is unsused and
removed.

Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
2014-05-08 22:14:06 +02:00
Ruediger Meier d3108db19e last: fix uninitialized length
length was unset when using "last --time-format=iso"

Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
2014-05-07 14:42:36 +02:00
Karel Zak c60329b33f libsmartcols: (docs) reorder functions in version section
Signed-off-by: Karel Zak <kzak@redhat.com>
2014-05-07 11:48:53 +02:00
Sami Kerola acb5f9b56e column: inform user when multibyte conversion error occurs
The column(1) read input until conversion error, and used incomplete
input when outputing, that made at least me to wonder where the rest
disappeared without explanation.  IMHO it is better to fail immediately
rather than do only half of the task.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2014-05-07 11:28:48 +02:00
Karel Zak c571e61969 Merge branch 'kill-tests' of https://github.com/rudimeier/util-linux 2014-05-07 09:21:52 +02:00
Karel Zak 2c5484f7b2 lib/boottime: add a new file
Signed-off-by: Karel Zak <kzak@redhat.com>
2014-05-06 20:27:10 +02:00
Ruediger Meier 48f9e0b258 tests: fix kill problems
There were several failures (missing tmp files, missing pids) on travis
build farm which I couldn't track down completely. Here we fix some
possible issues:
 - mktemp -u is unsafe, maybe even in practice if there is a bad random
   generator
 - make sure that mktemp does not give us pure integer filnames which
   would not work for "kill by-name"
 - avoid using trap, could be that it removed tmp files on wrong signals

Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
2014-05-06 19:29:13 +02:00
Ruediger Meier 8d4d36e287 tests: kill_functions.sh needs gawk (skip if sourced)
Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
2014-05-06 19:29:03 +02:00
Karel Zak 5d7bdfd653 include/boottime: add a new file
Signed-off-by: Karel Zak <kzak@redhat.com>
2014-05-06 16:38:53 +02:00
Karel Zak 08ca3e26a8 lib/timeutils: remove get_boot_time from libcommon
clock_gettime() needs -lrt, so let's keep this stuff
outside libcommon.la

Reported-by: Ruediger Meier <sweet_f_a@gmx.de>
Signed-off-by: Karel Zak <kzak@redhat.com>
2014-05-06 13:16:05 +02:00
Karel Zak f55b4b4512 hwclock: fix typo
Reported-by: Stanislav Brabec <sbrabec@suse.cz>
Signed-off-by: Karel Zak <kzak@redhat.com>
2014-05-06 12:51:42 +02:00
Stanislav Brabec db8fc5f377 hwclock: Check drift value in /etc/adjtime
Due to bug in older versions of hwclock, /etc/adjtime can contain
excessive drift value (up to many years per day). Prevent it
from applying.

Signed-off-by: Stanislav Brabec <sbrabec@suse.cz>
2014-05-06 12:49:56 +02:00
Stanislav Brabec f196fd1a5f hwclock: Prevent excessive drift values
Failure of CMOS battery can cause writing of excessive drift
values (up to many years per day).

This causes excessive hwclock adjustment next time, which may lead
to overflow in calculate_adjustment() (and hang before 4a44a54b).

Prevent this situation, check drift for limits and reset drift to zero
instead.

Steps to reproduce:

mv /etc/adjtime /etc/adjtime.backup

rm /etc/adjtime
hwclock --set --date 2001-01-01\ 01:00:00

changing of /etc/adjtime.
mv /etc/adjtime /etc/adjtime.saved
hwclock --set --date 2001-01-02\ 01:00:01
mv /etc/adjtime.saved /etc/adjtime

echo "======= The /etc/adjtime has a \"correct\" look:"
cat /etc/adjtime

hwclock --debug --systohc --utc
echo "======= The /etc/adjtime now has deeply failed drift value:"
cat /etc/adjtime

mv /etc/adjtime /etc/adjtime.saved
hwclock --set --date 2015-01-01\ 01:00:00
mv /etc/adjtime.saved /etc/adjtime

hwclock --debug --adjust
echo "======= And the last /etc/adjtime:"
cat /etc/adjtime

mv /etc/adjtime.backup /etc/adjtime
hwclock --systohc --utc

Signed-off-by: Stanislav Brabec <sbrabec@suse.cz>
2014-05-06 12:49:55 +02:00
Bjarni Ingi Gislason 802cb7db71 chsh: Improve the typesetting of the manual
Protect a full stop (.), that begins or ends a string, with \&

  Change '-' to '\-', if it indicates an option

Signed-off-by: Bjarni Ingi Gislason <bjarniig@rhi.hi.is>
2014-05-06 11:57:01 +02:00
Bjarni Ingi Gislason b5fff5211b chfn: Improve the typesetting of the manual
Change comma (,) to a period (.) as it is the control character

  Use macro RB instead of the reverse one (BR)

  Add missing [ in front of  an (optional) option

  Protect a full stop (.), that begins or ends a string, with \&

  Change '-' to '\-', if it indicates an option

Signed-off-by: Bjarni Ingi Gislason <bjarniig@rhi.hi.is>
2014-05-06 11:56:49 +02:00
Bjarni Ingi Gislason 4f712efe89 libuuid: (uuid.3) Improve the typesetting of the manual
Protect a full stop (.), that begins or ends a string, with \&

Signed-off-by: Bjarni Ingi Gislason <bjarniig@rhi.hi.is>
2014-05-06 11:56:29 +02:00
Bjarni Ingi Gislason da93895661 libuuid: (uuid_unparse.3) Improve the typesetting of the manual
Change '\-' (minus) to '-' (code "hyphen-minus", rendered with the
glyph 'hyphen' in troff), if it is a part of a compound word.

  Use \e to print the escape character, instead of \\, as \e is not
interpreted in copy mode

  Protect a full stop (.), that begins or ends a string, with \&

  Inhibit right adjusting for the section "SEE ALSO" with ".na/.ad", or
use '.ad l' for the entire manual

Signed-off-by: Bjarni Ingi Gislason <bjarniig@rhi.hi.is>
2014-05-06 11:56:12 +02:00
Bjarni Ingi Gislason c5280309c4 libuuid: (man/uuid_time.3) Improve the typesetting of the manual
Protect a full stop (.), that begins or ends a string, with \&

  Inhibit right adjusting for the section "SEE ALSO" with ".na/.ad", or
use '.ad l' for the entire manual

Signed-off-by: Bjarni Ingi Gislason <bjarniig@rhi.hi.is>
2014-05-06 11:55:57 +02:00
Bjarni Ingi Gislason 7a8c8e7efd libuuid: (uuid_parse.3) Improve the typesetting of the manual
Use \e for the printable escape character instead of \\

  Protect a full stop (.), that begins or ends a string, with \&

  Inhibit right adjusting for the section "SEE ALSO" with ".na/.ad", or
use '.ad l' for the entire manual

Signed-off-by: Bjarni Ingi Gislason <bjarniig@rhi.hi.is>
2014-05-06 11:55:45 +02:00