summaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
* agetty: keep returns in main()Karel Zak2017-08-071-3/+3
| | | | | | | Don't use list_speeds() as non-return function, it seems better to keep main() code consistent. Signed-off-by: Karel Zak <kzak@redhat.com>
* agetty: fix invalid usage crashSami Kerola2017-08-051-2/+2
| | | | | | | | | $ agetty agetty: not enough arguments: Success Segmentation fault (core dumped) Reference: 9325dbfd2018b2a3b510617f4aa13777fbbe23c3 Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* agetty: add compile time features to --version outputSami Kerola2017-08-051-1/+45
| | | | | | | | | This command has a lot of compile time #ifdef code. It is time to add feature listing to --version output so understanding command behavior is easier. Proposed-by: Karel Zak <kzak@redhat.com> Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* agetty: add --list-speeds optionSami Kerola2017-08-052-0/+18
| | | | | Proposed-by: Karel Zak <kzak@redhat.com> Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* agetty: remove dead DO_DEVFS_FIDDLING code segmentSami Kerola2017-08-051-39/+0Star
| | | | | | | There is no ./configure option to enable this, and it is unlikely any distribution hot patching to enable fiddling when building package. Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* bash-completion: look for look completionsSami Kerola2017-08-051-3/+10
| | | | | | | | | | The look(1) uses positional arguments, where first one is a word from dictionary. It is reasonable to assume most of the time people search from system word lists so propose completions from there. The second argument is a dictionary file, that might invalidate the first input but that only happens to users who have an idea what the want without bash-completion. Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* libuuid: use access(2) when checking /dev/random availabilitySami Kerola2017-08-051-3/+2Star
| | | | | | | The access(2) is more lightwight than stat(2), and tells whether random device(s) can be read or not, unlike the earlier stat() call. Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* uuidparse: nil uuid have all bits set to zeroSami Kerola2017-08-052-4/+7
| | | | | | | | The nil UUID is special form of UUID that is specified to have all 128 bits set to zero. Reference: https://tools.ietf.org/html/rfc4122#section-4.1.7 Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* vipw: use explicit_bzero() to clear buffer after copySami Kerola2017-08-051-0/+3
| | | | | | | | | | This should make leaking end of /etc/shadow file more unlikely. Notice that there is now way to tell to editors they should ensure none it does not leak any buffers, drop cores, and so on, when editing sensitive data. In short this change is addressing the issue only partially. Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* include: move pamfail.h to auth.cSami Kerola2017-08-053-28/+18Star
| | | | | | | This removes one small header file, and makes inline function to static to only file it is used in. Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* libblkid: add support for UBI superblockRafał Miłecki2017-08-036-0/+59
| | | | | | | | | | | | | | | | | | UBI is a volume management system that can be used on a raw flash partition for providing multiple logical volumes. Detecting UBI superblock may be useful for tools wanting to simplify or automate attaching UBI. Please note it's not directly related to the ubifs support which is just a filesystem working on top of UBI volume. In other words: UBI can be used on MTD partition (e.g. /dev/mtdblock0) while ubifs can be used on UBI volume (e.g. /dev/ubi0_0). This patch adds simple code reading UBI version and unique number and setting it in the blkid_probe. Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
* build-sys: support ncursesw without headers in ncursesw/ directoryKarel Zak2017-08-011-2/+16
| | | | | | | | | | | | Let's check always for alone ncurses.h and term.h if the preferred variant with ncursesw/ subdirectory is not available. The patch also minimize number of HAVE_...NCURSES_H macros in config.h. We don't need to check for ncurses.h if ncurses/ncurses.h is available. Reported-by: Carlos Santos <casantos@datacom.ind.br> Signed-off-by: Karel Zak <kzak@redhat.com>
* libfdisk: add --nopartno to mkpart sampleKarel Zak2017-08-013-6/+49
| | | | | | | | * disable dialogs for the mkpart sample * add --nopartno use-case to force libfdisk to use default partno(s) * add test for this feature Signed-off-by: Karel Zak <kzak@redhat.com>
* setpriv: document accepted formats for naming capsPatrick Steinhardt2017-08-011-1/+6
| | | | | | | | | | | | Since commit fbd15c4d4 (setpriv: support setting unnamed capabilities, 2017-07-17), it is possible to name capabilities not only by name, but also by their index. While using the human-readable name is usually recommended, using the index may be required in case new capabilities have been introduced to the kernel for which we have no name yet. The newly introduce format format is not documented inside of setpriv(1), though, which is being fixed in this commit. Signed-off-by: Patrick Steinhardt <ps@pks.im>
* hwclock: remove custom errno stringJ William Piggott2017-07-312-6/+1Star
| | | | | | | | | | | | | | | | | | | | | | Custom errno messages are unnecessary and problematic for translators. hwclock --directisa hwclock: iopl() port access failed: Operation not permitted hwclock: root privileges may be required The custom errno message is misleading. We do not know what the system permissions are set to. The default errno string is correct, and enough. Patched: hwclock --directisa hwclock: iopl() port access failed: Operation not permitted root@:~# hwclock --directisa -D Using direct ISA access to the clock 2017-07-24 14:49:17.782716-0400 Signed-off-by: J William Piggott <elseifthen@gmx.com>
* hwclock: remove custom errno stringJ William Piggott2017-07-311-14/+12Star
| | | | | | | | | | | | | | Custom errno messages are unnecessary and problematic for translators. The current messages are also too long, > 90 columns: /dev/rtc0 does not have interrupt functions. Waiting in loop for time from \ /dev/rtc0 to change Fixed: ioctl(3, RTC_UIE_ON, 0): Inappropriate ioctl for device Waiting in loop for time from /dev/rtc0 to change Signed-off-by: J William Piggott <elseifthen@gmx.com>
* hwclock: fix unimplemented ioctl testJ William Piggott2017-07-311-2/+2
| | | | | | | | | The rtc driver has not returned EINVAL for unimplemented ioctls since v2.5.8 in 2002. However, it does return it for other errors; making the current test potentially problematic. Since 9f3d0fc util-linux assumes kernel >= 2.6.0 so remove EINVAL as an ioctl test. Signed-off-by: J William Piggott <elseifthen@gmx.com>
* hwclock: squash custom errno stringsJ William Piggott2017-07-311-8/+2Star
| | | | | | | | warn() appends ENOENT as: No such file or directory The custom string is unnecessary and problematic for translators. Signed-off-by: J William Piggott <elseifthen@gmx.com>
* hwclock: squash custom errno stringsJ William Piggott2017-07-311-26/+6Star
| | | | | | | | | | | | | | | | | | | | | | | | | hwclock previously used printf for custom errno messages. Later they were converted to use warn(), but were not squashed. One of the reasons for warn and errno is to avoid making translators deal with a multitude custom strings. Also the custom strings are incorrect: hwclock --hctosys hwclock: Must be superuser to set system clock. Unable to set system clock. We do not know what the system permissions are set to. The correct response is to simply say permission was denied; as the default errno string does. The second line is redundant and just adds noise the code and to logs. Patched: hwclock --hctosys hwclock: settimeofday() failed: Operation not permitted Signed-off-by: J William Piggott <elseifthen@gmx.com>
* build: use --runstatedir instead of --localstatedirAndreas Henriksson2017-07-318-17/+21
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The util-linux code was previously aligned to use @localstatedir@ and the util-linux build system was set to override the default to use /run. Current GNU Coding Standards introduced the @runstatedir@ variable for this purpose. Lets use that instead. The GNU default for @runstatedir@ is ${localstatedir}/run so util-linux still override the default to be /run to preserve the status quo from before. The only difference is that you'll now pass --runstatedir to override the location on the command line instead of --localstatedir. (FWIW, Debhelper in compat 11 will automatically start passing --runstatedir=/run to all autotools configured builds. It already passes --localstatedir=/var (to avoid it ending up with the GNU default /usr/local/var) which breaks the util-linux build system code that tries to default it to /run. This change will thus allow util-linux and debhelper to work better together and avoid the need for a package-specific override.) Relevant historic commits: * commit 07a16b9d1e5a48550a0d19abb9a900853433ffa2 "build-sys: change --localstatedir to /run" * commit 80c51185d50f00a2701f9379f10fc48a0f885dfc "uuidd: use run configured state directory" * commit 01c5b787947aeaffc7e56000827e3edefa357c59 "agetty: use configured run state directory" [kzak@redhat.com: - add $runstatedir fallback for autoconf < 2.70 - check for unmodified $localstatedir] CC: Sami Kerola <kerolasa@iki.fi> Signed-off-by: Andreas Henriksson <andreas@fatal.se> Signed-off-by: Karel Zak <kzak@redhat.com>
* whereis: include native multiarch path in lib search pathsAndreas Henriksson2017-07-312-0/+10
| | | | | | | | | | | | | | | | | This includes atleast the native multiarch path in the paths to search. (Maybe also other multiarch paths should also be searched? But atleast this is a first step.) Before this change (on Debian): $ whereis libc libc: /usr/share/man/man7/libc.7.gz After this change: $ whereis libc libc: /usr/lib/x86_64-linux-gnu/libc.so /usr/lib/x86_64-linux-gnu/libc.a /usr/share/man/man7/libc.7.gz Addresses: https://bugs.debian.org/856968 Signed-off-by: Andreas Henriksson <andreas@fatal.se>
* tunelp: use linux headerSami Kerola2017-07-314-120/+3Star
| | | | | | | | | Remove use of LPTRUSTIRQ in same go. The LPTRUSTIRQ provided --trust-irq option, but it has not worked in nearly 20 years. Reference: http://repo.or.cz/davej-history.git/blobdiff/1f58336fe0515bc929e4de227eb44b12a4a18998..ac5579c68db87bc21630676c167ee8224267f32c:/include/linux/lp.h Reference: http://repo.or.cz/davej-history.git/blobdiff/1f58336fe0515bc929e4de227eb44b12a4a18998..ac5579c68db87bc21630676c167ee8224267f32c:/drivers/char/lp.c Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* fstab(5): mention how tabs are escapedAndreas Henriksson2017-07-311-1/+2
| | | | | | | | Someone requested explicitly mentioning how tabs are escaped, in addition to the already existing spaces example. Addresses: https://bugs.debian.org/580047 Signed-off-by: Andreas Henriksson <andreas@fatal.se>
* hwclock: remove m68k and alpha cmos from manualJ William Piggott2017-07-311-9/+0Star
| | | | | | | m68k removed in commit 846c7d3 alpha cmos removed in commit c47a618 Signed-off-by: J William Piggott <elseifthen@gmx.com>
* wdctl: do not call fsync(2) when closing watchdog deviceSami Kerola2017-07-311-2/+2
| | | | | | | | | | | This removes bogus write failed warning. $ wdctl wdctl: write failed: Invalid argument Device: /dev/watchdog [...] Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* Docs: update howto-usage-function.txtJ William Piggott2017-07-311-15/+15
| | | | Signed-off-by: J William Piggott <elseifthen@gmx.com>
* libsmartcols: fix comment (to make gtk-docs happy)Karel Zak2017-07-311-1/+1
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* column: (-t) disable encoding for non-printable charsKarel Zak2017-07-311-1/+3
| | | | | | | | | $ echo -e '\033[34mBLUE{1\n\033[31mRED{2\n' | ./column -s '{' -t BLUE 1 RED 2 Addresses: https://github.com/karelzak/util-linux/issues/490 Signed-off-by: Karel Zak <kzak@redhat.com>
* libsmartcols: add scols_table_enable_noencoding()Karel Zak2017-07-316-18/+76
| | | | | | | | Now the library encode all output. It seems too strict and difficult to use the library for some use-cases -- for example if you want to use the library for already colorized output (by esc.sequences). Signed-off-by: Karel Zak <kzak@redhat.com>
* agetty: fix --login-pause logicKarel Zak2017-07-311-2/+1Star
| | | | | | | Let's "eat" ENTER key when pressed after login pause prompt. Addresses: https://github.com/karelzak/util-linux/issues/491 Signed-off-by: Karel Zak <kzak@redhat.com>
* libblkid: add HPE extended-XFS to known filesystemsMark Tinguely2017-07-204-0/+190
| | | | | | | | | | | | | | The HPE (formerly SGI) enhanced XFS has changed its magic version number to allow the use of EXFS and community XFS filesystems at the same time. This patch adds HPE EXFS support to libblkid. [kzak@redhat.com: - removed EXFS log prober, it uses the same magic string as XFS log] Signed-off-by: Mark Tinguely <mark.tinguely@hpe.com> Signed-off-by: Karel Zak <kzak@redhat.com>
* hwclock: fix regression from c3ae785J William Piggott2017-07-201-3/+3
| | | | | | | | | | | | hwclock --get foo hwclock: 3 too many arguments given Fixed: hwclock --get foo hwclock: 1 too many arguments given Signed-off-by: J William Piggott <elseifthen@gmx.com>
* hwclock: remove unused epoch_optionJ William Piggott2017-07-202-2/+1Star
| | | | | | Also one whitespace fix. Signed-off-by: J William Piggott <elseifthen@gmx.com>
* tests: check sfdisk resize on unsorted offsetsKarel Zak2017-07-192-0/+100
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* libfdisk: allow to resize in unsorted partition tableKarel Zak2017-07-191-4/+10
| | | | | | | The current code assumes that partition offsets (starts) are sorted. This is usual situation, but unsorted partition table is also valid... Signed-off-by: Karel Zak <kzak@redhat.com>
* libfdisk: improve table print debugsKarel Zak2017-07-192-5/+14
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* cfdisk: add resize functionKarel Zak2017-07-191-7/+49
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* libfdisk: support default partno in mkpart-fullspec sampleKarel Zak2017-07-195-15/+166
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* libfdisk: add fdisk_disable_dialogs()Karel Zak2017-07-198-6/+60
| | | | | | | | | | | | | | | The default (for historical reasons) is to use dialog driven partitioning. It's possible to avoid dialogs by fdisk_partition template for fdisk_add_partition(). Unfortunately in some case (mostly DOS driver) it's not enough, because we need to distinguish between logical and primary partitions. If we know that dialogs are unwanted then we can default to primary partition, etc. This function simplify semantic of the library for non-interactive programs. Signed-off-by: Karel Zak <kzak@redhat.com>
* libfdisk: (dos) return EINVAL when delete unused partitionKarel Zak2017-07-191-2/+17
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* blkid: Add dm-integrity superblock signatureMilan Broz2017-07-183-0/+40
| | | | | | | | | | Since the kernel version 4.12 there is a new dm-integrity module that provides an emulated per-sector metadata format for storing data integrity. This patch adds dm-integrity magic signature to blkid to recognize such a block device. Signed-off-by: Milan Broz <gmazyland@gmail.com>
* script: fix ambiguity about the optional argument of the -t optionAntonio Ospite2017-07-182-9/+9
| | | | | | | | [kzak@redhat.com: - merge two patches from Antonio to the one, - update the patch] Signed-off-by: Karel Zak <kzak@redhat.com> Signed-off-by: Antonio Ospite <ao2@ao2.it>
* setpriv: support setting unnamed capabilitiesPatrick Steinhardt2017-07-181-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When setting capabilities, we accept human readable names like for example `sys_rawio` or `net_admin`. To do so the translation between the capability name and its in-kernel index, we rely on the function `capng_name_to_capability`. When the function does not know the named capability, it will return an error value and we abort setting the capability. This relies upon the ability of libcap to know all capabilities inside of the kernel. But actually, it is possible that new capabilities are introduced inside of the Linux kernel which are not recognized yet by the library. When dumping these unknown capabilities, libcap will simply return a string like "cap_38", that is it will append the capability's in-kernel index to the prefix "cap_". This may lead a user to also think that "cap_38" may be passed to the switches "--inh-caps" or "--ambient-caps", which is unfortunately not the case. We can do better here by instead accepting strings in the form of "cap_N". To do so, we can simply rely on the fact that capability indices are steadily increasing and that the highest index known to the kernel is stored inside of the kernel's procfs, made readily available by our function `real_cap_last_cap()`. So in case libcap does not know a capability name, we can simply parse the string and, if it is in the correct format, check whether the detected index is between 0 and the highest capability index. If so, we can treat it as a valid capability string and apply it. Signed-off-by: Patrick Steinhardt <ps@pks.im>
* libfdisk: fix warning -Wunused-functionRuediger Meier2017-07-181-0/+2
| | | | Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
* build-sys: don't use non-existing UUID_LIBSRuediger Meier2017-07-183-3/+3
| | | | | | | We've added UUID_LIBS in f77a4d1087 but I don't see what it was good for. Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
* libfdisk: use fdisk_sector_t consistently and fix printf format stringsRuediger Meier2017-07-182-5/+5
| | | | Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
* parse-date: fix printf formatRuediger Meier2017-07-181-1/+1
| | | | | | | | | | warning on 32bit systems: ../lib/parse-date.y: In function 'parse_date': ../lib/parse-date.y:1509:7: warning: format '%ld' expects argument of type 'long int', but argument 4 has type 'intmax_t' [-Wformat=] abs_time_zone_min); ^ Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
* tests: remove UUIDs with time overflow from uuidparseKarel Zak2017-07-182-4/+0Star
| | | | | | | | The time_t used by timeval is "long", it means too small on 32-bits archs to hold large numbers. Reported-by: Ruediger Meier <ruediger.meier@ga-group.nl> Signed-off-by: Karel Zak <kzak@redhat.com>
* libmount: make mnt_context_is_fs_mounted work for /procIvan Delalande2017-07-181-2/+12
| | | | | | | | | | | | Assume that /proc is not mounted instead of returning an error when we are unable to open the mounts and mountinfo files in /proc. Also set cxt->mtab back to NULL so that it gets properly parsed when we check if the next filesystem is mounted. The goal is to have mount -a work when /proc is not mounted, typically with /proc on the first line of fstab. Signed-off-by: Ivan Delalande <colona@arista.com>
* Merge branch '170711' of github.com:jwpi/util-linuxKarel Zak2017-07-174-53/+32Star
|\ | | | | | | | | | | | | | | * '170711' of github.com:jwpi/util-linux: hwclock: improve RTC epoch messages hwclock: improve RTC epoch messages hwclock: remove dead ioctl check hwclock: --epoch presence test fails