Commit Graph

9915 Commits

Author SHA1 Message Date
Karel Zak 04a5cb58b6 namei: move icache to lib/
Signed-off-by: Karel Zak <kzak@redhat.com>
2015-11-27 13:56:01 +01:00
Karel Zak 8a2045620e lsns: new command
Signed-off-by: Karel Zak <kzak@redhat.com>
2015-11-26 14:09:45 +01:00
Karel Zak 0e756daeb6 lslocks: use stuff from lib/procutils
Signed-off-by: Karel Zak <kzak@redhat.com>
2015-11-25 14:17:22 +01:00
Karel Zak 5184d93630 agetty: don't ignore netlink on select()
agetty uses NETLINK_ROUTE to be notified about network interface
changes. Unfortunately, the code that monitor the netlink FD does not
increment number of the monitored file descriptors when call
select(2), so the netlink notifications are invisible for agetty.

Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=1278906
Signed-off-by: Karel Zak <kzak@redhat.com>
2015-11-24 17:44:38 +01:00
Karel Zak 0172ebba52 tests: update ZFS test
Signed-off-by: Karel Zak <kzak@redhat.com>
2015-11-19 19:08:00 +01:00
Casper Ti. Vector dcbba45cc5 include: remove now useless linux_reboot.h. 2015-11-19 12:07:41 +01:00
Casper Ti. Vector e52b58e627 ctrlaltdel: use reboot() provided by libc, assuming it is 1-adic. 2015-11-19 12:07:04 +01:00
Karel Zak f98d9641a3 losetup: clean up --direct-io
Signed-off-by: Karel Zak <kzak@redhat.com>
2015-11-19 11:57:05 +01:00
Ming Lei faeef4d2e9 losetup: support list direct io
So that user can see if DIO is set for current loop device.

Signed-off-by: Ming Lei <tom.leiming@gmail.com>
2015-11-19 11:27:36 +01:00
Ming Lei 64c3bb3cb7 losetup: support ioctl cmd of LOOP_SET_DIRECT_IO
From v4.4, linux kernel starts to support direct I/O and
AIO to backing file for loop driver, so allow losetup to
enable the feature by using LOOP_SET_DIRECT_IO ioctl cmd.

Signed-off-by: Ming Lei <tom.leiming@gmail.com>
2015-11-19 11:27:36 +01:00
Karel Zak 710dd49239 blkid: don't mark zfs as RAID
Signed-off-by: Karel Zak <kzak@redhat.com>
2015-11-18 11:55:35 +01:00
Andreas Henriksson 42f536ee84 bash-completion: fstrim: use mountpoint, not device
fstrim takes mountpoint as argument but the bash completion
was completing it to a device node.

Addresses: http://bugs.debian.org/804833
Reported-by: Ritesh Raj Sarraf <rrs@debian.org>
Signed-off-by: Andreas Henriksson <andreas@fatal.se>
2015-11-13 09:52:14 +01:00
Benno Schulenberg 25b3c04f41 lsipc: tweak a few wordings on the manpage
Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
2015-11-09 10:03:58 +01:00
Benno Schulenberg 1e6a9c1814 chfn: improve formatting and wording of the manpage
Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
2015-11-09 10:03:58 +01:00
Benno Schulenberg e8cf378e48 hexdump: fix a typo and tweak some wordings in the manpage
Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
2015-11-09 10:03:58 +01:00
Benno Schulenberg 239610b659 dmseg: slightly improve punctuation and formatting of the manpage
Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
2015-11-09 10:03:58 +01:00
Benno Schulenberg da6bb5f8c3 logger: sort the options in the manpage alphabetically
Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
2015-11-09 10:03:58 +01:00
Benno Schulenberg 05e68ce728 logger: improve grammar and formatting of the manpage
Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
2015-11-09 10:03:58 +01:00
Sami Kerola a4aeb5bd80 script, hwclock: check file exist with access(3) rather than stat(3)
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2015-11-09 09:56:14 +01:00
Sami Kerola c3a9f86fcd agetty: fix chown(3), chmod(3) and open(3) race
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2015-11-09 09:56:14 +01:00
Sami Kerola d0a050e0f9 fsck: retire stat(3) when access(3) does better job
The stat(3) and access(3) are in this case almost interchangeable, so choose
the lightweight function with additional advantage checking the file is
executable.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2015-11-09 09:56:14 +01:00
Sami Kerola 8df370d340 swapon: fix stat(3) and open(3) race
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2015-11-09 09:56:14 +01:00
Sami Kerola a64e268224 login: fix stat(2) race
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2015-11-09 09:56:14 +01:00
Sami Kerola 2ec100a180 logger: shadow declaration
misc-utils/logger.c:448:17: warning: declaration of 'msg' shadows a
				parameter [-Wshadow]
