Commit Graph

10522 Commits

Author SHA1 Message Date
Sebastian Rasmussen 9e93004171 misc: Fix various typos
Fix various typos in error messages, warnings, debug strings,
comments and names of static functions.

Signed-off-by: Sebastian Rasmussen <>
2016-05-31 23:40:21 +02:00
Sebastian Rasmussen d35df4db5b docs: Fix various typos
Signed-off-by: Sebastian Rasmussen <>
2016-05-31 23:40:21 +02:00
Karel Zak cd28d6a405 cal: support timestamps
For example

	$ cal '2 weeks ago'

Signed-off-by: Karel Zak <>
2016-05-31 18:27:20 +02:00
Karel Zak 731441ac5b cal: allow to specify month by name
For example:

	$ cal August 2016

Signed-off-by: Karel Zak <>
2016-05-31 13:53:58 +02:00
Tobias Stoeckmann 8f35b3a998 fsck.minix: Verify more fields in super-block.
The field s_ninodes in super-block is used for memory allocation and
division without verifications. The memory allocation increments the
unchecked value by 1, making it vulnerable to an integer overflow
on 32 bit systems with minix 3 file systems. I did not find a (good)
way to exploit this by crafting a malicious file system, so I consider
it as a reliability issue. If it's 0, a division by zero occurs when
"-v" has been used. A filesystem without any inodes is definitely
wrong, because it means that there's not even the root inode, which is
accessed unchecked later on.

The field s_firstdatazone has to be checked against s_(n)zones. If it
is larger than the highest allowed index, the file system is definitely
corrupted -- hard to say which value is wrong though, therefore I
decided to simply call die(). A maliciously created file system could
do more harm in this way: single bits inside the memory area could be
flipped because range checks would fail. Hard to consider it as a
security issue though, because these addresses are not arbitrarily
accessible without very careful crafting (if at all possible).

[ - fix compiler warning (cast get_nzones()) [-Wsign-compare]]

Signed-off-by: Karel Zak <>
2016-05-31 13:18:06 +02:00
Karel Zak 1eb16fd780 build-sys: add --disable-plymouth-support
The plymouth support depends on Linux specific SOCK_* flags and all
the feature is probably unnecessary in some cases (non-plymouth
distros, etc.)

Signed-off-by: Karel Zak <>
2016-05-26 15:08:53 +02:00
Karel Zak 924c93d9df libblkid: store only canonical devnames to the cache
Let's try to use symlink:

 # ls -la /dev/block/8\:1
 # lrwxrwxrwx 1 root root 7 May 25 16:42 /dev/block/8:1 -> ../sda1

 # blkid /dev/block/8:1
 /dev/block/8:3: LABEL="HOME" UUID="196972ad-3b13-4bba-ac54-4cb3f7b409a4" TYPE="ext4" PARTUUID="6073277f-87bc-43ff-bcfd-724c4484a63a"

unfortunately the symlink is stored to the cache:

 <device DEVNO="0x0803" TIME="1464253300.715279" LABEL="HOME" UUID="196972ad-3b13-4bba-ac54-4cb3f7b409a4" TYPE="ext4" PARTUUID="6073277f-87bc-43ff-bcfd-724c4484a63a">/dev/block/8:3</device>

next time if you ask for LABEL=HOME the answer will be /dev/block/8:3
rather than /dev/sda3.

It seems better to canonicalize the paths we store to the cache.

Unfortunately if you ask for /dev/block/8:3 then you probably expect
that blkid_dev_devname() returns the same path. This patch introduces
dev->bid_xname, this is the path used by application (and never stored
in the cache).

Signed-off-by: Karel Zak <>
2016-05-26 12:15:26 +02:00
Karel Zak 4d7ef267cc lsblk: use ID_WWN_WITH_EXTENSION is possible
Signed-off-by: Karel Zak <>
2016-05-25 16:11:51 +02:00
Karel Zak 702b6b5f7f build-sys: add tools/
We have "make" targets which depends on tools/check*.sh scripts. It's
ugly to exclude these scripts from the release tar balls (as generated
by "make distcheck").

Signed-off-by: Karel Zak <>
2016-05-25 15:59:15 +02:00
Karel Zak 5d25b7814f tools: add script to load .po from
I use it for years, let's keep it in the repository.

