summaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
* column: use err_exclusive_options()Karel Zak2017-05-021-3/+14
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* column: make mbs/wcs conversions more robustKarel Zak2017-05-021-2/+2
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* column: add --jsonKarel Zak2017-05-022-3/+27
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* column: add --table-colnamesKarel Zak2017-05-022-10/+39
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* column: rename too generic macroKarel Zak2017-05-021-6/+5Star
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* column: use libsmartcols for --tableKarel Zak2017-05-021-154/+121Star
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* column: clean up multi-byte #ifelseKarel Zak2017-05-021-25/+10Star
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* column: reorder functionsKarel Zak2017-05-021-136/+139
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* column: rename functionsKarel Zak2017-05-021-7/+8
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* tests: add column(1) table testKarel Zak2017-05-027-4/+42
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* tests: add column(1) columnate testKarel Zak2017-05-0211-35/+80
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* column: don't ignore mbs_to_wcs() errorsKarel Zak2017-05-021-0/+2
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* tests: add column/files directoryKarel Zak2017-05-024-5/+5
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* column: make input() more genericKarel Zak2017-05-021-62/+53Star
| | | | | | | | * remove line size limit * use multi-byte rather than wchar when read input * prepare for future libsmartcols use in input() for table Signed-off-by: Karel Zak <kzak@redhat.com>
* column: use colntrol struct on more placesKarel Zak2017-05-021-58/+61
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* columns: add control structKarel Zak2017-05-021-21/+35
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* column: split old and new codeKarel Zak2017-05-023-2/+502
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* Merge branch 'master' of https://github.com/pali/util-linuxKarel Zak2017-05-029-4/+23
|\ | | | | | | | | | | | | * 'master' of https://github.com/pali/util-linux: tests: Add UDF hdd images created by Linux mkudffs 1.3 tests: Rename udf-hdd-mkudffs* images to indicate used mkudffs version libblkid: udf: For better readibility use one snprintf call instead multiple in loop
| * tests: Add UDF hdd images created by Linux mkudffs 1.3Pali Rohár2017-05-014-0/+18
| | | | | | | | | | | | | | | | $ dd if=/dev/zero of=udf-hdd-mkudffs-1.3-1.img bs=1M count=10 $ mkudffs -l Label -b 512 udf-hdd-mkudffs-1.3-1.img $ dd if=/dev/zero of=udf-hdd-mkudffs-1.3-2.img bs=1M count=10 $ mkudffs -l Label udf-hdd-mkudffs-1.3-2.img
| * tests: Rename udf-hdd-mkudffs* images to indicate used mkudffs versionPali Rohár2017-05-014-0/+0
| |
| * libblkid: udf: For better readibility use one snprintf call instead multiple ↵Pali Rohár2017-05-011-4/+5
| | | | | | | | in loop
* | Merge branch '170419' of github.com:jwpi/util-linuxKarel Zak2017-05-021-14/+13Star
|\ \ | |/ |/| | | | | | | | | | | * '170419' of github.com:jwpi/util-linux: hwclock: use a consistent name for --predict hwclock: remove unneeded braces hwclock: make clock test mode message consistent hwclock: extra messages for debug only
| * hwclock: use a consistent name for --predictJ William Piggott2017-04-271-5/+5
| | | | | | | | | | | | | | | | | | | | | | | | The predict function name is documented as '--predict', but the code uses '--predict-hc'. This works okay, except that the 'mutually exclusive' error message prints the undocumented name. * sys-utils/hwclock.c: rename 'predict-hc' to 'predict' so that it matches the man-page. This should not be a problem because 'predict-hc' was never documented. Signed-off-by: J William Piggott <elseifthen@gmx.com>
| * hwclock: remove unneeded bracesJ William Piggott2017-04-271-2/+1Star
| | | | | | | | Signed-off-by: J William Piggott <elseifthen@gmx.com>
| * hwclock: make clock test mode message consistentJ William Piggott2017-04-271-3/+3
| | | | | | | | Signed-off-by: J William Piggott <elseifthen@gmx.com>
| * hwclock: extra messages for debug onlyJ William Piggott2017-04-271-4/+4
| | | | | | | | | | | | | | Only print extra save_adjtime() messages in debug mode. This makes the --test mode output consistent accross functions. Signed-off-by: J William Piggott <elseifthen@gmx.com>
* | lib/timer: add commentKarel Zak2017-04-281-0/+17
| | | | | | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* | Merge branch 'timer' of https://github.com/Villemoes/util-linuxKarel Zak2017-04-281-5/+7
|\ \
| * | lib/timer.c: prevent pathological race conditionRasmus Villemoes2017-04-261-4/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | flock(1) uses the timer facility to interrupt a blocking flock(2) call. However, in a pathological case (or with a sufficiently short timeout), the timer may fire and the signal be delivered after the timer is set up, but before we get around to doing the flock(2) call. In that case, we'd block forever. Checking timeout_expired right before calling flock(2) does not eliminate that race, so the only option is to make the timer fire repeatedly. Having the timer fire after we've returned from flock(2) is not a problem, since we only check timeout_expired in case of EINTR (also, this firing after return could also happen with the current code). There is currently one other user of setup_timer (misc-utils/uuidd.c), but in that case the signal handler simply exits. Future users of setup_timer obviously need to ensure that they can tolerate multiple signal deliveries. Choosing 1% of the initial timeout as the repeating interval is somewhat arbitrary. However, I put a lower bound of 0.01s, since setting the interval much smaller than this may end up effectively live-locking the process, handling a never-ending stream of signals. Signed-off-by: Rasmus Villemoes <rasmus.villemoes@prevas.dk>
| * | lib/timer.c: remove bogus SA_SIGINFO from timer_settime callRasmus Villemoes2017-04-261-1/+1
| |/ | | | | | | | | | | | | | | | | The only valid flag for timer_settime is TIMER_ABSTIME, which we certainly don't want here. This seems to be harmless since timer_settime doesn't validate the flags parameter, TIMER_ABSTIME is universally 0x1, and no architecture has SA_SIGINFO == 1. Signed-off-by: Rasmus Villemoes <rasmus.villemoes@prevas.dk>
* | libmount: (docs) remove unwanted tagKarel Zak2017-04-281-1/+1
| | | | | | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* | tests: update libmount outputsKarel Zak2017-04-286-13/+18
| | | | | | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* | libmount: add read-only warningKarel Zak2017-04-283-7/+5Star
| | | | | | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* | include/exitcodes: remove mount(8) exit codesKarel Zak2017-04-271-10/+0Star
| | | | | | | | | | | | All defined by libmount now. Signed-off-by: Karel Zak <kzak@redhat.com>
* | fstrim: use MNT_EX_* from libmountKarel Zak2017-04-271-4/+4
| | | | | | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* | mount: use MNT_EX_* from libmountKarel Zak2017-04-271-29/+28Star
| | | | | | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* | umount: use MNT_EX_* from libmountKarel Zak2017-04-271-28/+27Star
| | | | | | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* | libmount: (docs) add unused declarationsKarel Zak2017-04-271-0/+1
| | | | | | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* | mount, umount: use mnt_context_get_excode()Karel Zak2017-04-272-457/+28Star
| | | | | | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* | libmount: add mnt_context_get_excode()Karel Zak2017-04-277-5/+609
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | It's pretty complex task to make mount(8) and umount(8) return code and generate error message. It seems better to do that in the libmount rather than force all library users to duplicate mount(8) mk_exit_code() functions. It also means that all the messages will be translated only once. Changes: * all error messages are printed by warn() * no more multi-line messages * all messages prefixed by mount target (mountpoint) * library provides mount(8) compatible MNT_EX_* codes Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=1429531 Signed-off-by: Karel Zak <kzak@redhat.com>
* | libmount: support MS_RDONLY on write-protected devicesKarel Zak2017-04-268-33/+109
| | | | | | | | | | | | | | | | This feature is supported by mount(8) only. It seems better move this code to libmount. The results is more simple mount(8) and the feature is accessible for all libmount users. Signed-off-by: Karel Zak <kzak@redhat.com>
* | umount: fix typoKarel Zak2017-04-261-1/+1
|/ | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* switch_root: unlink files without _DIRENT_HAVE_D_TYPEPatrick Steinhardt2017-04-261-4/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | When _DIRENT_HAVE_D_TYPE is not defined, we need to always fstat the directory entry in order to determine whether it is a directory or not. If we determine that the file is indeed a directory on the same device, we proceed to recursively remove its contents as well. Otherwise, we simply skip removing the entry altogether. This logic is not entirely correct though. Note that we actually skip deletion of the entry if it is either not a directory or if it is not on the same device. The second condition is obviously correct here, as we do not want to delete files on other mounts here. But skipping deletion of the entry itself if it is not a directory is wrong. When _DIRENT_HAVE_D_TYPE is defined, this condition should never be triggered, as we have already determined that the entry is a directory. But if it is not, we will always do the fstat and check. Because of this, we will now skip deletion of all files which are not directories, which is wrong. Fix the issue by disentangling both conditions. We now first check whether we are still on the same device - if not, we skip recursive deletion as well as deletion of the directory entry. Afterwards, we check whether it is a directory - if so, we do delete its contents recursively. And finally, we will now unlink the entry disregarding whether it is a directory or not. Signed-off-by: Patrick Steinhardt <ps@pks.im>
* Merge branch '170415' of github.com:jwpi/util-linuxKarel Zak2017-04-263-57/+48Star
|\ | | | | | | | | | | | | | | | | * '170415' of github.com:jwpi/util-linux: optutils.h: don't print non-graph characters hwclock: improve audit control hwclock: --set and --predict segmentation fault hwclock: make epoch functions alpha only hwclock: improve default function handling
| * optutils.h: don't print non-graph charactersJ William Piggott2017-04-191-3/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | There is no eloquent way to exclude/include arch dependent arguments from the ul_excl_t array. So when an arch dependent argument is left undefined err_exclusive_options() was printing out-of-bounds values. This commit cause them to be skipped instead. err_exclusive_options() shouldn't be printing out-of-bounds values in any case. Also change the error massage from 'options' to 'arguments' as some programs, like hwclock, distinguish between options and functions. Signed-off-by: J William Piggott <elseifthen@gmx.com>
| * hwclock: improve audit controlJ William Piggott2017-04-192-13/+6Star
| | | | | | | | | | | | | | | | | | | | | | Move audit control to option parsing. This fixes non-alpha build error and cleans up an unruly 'if' statement. Having audit control in option parsing may also draw awareness to the audit system when adding new functions, which could easily be overlooked otherwise. Signed-off-by: J William Piggott <elseifthen@gmx.com>
| * hwclock: --set and --predict segmentation faultJ William Piggott2017-04-191-0/+4
| | | | | | | | | | | | | | | | | | | | Segmentation fault for --set or --predict when the --date option is not included. * sys-utils/hwclock.c: exit with an error message when the required --date option is missing. Signed-off-by: J William Piggott <elseifthen@gmx.com>
| * hwclock: make epoch functions alpha onlyJ William Piggott2017-04-192-40/+29Star
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | It's been 19.1315 years since the comment below was written and the kernel has actually gone further away from allowing an RTC epoch on ISA machines. /* * Maintenance note: This should work on non-Alpha machines, but the * evidence today (98.03.04) indicates that the kernel only keeps the epoch * value on Alphas. If that is ever fixed, this function should be changed. */ The current behavior is to accept the epoch options on ISA machines only to print a lengthy message explaining that you cannot use them. This patch removes that behavior, making the epoch functions truly Alpha only, as the man-page states that they are. * sys-utils/hwclock.c: make epoch function alpha only. * sys-utils/hwclock.h: same. Signed-off-by: J William Piggott <elseifthen@gmx.com>
| * hwclock: improve default function handlingJ William Piggott2017-04-191-6/+10
| | | | | | | | | | | | | | | | | | | | | | Removes long default function test. Instead handle the default when the options are parsed. Also fixes the non-linux build failure reported by Rudi: http://marc.info/?l=util-linux-ng&m=149189833115871 Reported-by: Ruediger Meier <ruediger.meier@ga-group.nl> Signed-off-by: J William Piggott <elseifthen@gmx.com>
* | libfdisk: fix NLS supportKarel Zak2017-04-259-9/+26
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The current libfdisk code uses gettext() to translate strings. It means it follows the default text domain (as set by textdomain(3) usually in the main program). This is useless for public shared library. We have call private bindtextdomain() and use dgettext() with private domain name to be independent on the main program. For this purpose include/nls.h supports UL_TEXTDOMAIN_EXPLICIT to use dgettext(). Note that libfdisk will continue to use util-linux.po, rather than keep the texts in the separate file. The nls.h has to be included only from fdiskP.h to be sure that nls.h works as expected for the library. Signed-off-by: Karel Zak <kzak@redhat.com>