misc-utils/logger.c:429:74: note: shadowed declaration is here

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2015-11-06 13:19:39 +01:00
Karel Zak 803172f63d prlimit: cleanup output units
The change is based on kernel fs/proc/base.c.

Signed-off-by: Karel Zak <kzak@redhat.com>
2015-11-05 18:59:00 +01:00
Karel Zak 3ccd9664aa bash-completion: add cal --span
Signed-off-by: Karel Zak <kzak@redhat.com>
2015-11-05 11:34:25 +01:00
Karel Zak a29edd057c Merge branch 'cal-span' of https://github.com/Deiz/util-linux
* 'cal-span' of https://github.com/Deiz/util-linux:
  cal: Add --span option
  cal: Track date span independently from months_in_row
2015-11-05 11:32:10 +01:00
Karel Zak b0e6b25e64 build-sys: bump also PACKAGE_VERSION_RELEASE number
Now we bump only PACKAGE_VERSION_MAJOR and PACKAGE_VERSION_MINOR
numbers. The PACKAGE_VERSION_RELEASE is always zero.

These numbers are used for LIBxxx_VERSION strings and Version: field
in the .pc files.

Unfortunately, if we keep PACKAGE_VERSION_RELEASE= always zero then
our bugfix releases are invisible for pkg-config.

(Although I don't think it's good idea to depend in code on any
 library bugfix release, code should be about APIs).

Addresses: https://github.com/systemd/systemd/pull/1754
Signed-off-by: Karel Zak <kzak@redhat.com>
2015-11-04 17:19:41 +01:00
Karel Zak 4419ffb9ef lib/sysfs: make sysfs_get_devname()/blkid_devno_to_wholedisk() more robust
Now the function uses result buffer for internal stuff (readlink), so
it requires that the buffer is large enough. This is unexpected as
caller assumes that the buffer has to be large enough for devname only.

References: http://www.spinics.net/lists/util-linux-ng/msg12015.html
Reported-by: Tom Yan <tom.ty89@gmail.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
2015-10-30 11:08:32 +01:00
Karel Zak 9b28da2d1f logger: remove unnecessary comment
Signed-off-by: Karel Zak <kzak@redhat.com>
2015-10-29 11:32:50 +01:00
Karel Zak 27a9eb5359 logger: use --id as local socket credentials
If you have really paranoid syslog (or systemd who listens on /dev/log)
then it replaces in the message PID with a real PID from socket header
credentials:

 # echo $PPID
 1550

 # logger -p info --stderr --id=$PPID "This is message baby!"
 <14>Oct 29 11:22:13 kzak[1550]: This is message baby!

 # journald -n 1
 Oct 29 11:22:13 ws kzak[22100]: This is message baby!
                         ^^^^^

This patch forces kernel to accept another *valid* PID if logger(1)
executed with root permissions; improved version:

 # logger -p info --stderr --id=$PPID "This is message baby!"
 <14>Oct 29 11:26:00 kzak[1550]: This is message baby!

 # journald -n 1
 Oct 29 11:26:00 ws kzak[1550]: This is message baby!

Signed-off-by: Karel Zak <kzak@redhat.com>
2015-10-29 11:18:21 +01:00
Karel Zak 17c8aa1dc0 logger: use iovec for all message
Signed-off-by: Karel Zak <kzak@redhat.com>
2015-10-27 18:44:00 +01:00
Karel Zak 94a28496aa logger: use iovec and sendmsg() to send message
The iovec based solutions allow to send multiple strings by one
syscall (for example additional \n messages separator). We can also
use it to send additional socket header metadata (e.g.
SCM_CREDENTIALS) later.