Signed-off-by: Karel Zak <>
2016-05-25 15:28:42 +02:00
Karel Zak 14308bc3f2 libblkid: improve debug messages
Signed-off-by: Karel Zak <>
2016-05-25 15:06:22 +02:00
Karel Zak 0966b16b22 build-sys: add missing include/plymouth-ctrl.h
Signed-off-by: Karel Zak <>
2016-05-24 14:50:07 +02:00
Karel Zak 54d172327b dmesg: fix indention
Signed-off-by: Karel Zak <>
2016-05-24 14:12:54 +02:00
Karel Zak c4482f7b3b last: fix logout time
Signed-off-by: Karel Zak <>
2016-05-24 14:08:57 +02:00
Karel Zak bcf720693d lsipc: use strtime_short()
Signed-off-by: Karel Zak <>
2016-05-24 13:22:40 +02:00
Karel Zak cb5b52882e lslogins: use strtime_short()
Signed-off-by: Karel Zak <>
2016-05-24 13:22:23 +02:00
Karel Zak eee665bb5a lib/timeutils: add strtime_short()
Signed-off-by: Karel Zak <>
2016-05-24 13:21:26 +02:00
Karel Zak 101f91ee84 tests: refresh cal(1) test
Signed-off-by: Karel Zak <>
2016-05-24 11:16:12 +02:00
Karel Zak bbdfcbe9f0 lsipc: use strtm_iso()
Signed-off-by: Karel Zak <>
2016-05-24 11:10:57 +02:00
Karel Zak 7c678f819b hwclock: use strtimeval_iso()
Signed-off-by: Karel Zak <>
2016-05-24 11:10:10 +02:00
Karel Zak 3c6e7c5414 dmesg: use strtimeval_iso()
Signed-off-by: Karel Zak <>
2016-05-24 11:09:41 +02:00
Karel Zak 88134ee208 lslogins: use strtm_iso()
Signed-off-by: Karel Zak <>
2016-05-24 11:08:10 +02:00
Karel Zak c7eb14d325 last: cleanup time formatting code
- describe difference between login and logout time formats in struct last_timefmt
- use strtime_iso()
- add LAST_TIMEFTM_HHMM for internal purpose (logout format for "--time-format short")

Signed-off-by: Karel Zak <>
2016-05-24 11:07:08 +02:00
Karel Zak 33c7ffa303 include/timeutils: rewrite iso formatting functions
- use buffers rather than allocate memory
- support .usec and ,usec convention
- use strftime for timezone (we need to care about daylight
  saving time)

Signed-off-by: Karel Zak <>
2016-05-24 10:58:52 +02:00
Karel Zak 01b47d46d7 include/timeutils: use pointer for time_t
Signed-off-by: Karel Zak <>
2016-05-23 11:56:31 +02:00
Werner Fink fe3f7e17aa sulogin: agetty: use the plymouth local protocol instead the plymouth binary
for stopping plymouthd.  That do not depend on the existence of
the plymouth binary if it e.g. becomes uninstalled or an other
service is providing plymouthd facilities.

[ - fix compiler warnings [-Wpointer-sign]
                  - use sizeof() for write_all()
                  - cast to char* for read_all]

Signed-off-by: Werner Fink <>
Signed-off-by: Karel Zak <>
2016-05-20 11:21:10 +02:00
Karel Zak fded7cd034 Merge branch 'cal04' 2016-05-20 10:55:06 +02:00
Mike Frysinger 5593132a90 man pages: fix spacing between man page name & section number
Most have standardized correctly, but fix a few latent ones.

Signed-off-by: Mike Frysinger <>
2016-05-20 10:54:31 +02:00
Karel Zak 53ca053291 script: improve coding style and the "done" message
Don't print the "done" message if the file does not exist.

Signed-off-by: Karel Zak <>
2016-05-18 15:06:31 +02:00
Karel Zak e671a62ef8 cal: use %04d for year
It seems that people are crazy enough to assume that "cal 16" is the
year 2016, rather than 16 (2000 years ago).

This patch makes it more clear as the output is 0016.

Signed-off-by: Karel Zak <>
2016-05-18 14:43:20 +02:00
Karel Zak 747600537c libfdisk: use table-length in dump for non-standard PT
Signed-off-by: Karel Zak <>
2016-05-18 14:29:50 +02:00
Karel Zak a67054f9be libfdisk: make table-length usage more robust
Signed-off-by: Karel Zak <>
2016-05-18 14:15:02 +02:00
Sassan Panahinejad d96153f8c8 sfdisk: Add support for altering GPT size
Adds a header option to alter the GPT table length
2016-05-18 13:56:25 +02:00
Sassan Panahinejad a18e726c66 libfdisk: Add support for altering GPT size
This is useful in two situations:

