Let's use the same semantic for the title as for the last column in
the table. If aligned on left, table is not "maxout" and title padding
symbol is undefined (or blank) then keep title as short as possible.
Addresses: https://github.com/karelzak/util-linux/issues/549
Signed-off-by: Karel Zak <kzak@redhat.com>
Unfortunately, the symbols are visible in statically compiled libuuid
and the names are too generic.
Addresses: https://github.com/karelzak/util-linux/issues/548
Signed-off-by: Karel Zak <kzak@redhat.com>
Add more information when and why one might want to use various options.
Reviewed-by: Dmitry V. Levin <ldv@altlinux.org>
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
Print a message when the format_iso_time() buffer is exceeded, because
there is more than one type of failure that returns -1.
Also remove the corresponding message from hwclock.c.
Signed-off-by: J William Piggott <elseifthen@gmx.com>
Year can wrap when adding the tm struct epoch during iso formatting:
hwclock --utc --noadjfile --predict --date '67768034678844900 seconds'
-2147481749-12-31 23:59:59.000000-05:00
Patched:
hwclock --utc --noadjfile --predict --date '67768034678844900 seconds'
2147485547-12-31 23:59:59.000000-05:00
Comparable to date(1):
date -Ins --date '67768034678844900 seconds'
2147485547-12-31T23:59:59,547886165-0500
Note: the 'seconds' argument is relative to the current time, so
reaching this max year output is a moving target. The values shown
above were invalid one second later. They then overflow tm_year
upon conversion with localtime(3) and friends, which causes them
to return NULL indicating that an error occurred.
Signed-off-by: J William Piggott <elseifthen@gmx.com>
Test for libc time conversion errors in ISO time format functions.
hwclock --utc --noadjfile --predict --date '67768034678846520 seconds'
Segmentation fault
Patched:
hwclock --utc --noadjfile --predict --date '67768034678846520 seconds'
hwclock: time 67768036191695381 is out of range.
Comparable to date(1):
date --date '67768034678846520 seconds'
date: time 67768036191695384 is out of range
Signed-off-by: J William Piggott <elseifthen@gmx.com>
Use reentrant time functions to avoid sending a NULL pointer to
format_iso_time() (and to be reentrant ;). Followup commits test for
errors and tm_year wrapping (illustrated below).
hwclock --utc --noadjfile --predict --date '67768034678849400 seconds'
Segmentation fault
Patched
hwclock --utc --noadjfile --predict --date '67768034678849400 seconds'
-2147481748-01-00 00:10:46.000000-05:00
Signed-off-by: J William Piggott <elseifthen@gmx.com>
The patch enables flock for scsi_debug to avoid collision between
tests. The patch also adds ./run.sh --nolocks to disable this feature.
Signed-off-by: Karel Zak <kzak@redhat.com>
Remove global variable, skip unnecessary comparison, and remove version
printing function when a simple printf() can do the job. In same go fix
compiler warning.
sys-utils/setarch.c:296:4: warning: null argument where non-null required
(argument 2) [-Wnonnull]
execl("/bin/bash", NULL);
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
This is more lightweight than calling stat(3). In same go add a regression
test to ensure changes like this will not break --no-overwrite option.
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
We have command line option -H to disable hostname in login prompt.
Unfortunately, in same cases (e.g. telnetd) it's impossible to specify
login(1) command line options due to hardcoded execl()...
This patch introduces LOGIN_PLAIN_PROMPT boolean for /etc/login.defs
to suppress hostname in the prompt.
Signed-off-by: Karel Zak <kzak@redhat.com>
Based on patch from Vaclav Dolezal <vdolezal@redhat.com>, this
implementation is less invasive.
The patch adds a new while() for pread() call (so diff is mostly code
indention). The pread() is called for a real data only (addressed by
'off' and 'end') and we use SEEK_{DATA,HOLE} before the pread() to
skip already existing holes. The variables 'file_off' and 'file_end'
addresses area in the file as specified on fallocate command line.
Test:
$ truncate -s 10G testfile
$ dd if=/dev/zero of=testfile count=10 bs=1M conv=notrunc
old version:
$ time /usr/bin/fallocate --dig-holes --verbose testfile
testfile: 10 GiB (10737418240 bytes) converted to sparse holes.
real 0m3.013s
user 0m0.700s
sys 0m2.304s
new version:
$ time ./fallocate --dig-holes --verbose testfile
testfile: 10 MiB (10485760 bytes) converted to sparse holes.
real 0m0.026s
user 0m0.002s
sys 0m0.004s
The old version scans all file.
The change has minimal overhead for files without holes.
Addresses: https://github.com/karelzak/util-linux/issues/421
Co-Author: Vaclav Dolezal <vdolezal@redhat.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
It seems better to deallocate logindefs.conf stuff in long time
running (=waiting) processes like login(1) and su(1).
Signed-off-by: Karel Zak <kzak@redhat.com>
The CDROM_SELECT_SPEED should be available practically everywhere. Where
the define is missing an error message about path /proc/sys/dev/cdrom/info
cannot be opened is better error than a warnx() about kernel support.
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
sys-utils/nsenter.c: In function ‘is_same_namespace’:
sys-utils/nsenter.c:170:2: warning: ‘b_ino’ may be used uninitialized in this function [-Wuninitialized]
sys-utils/nsenter.c:170:2: warning: ‘a_ino’ may be used uninitialized in this function [-Wuninitialized]
Signed-off-by: Karel Zak <kzak@redhat.com>
sys-utils/dmesg.c: In function ‘print_record.constprop.12’:
sys-utils/dmesg.c:1039:14: warning: ‘mesg_size’ may be used uninitialized in this function [-Wuninitialized]
Signed-off-by: Karel Zak <kzak@redhat.com>
* don't use booleans
* use is_ prefix for boolean-like functions
* make nsfs_xasputs() more readable
* enable 'nowrap' together with 'raw' and don't test for "nowrap || raw"
* add missing 'W' to getopt_long()
Signed-off-by: Karel Zak <kzak@redhat.com>
This option forces lsns command not use
multi-line presentation when printing a cell.
Currently, it affects only NSFS column.
Implementing this option is suggested by Karl Zak.
Signed-off-by: Masatake YAMATO <yamato@redhat.com>