Signed-off-by: Karel Zak <kzak@redhat.com>
2015-10-27 13:19:16 +01:00
Karel Zak da0c95128c Merge branch 'uuid' of git://github.com/kerolasa/lelux-utiliteetit
* 'uuid' of git://github.com/kerolasa/lelux-utiliteetit:
  tests: add uuidd output check
  tests: add uuidgen output check
  tests: make test_uuid_parser to read files
  tests: add uuid parser check
2015-10-27 12:01:22 +01:00
Karel Zak 741d478eeb ctrlaltdel: use path.h to read /proc
Signed-off-by: Karel Zak <kzak@redhat.com>
2015-10-27 11:56:51 +01:00
Sami Kerola 244d48331e
tests: add uuidd output check
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2015-10-18 20:17:07 +01:00
Sami Kerola 4bd90ec864
tests: add uuidgen output check
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2015-10-18 20:17:01 +01:00
Sami Kerola 85638702ed
tests: make test_uuid_parser to read files
This allows using the command to check uuidgen and uuidd are generating
valid outputs.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2015-10-18 19:12:30 +01:00
Sami Kerola 4d3f964e4a
tests: add uuid parser check
The check is based on code by Theodore Ts'o to test libuuid, from which
unstable output is commented out.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2015-10-18 18:39:21 +01:00
Sami Kerola 82cac34889
ctrlaltdel: display setting when ran without arguments
This is more useful than printing an error.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2015-10-18 18:03:57 +01:00
Sami Kerola 6e82b1f3ef
docs: update ctrlaltdel.8 man page
Most significant clarification is to tell hard C_A_D is the default in linux
kernel.  Update also kernel reference, and improve readability.

Reference: http://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/tree/kernel/reboot.c
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2015-10-18 18:03:52 +01:00
Sami Kerola 8137c98f83
ctrlaltdel: improve error messaging
Tell user what is wrong rather than print usage().

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2015-10-18 18:03:47 +01:00
Sami Kerola bd299782ca
nologin: require /etc/nologin.txt to be file
This makes silly practical jokes impossible, like for example symlinking
/dev/null or dev/random to /etc/nologin.txt

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2015-10-18 18:03:38 +01:00
Sami Kerola f06abd22be
last: display input file in usage() according to command name
Default depends on whether the executable is called 'lastb' or something
else.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2015-10-18 18:03:34 +01:00
Karel Zak c2f03da93d script: be pedantic and use "%"SCNi64
Signed-off-by: Karel Zak <kzak@redhat.com>
2015-10-16 11:48:47 +02:00
Isaac Dunham 345208a5ab script: don't assume that time_t is compatible with long
time_t may change to 64-bit on 32-bit Linux kernels at some point;
at that point, it may be desireable to test for issues with dates
past 2038.

[kzak@redhat.com: - use %jd rather than %lld]

Signed-off-by: Karel Zak <kzak@redhat.com>
2015-10-16 11:31:22 +02:00
James Clarke 99eadc9e3f sulogin: Use fallback method on the Hurd for detecting consoles
Signed-off-by: James Clarke <jrtc27@jrtc27.com>
2015-10-16 09:52:16 +02:00
Karel Zak 1bb02a2da9 libmount: follow docs with parse-error callback return code
The docs says that recoverable errors have rc > 0.

Signed-off-by: Karel Zak <kzak@redhat.com>
2015-10-15 12:12:11 +02:00
Karel Zak 4546fd398f Revert "libblkid: support LSI RAID on partition too"
This reverts commit bc9007c372.

We need a better way, it seems that the original report is mostly
about udev rules disadvantages than about libblkid bug. See RH
bugzilla (#1172510) for more details.
2015-10-15 12:04:35 +02:00
Karel Zak 1cd9d0d746 mount, umount, swapon, fsck, lsblk, findmnt: ignore malformed lines
The libmount provides way how to deal with parsing errors in fstab --
on error callback function is executed and according to the return
libmount manipulate with the malformed line, possible are three
states:

  1/ fatal error; all file ignored              (callback rc < 0)
  2/ recoverable error; malformed line ignored  (callback rc > 0)
  3/ ignore the error                           (callback rc == 0)

The 2/ is the default if no callback specified.

Unfortunately our utils uses 3/. The correct way is to use 2/.

Signed-off-by: Karel Zak <kzak@redhat.com>
2015-10-15 12:01:48 +02:00