1. More than 128 partitions are required. Or

2. The partition table must be restricted in size, such as when a system
expects to find a bootloader at a location that would otherwise overlap the
partition table.

The gdisk partitioner supports this feature.

libfdisk is already capable of reading and writing partition tables of any
size, but previously could only create ones of 128 entries and could not

This change should be fairly safe, as it has no effect unless explicitly

Signed-off-by: Karel Zak <>
2016-05-18 13:48:04 +02:00
Sassan Panahinejad 304cf9499d fdisk: Add support for altering GPT size
Adds an options (l) to the GPT menu to resize the GPT.
2016-05-18 13:46:35 +02:00
Sassan Panahinejad 083c35b9f6 libfdisk: fix range checking for fdisk_set_last_lba 2016-05-18 13:46:35 +02:00
Karel Zak 28b6c76f8a logger: add man page note about the default --tag
Signed-off-by: Karel Zak <>
2016-05-16 15:05:28 +02:00
Karel Zak 40c9c3a6b7 libfdisk: add API for work with labelitems
Signed-off-by: Karel Zak <>
2016-05-12 14:37:29 +02:00
Karel Zak e4c5250dfb libfdisk: move fdisk_field_...() functions to field.c
Signed-off-by: Karel Zak <>
2016-05-12 12:21:59 +02:00
Karel Zak 3c201431ee lib/timeutils: add strxxx_iso() functions
Signed-off-by: Karel Zak <>
2016-05-11 15:31:02 +02:00
Karel Zak 627258104b ramctl: add support for zram-control
Based on patch from Timofey Titovets.

Reported-by: Timofey Titovets <>
Signed-off-by: Karel Zak <>
2016-05-11 12:43:40 +02:00
Karel Zak a3a125b922 libfdisk: use fdisk_add_partition() for unused partno
For example:

   sfdisk -N <parno>

may address unused partition. In this case we need to redirect from
fdisk_set_partition() to fdisk_add_partition() and follow default
setting (used all free space).

Signed-off-by: Karel Zak <>
2016-05-10 10:52:31 +02:00
Karel Zak 94af67f2aa Merge branch 'no-fork' of 2016-05-09 13:28:52 +02:00
Sami Kerola c8a6f83e85 setterm: remove unnecessary translation string
Signed-off-by: Sami Kerola <>
2016-05-09 12:57:01 +02:00
Karel Zak 98297e65a1 setterm: de-duplicate color option string parsing
Signed-off-by: Karel Zak <>
2016-05-09 12:35:41 +02:00
Wayne Pollock 3e90d04af9
write: fix setuid related regression
The write(1) is commonly a setuid binary, because common users cannot by
default write to each others terminals.  Since the commit in reference, that
is part of releases v2.24 to v2.28, the write(1) has used access(2) to check
capability to write to a destination terminal.  The catch is that access(2)
uses real UID and GID to when performing the accessibility.  The obvious
correction is to avoid access(2) when in context of setuid binaries.

As a smaller fix, but equally important fix, ensure the 'msgsok' variable is
initialized to indicate no access.  Uninitialized variable will almost
certainly do wrong thing at the time of check.

Breaking-commit: 0233a8ea18
Signed-off-by: Sami Kerola <>
Signed-off-by: Karel Zak <>
Signed-off-by: Wayne Pollock <>
2016-05-07 22:49:41 +01:00
Sami Kerola f0b3b904c7 scriptreplay: avoid re-implementing strtod_or_err()
And use isnan() to detect NaN.

Signed-off-by: Sami Kerola <>
2016-05-05 11:46:54 +02:00
Sami Kerola ba660b9911 scriptreplay: improve error message
Use human numbering for lines - that is start counting from 1.  And tell in
error message what the number means.

Signed-off-by: Sami Kerola <>
2016-05-05 11:46:54 +02:00
Victor Dodon 14f644f386 sfdisk: exit with error if rereading partition table fails
Use the return value of fdisk_reread_partition_table in write_changes so that
sfdisk exits with error if re-reading the partition table fails.

Signed-off-by: Victor Dodon <>
2016-05-05 11:43:07 +02:00
Karel Zak 832bbc73b2 build-sys: remove obsolete [cs]fdisk LDADDs
Signed-off-by: Karel Zak <>
2016-05-04 15:02:02 +02:00