summaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
* libmount: note namespaces in mnt_reset_context() docsVaclav Dolezal2018-06-111-2/+3
| | | | Signed-off-by: Vaclav Dolezal <vdolezal@redhat.com>
* libmount: add support for switching namespacesVaclav Dolezal2018-06-115-0/+242
| | | | | | | [kzak@redhat.com: - cosmetic changes, add some comments] Signed-off-by: Vaclav Dolezal <vdolezal@redhat.com> Signed-off-by: Karel Zak <kzak@redhat.com>
* wipefs: postpone BLKRRPART until all is doneKarel Zak2018-06-112-7/+56
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | It's possible we erase from the whole device before we erase from the partition on the same disk: # wipefs -a /dev/sdc /dev/sdc1 the current code calls re-read PT ioctl immediately after erase (so, before sdc1 is processed). The result is that sdc1 node is no more accessible: # wipefs -a /dev/sdc /dev/sdc1 /dev/sdc: 2 bytes were erased at offset 0x000001fe (dos): 55 aa /dev/sdc: calling ioctl to re-read partition table: Success wipefs: error: /dev/sdc1: probing initialization failed: No such file or directory It seems the most simple solution is to postpone the re-read ioctl and do it as the last thing. # wipefs -a /dev/sdc /dev/sdc1 /dev/sdc: 2 bytes were erased at offset 0x000001fe (dos): 55 aa /dev/sdc1: 2 bytes were erased at offset 0x00000438 (ext4): 53 ef /dev/sdc: calling ioctl to re-read partition table: Success The patch also adds a small delay before the re-read ioctl call. It's not elegant, but without the usleep(25000) the first attempt returns EBUSY. Addresses: https://github.com/karelzak/util-linux/issues/598 Signed-off-by: Karel Zak <kzak@redhat.com>
* zramctl: (man) explain that --find is necessaryKarel Zak2018-06-111-1/+6
| | | | | Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=1589148 Signed-off-by: Karel Zak <kzak@redhat.com>
* blkzone: fix whole device detectionKarel Zak2018-06-081-4/+5
| | | | | | | | | | | | | | Matias Bjørling wrote: The current detection code for chunk size assumes that the underlying device is a device that uses the minor device id as the partition id, and that the whole device has minor id 0. This is not true for example null_blk and nvme device drivers. Let's use sysfs_devno_to_wholedisk() to get whole-disk devno. Addresses: https://github.com/karelzak/util-linux/pull/646 Reported-by: Matias Bjørling matias.bjorling@wdc.com Signed-off-by: Karel Zak <kzak@redhat.com>
* losetup: keep -f and <devname> mutually exclusiveKarel Zak2018-06-071-0/+3
| | | | | | | | | | | | | | | | losetup tries to blindly use specified device as well as search for the first free device, the result is: # losetup /dev/loop1 -f /tmp/tfile_loop1 losetup: /dev/loop1: failed to set up loop device: Invalid argument fixed version: # losetup /dev/loop10 -f img losetup: unexpected arguments Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=1566432 Signed-off-by: Karel Zak <kzak@redhat.com>
* agetty: keep c_iflags unmodified on --autologinKarel Zak2018-06-062-4/+17
| | | | | | | | | | | | | | | agetty sets c_iflags according to interaction with serial line in get_logname(). For --autologin it does not read from the line, so we have no clue how to set the flags. The current behavior is to zeroize the flags. Unfortunately, it seems like bad idea, because the line may be already properly initialized by kernel (or systemd, etc.). The new behavior is not touch the flags on --autologin. Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=1252764 Signed-off-by: Karel Zak <kzak@redhat.com>
* tests: add empty column testKarel Zak2018-06-042-0/+5
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* libsmartcols: don't print empty columnKarel Zak2018-06-041-2/+9
| | | | | | | | | | | | | | | | The commit 0f9f927b6f62cb7f488fadfad76c4a5defdefe36 forces libsmartcols to use one byte as a minimal column width. This seems like a bug if the column is empty and without header. $ printf ':a:b\n' | column -t -s ':' -o ':' :a:b Fixed version: $ printf ':a:b\n' | column -t -s ':' -o ':' :a:b Reported-by: Sami Kerola <kerolasa@iki.fi> Signed-off-by: Karel Zak <kzak@redhat.com>
* mount: keep MS_MOVE as flagKarel Zak2018-06-012-3/+10
| | | | | | | | The previous commit 4ebea84bb1ca6b0fa817588aba13de26c8d5e5a0 replaced all operations by strings, but it does not work for MS_MOVE as this operation is not supported in fstab by libmount. Signed-off-by: Karel Zak <kzak@redhat.com>
* libmount: don't use MS_MGC_VAL magic in mount(2) syscallKarel Zak2018-06-013-4/+3Star
| | | | | | | | | Specifying MS_MGC_VAL was required in kernel versions prior to 2.4, but since Linux 2.4 is no longer required and is ignored if specified The minimal kernel requirement for util-linux is Linux v2.6. Signed-off-by: Karel Zak <kzak@redhat.com>
* libmount: improve MS_REC usageKarel Zak2018-06-013-6/+33
| | | | | | | | | | | | | | | | | | | | | | | | | libmount allows to split one library (mount(8)) call to multiple mount(2) syscalls, for example --rbind --make-rslave in this case we have to be careful with MS_REC because the flag is applied to multiple operations. # strace -e mount mount --rbind --make-rslave /mnt/A /mnt/B Old version: mount("/mnt/A", "/mnt/B", 0x13ecac0, MS_MGC_VAL|MS_BIND, NULL) = 0 mount("none", "/mnt/B", NULL, MS_REC|MS_SLAVE, NULL) = 0 Fixed version: mount("/mnt/A", "/mnt/B", 0x1f22ac0, MS_MGC_VAL|MS_BIND|MS_REC, NULL) = 0 mount("none", "/mnt/B", NULL, MS_REC|MS_SLAVE, NULL) = 0 Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=1584443 Signed-off-by: Karel Zak <kzak@redhat.com>
* mount: use internally string to set move/bind operationsKarel Zak2018-06-011-8/+7Star
| | | | | | | | | It's better to inform libmount about operations by string than by flags, because for example "rbind,slave" cannot be specified by MS_REC|MS_BIND|MS_SLAVE. https://bugzilla.redhat.com/show_bug.cgi?id=1584443 Signed-off-by: Karel Zak <kzak@redhat.com>
* libmount: include sys/mount.h on Linux onlyKarel Zak2018-05-291-1/+1
| | | | | Addresses: https://bugs.debian.org/cgi-bin/bugreport.cgi?att=1;bug=891812 Signed-off-by: Karel Zak <kzak@redhat.com>
* po: fix lsblk translationKarel Zak2018-05-291-1/+1
| | | | | Reported-by: Rosberg Nascimento Freitas Rodrigues <rosberg.berg@gmail.com> Signed-off-by: Karel Zak <kzak@redhat.com>
* libmount: accept another flags on MS_REMOUNT|MS_BINDKarel Zak2018-05-283-16/+14Star
| | | | | | | | | | | | | | | | | | | | | | The current libmount MS_REMOUNT|MS_BIND support is restricted to MS_RDONLY (read-only bind mount). This is too restrictive as Linux kernel supports bind-remount for arbitrary VFS flags. After this update you can use # mount /dev/sdc1 /mnt/A # mount --bind -onosuid,noexec /mnt/A /mnt/B # findmnt /dev/sdc1 -oTARGET,SOURCE,FS-OPTIONS,VFS-OPTIONS TARGET SOURCE FS-OPTIONS VFS-OPTIONS /mnt/A /dev/sdc1 rw,stripe=512,data=ordered rw,relatime /mnt/B /dev/sdc1 rw,stripe=512,data=ordered rw,nosuid,noexec,relatime The "mount --bind" is composed from two syscalls of course (1st is bind, 2nd is bind,remount,nosuid,noexec). Addresses: https://github.com/karelzak/util-linux/issues/637 Signed-off-by: Karel Zak <kzak@redhat.com>
* mountpoint: simplify test condition [cppcheck]Sami Kerola2018-05-281-2/+1Star
| | | | | | | [sys-utils/mountpoint.c:79]: (style) Redundant condition: ctl->st.st_dev==pst.st_dev. 'A || (!A && B)' is equivalent to 'A || B' Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* include/pt-mbr.h: fix integer overflowSami Kerola2018-05-281-2/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | gcc -fsanitize=undefined gives following warning. include/pt-mbr.h:27:51: runtime error: left shift of 248 by 24 places cannot be represented in type 'int' It looks like char is converted internally to int before bit-shift, and that type overflows when char value is greater than 127. Following code snippet will show the effect what is stored when undefined behaviour happens. #include <stdio.h> #include <inttypes.h> int main(int argc, unsigned char **argv) { char p[] = { 170, 170, 170, 170 }; unsigned int uint = p[3]; uint64_t res = 0; /* overflow */ res = p[0] | (p[1] << 8) | (p[2] << 16) | (p[3] << 24); printf("%" PRIu64 "\n", res); /* this is fine */ res = 0; res = p[0] | (p[1] << 8) | (p[2] << 16) | (uint << 24); printf("%" PRIu64 "\n", res); return 0; } I tested gcc 8.1.0, clang 6.0.0, and tcc 0.9.27 and they all printed the same values. $ ./a.out 18446744073709551530 4294967210 Because output is result of undefined behavior what is stored may change in future, and other compilers / version might do something different. In the case of what pt-mbr.h the destination data type size was commonly 32 bits in size, that truncated excess rubbish from bitshift. Needless to say that was not very robust code. Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* nls: remove translation stringsSami Kerola2018-05-285-7/+7
| | | | | | | | | | While looking earlier commit I noticed everything but formatting was removed from a message in namei.c file. That inspired me to look if there are more strings that does not need translation project attention. This change removes at least some of them, if not all. Reference: e19cc7b65b31c57f0fe9cb73c9afad5197796f82 Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* bash-completion: add swapon specifiers to completionSami Kerola2018-05-281-3/+18
| | | | | | | No space after device name is not entirely right, but that's better than missing argument completions. Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* rev: move a global variable to local scopeSami Kerola2018-05-281-3/+2Star
| | | | | | Mark also file names read-only. Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* tests: move stderr redirection out from test expressionSami Kerola2018-05-281-1/+1
| | | | | | | | | | | | | Fix shellcheck error. if ! [ "$paraller_jobs" -ge 0 2>/dev/null ]; then ^-- SC1009: The mentioned parser error was in this if expression. ^-- SC1073: Couldn't parse this test expression. ^-- SC1072: Expected test to end here (don't wrap commands in []/[[]]). Fix any mentioned problems and try again. Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* lib/strutils: fix strnlen() fallbackKarel Zak2018-05-281-2/+2
| | | | | Addresses: https://github.com/karelzak/util-linux/issues/643 Signed-off-by: Karel Zak <kzak@redhat.com>
* Merge branch 'master' of https://github.com/pali/util-linuxKarel Zak2018-05-283-0/+20
|\ | | | | | | | | * 'master' of https://github.com/pali/util-linux: libblkid: udf: Fix reporting UDF 2.60 revision
| * libblkid: udf: Fix reporting UDF 2.60 revisionPali Rohár2018-05-253-0/+20
| | | | | | | | | | | | | | | | | | | | | | | | | | According to the UDF 2.60 specification, the Minimum UDF Read Revision value shall be at most #0250 for all media with a UDF 2.60 file system. So in this case use Minimum UDF Write Revision as ID_FS_VERSION to distinguish between UDF 2.50 and UDF 2.60 discs. This commit also adds a testing Blu-Ray Recordable image with UDF revision 2.60 created by Nero which really sets Minimum UDF Read Revision to 2.50. Signed-off-by: Pali Rohár <pali.rohar@gmail.com>
* | libblkid: (ntfs) fix cluster size checkKarel Zak2018-05-251-1/+1
|/ | | | | Addresses: https://github.com/karelzak/util-linux/issues/641 Signed-off-by: Karel Zak <kzak@redhat.com>
* libblkid: (ntfs) enlarge cluster limit to 2MBKarel Zak2018-05-251-4/+8
| | | | | | | | | | Windows 10 Creators edition has extended the ntfs cluster limit to 2MB. As a consequence blkid does not identify recent partitions with clusters beyond 65K as ntfs ones. Addresses: https://github.com/karelzak/util-linux/issues/641 Signed-off-by: Karel Zak <kzak@redhat.com> Co-Author: Jean-Pierre André <jean-pierre.andre@wanadoo.fr>
* cfdisk: fix compiler warnings, follow-up 7085f1e4 (#636)Ruediger Meier2018-05-241-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | Seen on OSX 10.13, xcode 9.3. disk-utils/cfdisk.c:1860:45: error: format specifies type 'uintmax_t' (aka 'unsigned long') but the argument has type 'uint64_t' (aka 'unsigned long long') [-Werror,-Wformat] DBG(UI, ul_debug("get_size (default=%ju)", *res)); ~~~ ^~~~ %llu disk-utils/cfdisk.c:267:60: note: expanded from macro 'DBG' #define DBG(m, x) __UL_DBG(cfdisk, CFDISK_DEBUG_, m, x) ^ ./include/debug.h:67:4: note: expanded from macro '__UL_DBG' x; \ ^ disk-utils/cfdisk.c:1889:25: error: incompatible pointer types passing 'uint64_t *' (aka 'unsigned long long *') to parameter of type 'uintmax_t *' (aka 'unsigned long *') [-Werror,-Wincompatible-pointer-types] rc = parse_size(buf, &user, &pwr); /* parse */ ^~~~~ ./include/strutils.h:15:51: note: passing argument to parameter 'res' here extern int parse_size(const char *str, uintmax_t *res, int *power); ^ 2 errors generated. Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
* cfdisk: use uint64_t to avoid compiler warningsKarel Zak2018-05-241-11/+11
| | | | | Reported-by: Ruediger Meier <ruediger.meier@ga-group.nl> Signed-off-by: Karel Zak <kzak@redhat.com>
* lslogins: add -o+<COLNAME> supportKarel Zak2018-05-232-17/+20
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* lslogins: add PWD-METHOD columnKarel Zak2018-05-231-1/+16
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* lslogins: fix password verificationKarel Zak2018-05-231-4/+74
| | | | | | | | | | | Let's follow the standard $id$salt$encrypted password format in verification code. The current code is useless and for example PWD-LOCK column is always FALSE. Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=1581611 Signed-off-by: Karel Zak <kzak@redhat.com>
* man: Change the only argument to two for the two-fonts macrosBjarni Ingi Gislason2018-05-234-5/+5
| | | | | | | Punctuation marks have been left in the only argument of two-fonts macros, instead of being separated from it to make the second one. Signed-off-by: Bjarni Ingi Gislason <bjarniig@rhi.hi.is>
* man: choom.1: Use the correct macro for the font change of one argumentBjarni Ingi Gislason2018-05-231-1/+1
| | | | | | | Use the correct macro "I" for one argument, instead of the two-fonts macro "IR". Signed-off-by: Bjarni Ingi Gislason <bjarniig@rhi.hi.is>
* man: Use the correct macro for a font change of one argumentBjarni Ingi Gislason2018-05-2331-126/+126
| | | | | | | | Use the correct macro (I, B) for the font change of one argument, not those that are used for alternating two fonts, like "BR", "IR", "RB", or "RI". Signed-off-by: Bjarni Ingi Gislason <bjarniig@rhi.hi.is>
* more: reorder global declarationsSami Kerola2018-05-231-48/+48
| | | | | | | Group include, defines and such together, and move items inbetween functions on top of the source file so that everything can be seen easily. Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* more: remove function prototypesSami Kerola2018-05-231-998/+968Star
| | | | Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* lsns: remove unnecessary includeKarel Zak2018-05-171-1/+0Star
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* script: fix printf format specifiersRuediger Meier2018-05-161-2/+2
| | | | | | Noticed on 32bit builds. Types changed in 0da73643. Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
* lsblk: fix notes about RAM disksKarel Zak2018-05-151-3/+3
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* lsblk: don't exclude RAM disks on --allKarel Zak2018-05-151-1/+1
| | | | | Reported-by: Milan Broz <gmazyland@gmail.com> Signed-off-by: Karel Zak <kzak@redhat.com>
* iscript: s/COLS/COLUMNS/ in start messageKarel Zak2018-05-141-1/+1
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* tests: update script done messagesKarel Zak2018-05-145-12/+12
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* script: record exit codeKarel Zak2018-05-143-20/+38
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* tests: update script headersKarel Zak2018-05-145-12/+12
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* script: add more info to script headerKarel Zak2018-05-144-11/+41
| | | | | | | | | | | | | | | | This patch introduces [...] to store extra information about terminal to the typescript header. For example: Script started on 2018-05-14 12:52:32+02:00 [TERM="xterm-256color" TTY="/dev/pts/3" COLS="190" LINES="53"] or Script started on 2018-05-14 12:54:01+02:00 [<not executed on terminal>] if stdout is not terminal. Addresses: https://github.com/karelzak/util-linux/issues/583 Signed-off-by: Karel Zak <kzak@redhat.com>
* docs: add hint about scriptKarel Zak2018-05-141-0/+2
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* script: cleanup done timestamp messageKarel Zak2018-05-141-6/+9
| | | | | | | * always save "done" timestamp to typescript (use done() for this) * use FORMAT_TIMESTAMP_MAX as buffer size Signed-off-by: Karel Zak <kzak@redhat.com>
* tests: remove debug stuff from ts/script/optionsKarel Zak2018-05-141-1/+0Star
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* script: use uint64_t for file sizesKarel Zak2018-05-141-2/+2
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>