summaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
* Merge branch '2019wk29' of https://github.com/kerolasa/util-linuxKarel Zak2019-07-291-1/+1
|\ | | | | | | | | * '2019wk29' of https://github.com/kerolasa/util-linux: lscpu: prefer memcpy() to manual pointer arithmetic
| * lscpu: prefer memcpy() to manual pointer arithmeticSami Kerola2019-07-271-1/+1
| | | | | | | | | | | | | | | | | | | | | | With pointer arithmetic clang address sanitizer gives following error this change addresses. Notice the following happens only when running as root. sys-utils/lscpu-dmi.c:83:14: runtime error: load of misaligned address 0x55a1d62f3d1d for type 'const uint16_t' (aka 'const unsigned short'), which requires 2 byte alignment Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* | column: fix outputing empty column at the end of lineYousong Zhou2019-07-294-1/+11
|/ | | | | | | | | | | | | The following commands manifests the problem. In old versions before commit 4762ae9d60 ("column: use libsmartcols for --table"), both of them should output with 2 "|" echo '||' | column -o '|' -s '|' -t echo '|| ' | column -o '|' -s '|' -t Fixes: 4762ae9d60 ("column: use libsmartcols for --table") Signed-off-by: Yousong Zhou <zhouyousong@yunionyun.com> Reviewed-by: Sami Kerola <kerolasa@iki.fi>
* lscpu: (man) add note about cache sizesKarel Zak2019-07-251-0/+5
| | | | | Addresses: https://github.com/karelzak/util-linux/issues/827 Signed-off-by: Karel Zak <kzak@redhat.com>
* agetty: simplify code in dolog() preprocessor blocksSami Kerola2019-07-241-26/+20Star
| | | | | | | | Aim is to make dolog() a lot more readable and understandable, with downside of when (rarely?) USE_SYSLOG it not defined the function will use a bit more space from stack. I think that is price well worth paying. Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* login: simplify string handlingSami Kerola2019-07-241-4/+1Star
| | | | Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* last: replace strncat() with more robust mem2strcpy()Sami Kerola2019-07-241-2/+1Star
| | | | Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* tests: (fdisk) update padding in outputKarel Zak2019-07-231-3/+3
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* tests: (libsmartcols) add padding testsKarel Zak2019-07-235-0/+89
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* libsmartcols: cleanup and extend padding functionalityKarel Zak2019-07-239-45/+188
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | LIBSMARTCOLS_DEBUG_PADDING=on in the next examples forces libsmartcols print '.' as a padding char. See line "ffff" in the exmaples. * default output is to fill all except last cell $ LIBSMARTCOLS_DEBUG_PADDING=on ./sample-scols-fromfile --nlines 10 --width 80 --column tests/ts/libsmartcols/files/col-name --column tests/ts/libsmartcols/files/col-number --column tests/ts/libsmartcols/files/col-string --column tests/ts/libsmartcols/files/col-string tests/ts/libsmartcols/files/data-string tests/ts/libsmartcols/files/data-number tests/ts/libsmartcols/files/data-string-empty tests/ts/libsmartcols/files/data-string-empty 2> /dev/null NAME.. ......NUM STRINGS STRINGS aaaa.. ........0 aaaa... aaaa bbb... ......100 bbb.... bbb ccccc. .......21 ccccc.. ccccc dddddd ........3 dddddd. dddddd ee.... ......411 ee..... ee ffff.. .....5111 ....... gggggg 678993321 gggggg. gggggg hhh... ..7666666 hhh.... hhh * scols_table_enable_minout() minimizes output for tailing empty cells, example: $ LIBSMARTCOLS_DEBUG_PADDING=on ./sample-scols-fromfile --nlines 10 --minout --width 80 --column tests/ts/libsmartcols/files/col-name --column tests/ts/libsmartcols/files/col-number --column tests/ts/libsmartcols/files/col-string --column tests/ts/libsmartcols/files/col-string tests/ts/libsmartcols/files/data-string tests/ts/libsmartcols/files/data-number tests/ts/libsmartcols/files/data-string-empty tests/ts/libsmartcols/files/data-string-empty 2> /dev/null NAME.. ......NUM STRINGS STRINGS aaaa.. ........0 aaaa... aaaa bbb... ......100 bbb.... bbb ccccc. .......21 ccccc.. ccccc dddddd ........3 dddddd. dddddd ee.... ......411 ee..... ee ffff.. .....5111 gggggg 678993321 gggggg. gggggg hhh... ..7666666 hhh.... hhh * cleanup up scols_table_enable_maxout() use, example: $ LIBSMARTCOLS_DEBUG_PADDING=on ./sample-scols-fromfile --nlines 10 --maxout --width 80 --column tests/ts/libsmartcols/files/col-name --column tests/ts/libsmartcols/files/col-number --column tests/ts/libsmartcols/files/col-string --column tests/ts/libsmartcols/files/col-string tests/ts/libsmartcols/files/data-string tests/ts/libsmartcols/files/data-number tests/ts/libsmartcols/files/data-string-empty tests/ts/libsmartcols/files/data-string-empty 2> /dev/null NAME.............. ..................NUM STRINGS............ STRINGS............ aaaa.............. ....................0 aaaa............... aaaa............... bbb............... ..................100 bbb................ bbb................ ccccc............. ...................21 ccccc.............. ccccc.............. dddddd............ ....................3 dddddd............. dddddd............. ee................ ..................411 ee................. ee................. ffff.............. .................5111 ................... ................... gggggg............ ............678993321 gggggg............. gggggg............. hhh............... ..............7666666 hhh................ hhh................ Note that we cannot make scols_table_enable_minout() default because for example "column --table" is pretty commonly used with non-blank columns separator and in this case all cells has to be filled. $ echo -e "aa,b,ccc\na,,\naaa,bbb,ccc" | column --table --separator ',' --output-separator '|' aa |b |ccc a | | aaa|bbb|ccc Addresses: https://github.com/karelzak/util-linux/issues/826 Signed-off-by: Karel Zak <kzak@redhat.com>
* libfdisk: improve partition copy on resizeKarel Zak2019-07-221-0/+6
| | | | | | | | It seems pretty fragile to copy also reference counting and reference to table list. Addresses: https://github.com/karelzak/util-linux/pull/822 Signed-off-by: Karel Zak <kzak@redhat.com>
* libblkid: (drbd) fix comment formattingKarel Zak2019-07-221-3/+4
| | | | | | ... to avoid misinterpretation by gtk-docs. Signed-off-by: Karel Zak <kzak@redhat.com>
* Merge branch 'master_fix-partition-copy' of ↵Karel Zak2019-07-221-0/+4
|\ | | | | | | https://github.com/vojtechtrefny/util-linux
| * libfdisk: Fix double free of *_chs strings in fdisk_partitionVojtech Trefny2019-07-191-0/+4
| | | | | | | | | | | | | | __copy_partition doesn't duplicate these strings which leads to occasional double free. Signed-off-by: Vojtech Trefny <vtrefny@redhat.com>
* | fstrim: fix systemd service protectionKarel Zak2019-07-221-1/+1
|/ | | | | | | | ProtectHome=yes makes /home inaccessible, but we need to open the directories (mountpoints) read-only. Addresses: https://github.com/karelzak/util-linux/issues/824 Signed-off-by: Karel Zak <kzak@redhat.com>
* libfdisk: don't use NTFS as MBRKarel Zak2019-07-171-1/+3
| | | | | | Same as 7c643ed2855058657798d9e8e80701023de14a08. Signed-off-by: Karel Zak <kzak@redhat.com>
* libblkid: do not interpret NTFS as MBRKarel Zak2019-07-173-1/+31
| | | | | | | | | | | | | | | # mkntfs -Q -F /dev/sdc old version: # ./blkid -p /dev/sdc /dev/sdc: UUID="0E9E8C5F2F718479" TYPE="ntfs" USAGE="filesystem" PTTYPE="dos" new version:  # ./blkid -p /dev/sdc /dev/sdc: UUID="0E9E8C5F2F718479" TYPE="ntfs" USAGE="filesystem" Reported-by: Mike Fleetwood <mike.fleetwood@googlemail.com> Signed-off-by: Karel Zak <kzak@redhat.com>
* libfdisk: don't use FAT as MBRKarel Zak2019-07-172-5/+15
| | | | | | | | | The current libfdisk MBR detection is too weak, the result is that it reuses MBR from FAT. The correct behavior is to create a new MBR, wipe first sector (on write) and warn about obsolete FAT superblock. Reported-by: Mike Fleetwood <mike.fleetwood@googlemail.com> Signed-off-by: Karel Zak <kzak@redhat.com>
* build-sys: improve hwclock CMOS dependencesKarel Zak2019-07-151-10/+9Star
| | | | | | | Let's use standard UL_* macros to check for dependencies (architectures and hwclock). Signed-off-by: Karel Zak <kzak@redhat.com>
* build-sys: add UL_REQUIRES_ARCH()Karel Zak2019-07-151-1/+41
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* hwclock: use CMOS clock only if availableCarlos Santos2019-07-154-43/+26Star
| | | | | | | | | | | | - Add --disable-hwclock-cmos configuration argument - Add USE_HWCLOCK_CMOS (enabled by default for i386/x86_64) - Add define(USE_HWCLOCK_CMOS) - Compile hwclock-cmos.c only if USE_HWCLOCK_CMOS is true - Remove all unnecessary #ifdefs from hwclock-cmos.c - Add #ifdef USE_HWCLOCK_CMOS around the determine_clock_access_method() call in hwclock.c Signed-off-by: Carlos Santos <unixmania@gmail.com>
* tests: (libmount) make X-* and x-* more robustKarel Zak2019-07-153-3/+4
| | | | | Addresses: https://github.com/karelzak/util-linux/issues/818 Signed-off-by: Karel Zak <kzak@redhat.com>
* lsblk: fix -E segfaultKarel Zak2019-07-151-0/+2
| | | | | | | | We need to check if referenced wholedisk defines the de-duplication key... Addresses: https://github.com/karelzak/util-linux/issues/819 Signed-off-by: Karel Zak <kzak@redhat.com>
* libblkid: (drbd) simplify paddingKarel Zak2019-07-151-4/+14
| | | | | | | | | We do not need all the metadata and it seems the extra padding is problematic in some cases. Let's keep is simple and use fixed offset for the metadata rather than sizeof(). References: https://github.com/karelzak/util-linux/pull/820 Signed-off-by: Karel Zak <kzak@redhat.com>
* Merge branch '2019wk27' of https://github.com/kerolasa/util-linuxKarel Zak2019-07-158-18/+24
|\ | | | | | | | | | | | | | | | | | | * '2019wk27' of https://github.com/kerolasa/util-linux: libblkid: fix address sanitizer issues libblkid: check number of test_blkid_save arguments correctly include/xalloc: ensure xstrdup() and xstrndup() returns nonnull attribute libmount: fix potential null pointer dereference libfdisk: fix variable shadowing lib/ttyutils: avoid checking same thing twice
| * libblkid: fix address sanitizer issuesSami Kerola2019-07-142-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | With aligned attribute many blkid tests fail with following error. So instead of aligning to 4K add padding that makes the struct same size without causing asan trip over. libblkid/src/superblocks/drbd.c:179:6: runtime error: member access within misaligned address 0x55913d7e6958 for type 'struct meta_data_on_disk_9', which requires 4096 byte alignment In zfs structure it seems compiler is adding padding, that does not mix well with be32_to_cpu() and other bit operations. libblkid/src/superblocks/zfs.c:109:23: runtime error: load of misaligned address 0x7ff6406540e4 for type 'uint32_t' (aka 'unsigned int'), which requires 8 byte alignment Signed-off-by: Sami Kerola <kerolasa@iki.fi>
| * libblkid: check number of test_blkid_save arguments correctlySami Kerola2019-07-141-1/+1
| | | | | | | | | | | | | | Without this running test_blkid_save without arguments will cause a crash when strdup() refers to none-exiting file name. Signed-off-by: Sami Kerola <kerolasa@iki.fi>
| * include/xalloc: ensure xstrdup() and xstrndup() returns nonnull attributeSami Kerola2019-07-142-5/+9
| | | | | | | | | | | | | | Turned out lsblk is passing null as argument to xstrdup(), so fix that and add assert() to make sure promise of not returning null is kept in future. Signed-off-by: Sami Kerola <kerolasa@iki.fi>
| * libmount: fix potential null pointer dereferenceSami Kerola2019-07-121-1/+3
| | | | | | | | | | | | | | | | | | | | This is false positive warning, but lets silence it so that if and when warnings crop up they are easy to notice and take seriously. libmount/src/optstr.c:354:29: warning: potential null pointer dereference [-Wnull-dereference] Signed-off-by: Sami Kerola <kerolasa@iki.fi>
| * libfdisk: fix variable shadowingSami Kerola2019-07-121-1/+1
| | | | | | | | | | | | | | libfdisk/src/context.c:678:7: warning: declaration of ‘rc’ shadows a previous local [-Wshadow] Signed-off-by: Sami Kerola <kerolasa@iki.fi>
| * lib/ttyutils: avoid checking same thing twiceSami Kerola2019-07-011-8/+8
| | | | | | | | | | | | Check cols and lines are not NULL only once. Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* | build-sys: Include <stdlib.h> in ./configure wchar_t testFlorian Weimer2019-07-151-0/+1
|/ | | | | | | | Without #include <stdlib.h>, this configure check fails for strict C99/C11 compilers which do not support implicit function declarations (which are a C90 feature removed from C99). Signed-off-by: Karel Zak <kzak@redhat.com>
* lsblk: force to print PKNAME for partitionKarel Zak2019-06-271-0/+3
| | | | | | | | | | PKNAME (parent kernel device name) is based on printed tree according to parent -> child relationship. The tree is optional and not printed if partition specified (.e.g "lsblk -o+PKNAME /dev/sda1"), but old versions print the PKNAME also in this case. Addresses: https://github.com/karelzak/util-linux/issues/813 Signed-off-by: Karel Zak <kzak@redhat.com>
* TODO: fix typoSanchit Saini2019-06-211-1/+1
|
* Fix translations for losetup typo fixStanislav Brabec2019-06-2110-14/+14
| | | | Signed-off-by: Stanislav Brabec <sbrabec@suse.cz>
* losetup: Typo fixStanislav Brabec2019-06-211-1/+1
| | | | | | Fix a typo in usage introduced in a1a41597bf. Signed-off-by: Stanislav Brabec <sbrabec@suse.cz>
* agetty: Remove superfluous fflush()Stanislav Brabec2019-06-211-2/+0Star
| | | | | | | | | | | | | | eval_issue_file() contains fflush(stdout). It comes from an old code that used fputs() to write to the console. In the new code, we write to a temporary memstream, and fclose(ie->output) fully replaces possible fflush(ie->output) in this implementation. The new print_issue_file() does not need it as well, as it uses unbuffered write_all(). Signed-off-by: Stanislav Brabec <sbrabec@suse.cz>
* libfdisk: fix typosMarcos Mello2019-06-204-14/+14
|
* Revert "lib/loopdev.c: Inline loopcxt_has_device"Karel Zak2019-06-181-1/+1
| | | | | | ... no caller in that file, this change has no effect. This reverts commit 3bb960c7b5f1428f1bff885b2667787e8af5001b.
* libfdisk: add fdisk_assign_device_by_fd()Karel Zak2019-06-185-48/+99
| | | | | | | | It's possible that caller has the device already opened for some other task, so let's reuse the file descriptor. Requested-by: Lennart Poettering <lennart@poettering.net> Signed-off-by: Karel Zak <kzak@redhat.com>
* Merge branch 'su_err_msg' of https://github.com/jhrozek/util-linuxKarel Zak2019-06-181-1/+3
|\ | | | | | | | | * 'su_err_msg' of https://github.com/jhrozek/util-linux: su: More descriptive error message on malformed user entry
| * su: More descriptive error message on malformed user entryJakub Hrozek2019-05-311-1/+3
| | | | | | | | | | | | | | | | | | | | | | With users coming from LDAP, it is often the case that the entry in LDAP does not contain one or more attributes required by su or, because of misconfigured access control rights, the attribute might not be readable by the LDAP client. In that case, su just tells the user that the user does not exist. It might be more user-friendly to tell the user to check the user entry for all required fields.
* | Merge branch 'topic/wdctl'Karel Zak2019-06-174-86/+193
|\ \
| * | wdctl; read from /sys if necessaryKarel Zak2019-06-173-9/+77
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The device can be inaccessible for non-root user or busy (already used by another process). In this case it seems better to read information from /sys. Note that /sys does not provide struct watchdog_info.options, so we cannot print list of supported watchdog features. Addresses: https://github.com/karelzak/util-linux/issues/804 Signed-off-by: Karel Zak <kzak@redhat.com>
| * | lib/path: make sure ul_path_read_buffer() derminate resultKarel Zak2019-06-171-2/+3
| | | | | | | | | | | | Signed-off-by: Karel Zak <kzak@redhat.com>
| * | wdctl: default to /dev/watchdog0Karel Zak2019-06-172-10/+36
| | | | | | | | | | | | | | | | | | | | | Let's use miscdev /dev/watchdog as fallback only. We need (if possible) cdev /dev/watchdog0 as this device has entry in /sys/class/watchdog. Signed-off-by: Karel Zak <kzak@redhat.com>
| * | wdctl: remove printing from main()Karel Zak2019-06-171-27/+35
| | | | | | | | | | | | Signed-off-by: Karel Zak <kzak@redhat.com>
| * | wdctl: add control structKarel Zak2019-06-171-27/+31
| | | | | | | | | | | | | | | | | | | | | * remove global variables * keep all together Signed-off-by: Karel Zak <kzak@redhat.com>
| * | wdctl: rename watch dog info structKarel Zak2019-06-171-27/+27
| | | | | | | | | | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* | | include/closestream: avoid close more than onceKarel Zak2019-06-171-2/+5
| | | | | | | | | | | | Signed-off-by: Karel Zak <kzak@redhat.com>