Sami Kerola [Sun, 5 Mar 2017 20:52:25 +0000 (20:52 +0000)]
blkid: add messages to translations
Without obvious reason blkid has managed to be part of this project for
pretty long time without getting translations. Lets change that. In same
go use the usual error printing facilities instead of fprintf(stderr, ...);
[kzak@redhat.com: - use errtryh(),
- cleanup "unsupported output format"]
Signed-off-by: Sami Kerola <kerolasa@iki.fi> Signed-off-by: Karel Zak <kzak@redhat.com>
Sami Kerola [Sun, 5 Mar 2017 20:52:24 +0000 (20:52 +0000)]
blkid: add curly braces to do-while statement
Some say people read do-while statements are easily as while statements and
get wrong impression. This happens because do-whiles are not common.
Adding braces should make it easier to read the code.
Reference: http://www.spinics.net/lists/linux-kernel-janitors/msg02018.html Signed-off-by: Sami Kerola <kerolasa@iki.fi>
Sami Kerola [Sun, 5 Mar 2017 20:52:23 +0000 (20:52 +0000)]
libblkid: ensure uninitialized variable is not used [clang]
Following condition can be true if minix file system is corrupt, and versio
number is found to be greater than 3. It is fair to say described scenario
is unlikely.
libblkid/src/superblocks/minix.c:107:13: warning: variable 'zone_size' is
used uninitialized whenever
'if' condition is false [-Wsometimes-uninitialized]
} else if (version == 3) {
^~~~~~~~~~~~
libblkid/src/superblocks/minix.c:121:6: note: uninitialized use occurs here
if (zone_size != 0 || ninodes == 0 || ninodes == UINT32_MAX)
^~~~~~~~~
login: prevent OOB read on illegal /etc/hushlogins
If the file /etc/hushlogins exists and a line starts with '\0', the
login tools are prone to an off-by-one read.
I see no reliability issue with this, as it would clearly need a
hostile action from a system administrator. But for the sake of
correctness, I've sent this patch nonetheless.
The SEND_UEVENT=yes|no line is not properly parsed, because the offset
jumps one byte too far behind the equal sign. Therefore, every
configuration that contains the line "SEND_UEVENT=yes" still does not
send an uevent.
The fix is simple: adjust the offset to be "12" instead of "13".
Karel Zak [Fri, 3 Mar 2017 09:37:37 +0000 (10:37 +0100)]
libsmartcols: allow to add column to already used table
Now it's impossible to add new column if the table already contains
lines with data. This patch forces library to realloc cell array in
the lines to accept a new column.
Damien Le Moal [Fri, 24 Feb 2017 06:45:31 +0000 (15:45 +0900)]
blkzone: Add --count option
The length option is used to specify the number of zones to
operate on. To be more consistent with other tools, have this
option use a number of sectors and introduce the --count option
to allow users to specify a number of zones.
The --count and --length options cannot be used together on
the command line.
Signed-off-by: Damien Le Moal <damien.lemoal@wdc.com>
Damien Le Moal [Fri, 24 Feb 2017 03:47:29 +0000 (12:47 +0900)]
blkzone: Improve zone information print
Add "0x" to the zone start, length and write pointer print
to make it always clear that the values are Hexadecimal.
Also update the zone condition string and associated comments
to match more closely the wording in the standard document.
The man page is also updated to match the new wording.
Signed-off-by: Damien Le Moal <damien.lemoal@wdc.com>
Damien Le Moal [Fri, 24 Feb 2017 03:36:08 +0000 (12:36 +0900)]
blkzone: Report all zones if length is not specified
Report all zones of the block device when length is not specified
on the command line. To do this, introduce an inner loop in
blkzone_report to repeatedly issue report zone ioctl to the
device.
Signed-off-by: Damien Le Moal <damien.lemoal@wdc.com>
* add UL_ENABLE_ALIAS(NAME, MASTERNAME) to initialize $enable_<name>
according to MASTERNAME. Note that we have to use $build_<mastername>,
the $enable_<mastername> is just AC_ARG_ENABLE() stuff only. The
$build_ is evaluated and modified by our UL_...() functions.
* add enable-schedutils.conf to have build-system regression test for
this use-case
Addresses: https://github.com/karelzak/util-linux/issues/415 Signed-off-by: Karel Zak <kzak@redhat.com>
Sami Kerola [Sat, 11 Feb 2017 14:10:51 +0000 (14:10 +0000)]
man: improve blkreport(8) and blkreset(8) manual pages
Tell in manual page what ZAC and ZBC acronyms mean. Include explanation to
blkreport output, so that users do not need to search source code to
understand what the tool informed. And fix couple dot double space issues.
Sami Kerola [Sat, 11 Feb 2017 14:10:50 +0000 (14:10 +0000)]
blkreport, blkreset: small code clean ups
Set variables read-only where possible. Fix few code style issues, mostly
with spacing. Avoid initializing variables if they are never read before
next update. Remove "ERR: %d -> %s" message that repeated system error
three times, twice in that message and once at end of main that is the only
of these three left in place.
blkreport: slice up option descriptions, fix typo, fix docstring
Each option plus its description should be a separate translatable
string. And, if all is well, blkreport should not discard anything
-- that is: fix the cut-and-paste error from blkdiscard.
Shaun Tancheff [Mon, 23 Jan 2017 13:32:42 +0000 (20:32 +0700)]
blkzonecmd, blkreport: Add new commands for ZAC/ZBC drives
This patch adds:
- blkreset to issue Reset (Write Pointer) zone commands
- blkreport to retrieve drive zone information
[kzak@redhat.com: - cleanup man page and usage()
- remove command line options aliases,
- use strtosize_or_err()
- remove unnecessary -ludev
- use blkdev.h stuff]
Signed-off-by: Shaun Tancheff <shaun@tancheff.com> Signed-off-by: Karel Zak <kzak@redhat.com>
Karel Zak [Thu, 9 Feb 2017 10:35:50 +0000 (11:35 +0100)]
Merge branch 'hwclock-jwp-reviewed' of git://github.com/kerolasa/lelux-utiliteetit
* 'hwclock-jwp-reviewed' of git://github.com/kerolasa/lelux-utiliteetit: (25 commits)
hwclock: remove --compare option
hwclock: remove trailing dot from messages that include system error message
hwclock: make --date=argument less prone to injection
hwclock: fix rtc atexit registration
hwclock: clarify cmos inb and outb preprocessor directives
hwclock: try RTCGET and RTCSET only when normal rtc fails
hwclock: stream line synchronize_to_clock_tick_rtc()
hwclock: improve coding style
hwclock: remove division by zero [asan]
hwclock: add debugging to open_rtc()
hwclock: remove magic constants from interpret_date_string()
hwclock: use symbolic magic values passed in between functions
hwclock: initialize struct adjtime members
hwclock: alloate date_resp parsing buffer in interpret_date_string()
hwclock: simplify save_adjtime() execution flow
hwclock: remove dead code and other minor fixes
hwclock: move error messages to determine_clock_access_method()
hwclock: clarify set_cmos_epoch() code
hwclock: move command-line options to control structure
hwclock: remove unnecessary type casts
...
Carlos Santos [Wed, 8 Feb 2017 15:27:36 +0000 (13:27 -0200)]
build-sys: improve detection of the "isnan" function in uClibc
Since commit beceb14b450ded6560ed743634a5e80604a8edf3, MATH_LIBS is set
to "-lm" when the isnan function is detected. In uClibc, however, isnan
is a macro that calls __isnan, __isnanf, or __isnanl, depending on the
size of the argument (double, float or long double).
Sami Kerola [Tue, 10 Jan 2017 21:16:20 +0000 (21:16 +0000)]
hwclock: remove --compare option
Compare functionality was printing nonsense values. There is no knowledge
of anyone using this broken functionality. Instead of deprecating the code
for months, and removing it after few release, it is removed immediately.
Needless to say this is unusual removal.
Reference: http://marc.info/?l=util-linux-ng&m=148396210506652&w=2 Signed-off-by: Karel Zak <kzak@redhat.com> Signed-off-by: Sami Kerola <kerolasa@iki.fi>
Sami Kerola [Wed, 27 Jul 2016 18:47:38 +0000 (19:47 +0100)]
hwclock: make --date=argument less prone to injection
This change should not improve security much. One hopes hwclock --set is
restricted for root only. Where hwclock is allowed to run via sudo, or has
setuid setup, there is a pretty easy privilege escalation via subshell.
Sami Kerola [Sun, 24 Jul 2016 21:33:01 +0000 (22:33 +0100)]
hwclock: improve coding style
Make string constants to be symbolical declarations. Use longer variable
name for rtc and cmos function pointer values. Exclude code that is
architecture specific with preprocessor directives. And remove message
duplication.
Sami Kerola [Sun, 17 Jul 2016 16:10:48 +0000 (17:10 +0100)]
hwclock: add debugging to open_rtc()
Earlier when open_rtc() returned -1 the char *rtc_dev_name end up having
NULL that made it unsuitable to be used in error message. Now one can debug
what paths the open_rtc() tries to use when one has to debug why 'cannot
open rtc device' happen.
Reviewed-by: J William Piggott <elseifthen@gmx.com> Signed-off-by: Sami Kerola <kerolasa@iki.fi>