summaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
...
* | tests: add mdadm locksKarel Zak2017-12-074-1/+19
| | | | | | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* | libblkid: add debug messages when ignore useless devicesKarel Zak2017-12-071-2/+6
| | | | | | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* | libblkid: Add VDO superblock information into blkidSweet Tea Dorminy2017-12-076-0/+55
| | | | | | | | | | | | | | [kzak@redhat.com: - add tests/expected/blkid/low-probe-vdo - enlarge the image (must be > 1024)] Signed-off-by: Karel Zak <kzak@redhat.com>
* | tests: use flock to modify fstabKarel Zak2017-12-065-16/+36
| | | | | | | | | | | | | | Note that for btrfs test we need to use low-level ts_fstab_addline, because we add multiple lines there. Signed-off-by: Karel Zak <kzak@redhat.com>
* | tests: add lock on shared resources (e.g. scsi_debug)Karel Zak2017-12-062-0/+29
| | | | | | | | | | | | | | The patch enables flock for scsi_debug to avoid collision between tests. The patch also adds ./run.sh --nolocks to disable this feature. Signed-off-by: Karel Zak <kzak@redhat.com>
* | setarch: minor code clean upSami Kerola2017-12-041-23/+15Star
| | | | | | | | | | | | | | | | | | | | | | | | Remove global variable, skip unnecessary comparison, and remove version printing function when a simple printf() can do the job. In same go fix compiler warning. sys-utils/setarch.c:296:4: warning: null argument where non-null required (argument 2) [-Wnonnull] execl("/bin/bash", NULL); Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* | rename: use access(3) to check if a file existsSami Kerola2017-12-043-2/+33
| | | | | | | | | | | | | | This is more lightweight than calling stat(3). In same go add a regression test to ensure changes like this will not break --no-overwrite option. Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* | vipw: do not let editor to inherit open file descriptorsSami Kerola2017-12-041-2/+2
| | | | | | | | Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* | login: add LOGIN_PLAIN_PROMPT to login.defsKarel Zak2017-12-042-3/+21
|/ | | | | | | | | | | We have command line option -H to disable hostname in login prompt. Unfortunately, in same cases (e.g. telnetd) it's impossible to specify login(1) command line options due to hardcoded execl()... This patch introduces LOGIN_PLAIN_PROMPT boolean for /etc/login.defs to suppress hostname in the prompt. Signed-off-by: Karel Zak <kzak@redhat.com>
* fallocate: remove typoKarel Zak2017-11-291-1/+1
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* fallocate: dig holes only in data extentsKarel Zak2017-11-291-64/+55Star
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Based on patch from Vaclav Dolezal <vdolezal@redhat.com>, this implementation is less invasive. The patch adds a new while() for pread() call (so diff is mostly code indention). The pread() is called for a real data only (addressed by 'off' and 'end') and we use SEEK_{DATA,HOLE} before the pread() to skip already existing holes. The variables 'file_off' and 'file_end' addresses area in the file as specified on fallocate command line. Test: $ truncate -s 10G testfile $ dd if=/dev/zero of=testfile count=10 bs=1M conv=notrunc old version: $ time /usr/bin/fallocate --dig-holes --verbose testfile testfile: 10 GiB (10737418240 bytes) converted to sparse holes. real 0m3.013s user 0m0.700s sys 0m2.304s new version: $ time ./fallocate --dig-holes --verbose testfile testfile: 10 MiB (10485760 bytes) converted to sparse holes. real 0m0.026s user 0m0.002s sys 0m0.004s The old version scans all file. The change has minimal overhead for files without holes. Addresses: https://github.com/karelzak/util-linux/issues/421 Co-Author: Vaclav Dolezal <vdolezal@redhat.com> Signed-off-by: Karel Zak <kzak@redhat.com>
* login-utils: use free_getlogindefs_data()Karel Zak2017-11-282-0/+4
| | | | | | | It seems better to deallocate logindefs.conf stuff in long time running (=waiting) processes like login(1) and su(1). Signed-off-by: Karel Zak <kzak@redhat.com>
* eject: remove list_speeds() #ifdef CDROM_SELECT_SPEED protectionSami Kerola2017-11-281-4/+0Star
| | | | | | | | The CDROM_SELECT_SPEED should be available practically everywhere. Where the define is missing an error message about path /proc/sys/dev/cdrom/info cannot be opened is better error than a warnx() about kernel support. Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* lib/signames: remove unused functionSami Kerola2017-11-282-6/+0Star
| | | | Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* man: use long options in text and add example to uuidgenSami Kerola2017-11-281-7/+9
| | | | Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* misc: fix typosSami Kerola2017-11-285-5/+5
| | | | Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* tests: check for HAVE_LINUX_NET_NAMESPACE_HKarel Zak2017-11-282-25/+27
| | | | | | | | * use one cleanup function * check if kernel headers support net namespace * enable netnsid test Signed-off-by: Karel Zak <kzak@redhat.com>
* tests: add set-x to lsns testKarel Zak2017-11-281-0/+6
| | | | | | .. just to see why does it fail on Travis. Signed-off-by: Karel Zak <kzak@redhat.com>
* tests: better lsns report on failKarel Zak2017-11-281-2/+14
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* tests: make lsns test more robustKarel Zak2017-11-281-11/+24
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* nsenter: fix compiler warning [-Wuninitialized]Karel Zak2017-11-281-1/+1
| | | | | | | | sys-utils/nsenter.c: In function ‘is_same_namespace’: sys-utils/nsenter.c:170:2: warning: ‘b_ino’ may be used uninitialized in this function [-Wuninitialized] sys-utils/nsenter.c:170:2: warning: ‘a_ino’ may be used uninitialized in this function [-Wuninitialized] Signed-off-by: Karel Zak <kzak@redhat.com>
* dmesg: fix compiler warning [-Wuninitialized]Karel Zak2017-11-281-1/+1
| | | | | | | sys-utils/dmesg.c: In function ‘print_record.constprop.12’: sys-utils/dmesg.c:1039:14: warning: ‘mesg_size’ may be used uninitialized in this function [-Wuninitialized] Signed-off-by: Karel Zak <kzak@redhat.com>
* build-sys: lsns requires libmountKarel Zak2017-11-271-0/+1
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* lsns: initialize stuff when really necessaryKarel Zak2017-11-272-23/+26
| | | | | | | It's more robust to depend on list of the wanted columns than on another variables. Signed-off-by: Karel Zak <kzak@redhat.com>
* tests: fix lsns permsKarel Zak2017-11-271-0/+0
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* lsns: rename notruns to no_truncKarel Zak2017-11-271-3/+3
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* lsns: nsfs stuff cleanupKarel Zak2017-11-271-37/+37
| | | | | | | | | | * don't use booleans * use is_ prefix for boolean-like functions * make nsfs_xasputs() more readable * enable 'nowrap' together with 'raw' and don't test for "nowrap || raw" * add missing 'W' to getopt_long() Signed-off-by: Karel Zak <kzak@redhat.com>
* lsns: (man) write about using multi-line in NSFS cell of lsnsMasatake YAMATO2017-11-271-0/+8
| | | | Signed-off-by: Masatake YAMATO <yamato@redhat.com>
* lsns: add a case for testing nsfs columnMasatake YAMATO2017-11-272-0/+69
| | | | Signed-off-by: Masatake YAMATO <yamato@redhat.com>
* lsns: add --nowrap(-W) optionMasatake YAMATO2017-11-271-2/+10
| | | | | | | | | | | This option forces lsns command not use multi-line presentation when printing a cell. Currently, it affects only NSFS column. Implementing this option is suggested by Karl Zak. Signed-off-by: Masatake YAMATO <yamato@redhat.com>
* lsns: add nsfs columnMasatake YAMATO2017-11-272-6/+106
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | nsfs provides kernel level interface for assigning logical name to a namespace. Following message is quoted from git log of linux kernel: commit 0226f4923f6c9b40cfa1c1c1b19a6ac6b3924ead Author: Al Viro <viro@zeniv.linux.org.uk> Date: Tue Dec 6 12:21:54 2011 -0500 vfs: take /proc/*/mounts and friends to fs/proc_namespace.c rationale: that stuff is far tighter bound to fs/namespace.c than to the guts of procfs proper. Signed-off-by: Al Viro <viro@zeniv.linux.org.uk> /proc/self/mountinfo lists the logical names for namespaces: ... 652 81 0:3 net:[4026532579] /tmp/XYZ rw shared:192 - nsfs nsfs rw,seclabel ... In the lines /tmp/XYZ is a logical name for 4026532579 of net namespace. This patch adds nsfs column. It seems that the logical name is used only in "ip netns" now. So the column is disabled by default. Use '--type=net' or '-o NSFS' options to enable it. This feature and the way to implementation using multi lines in a column is Suggested by Karel Zak. Signed-off-by: Masatake YAMATO <yamato@redhat.com>
* lsns: add a case for testing netnsid columnMasatake YAMATO2017-11-273-0/+67
| | | | Signed-off-by: Masatake YAMATO <yamato@redhat.com>
* lsns: disable netnsid column by defaultMasatake YAMATO2017-11-271-5/+20
| | | | | | | | | | | Enable only when * --type=net is given, or * -o NETNSID is given. Suggested by Karel Zak. Signed-off-by: Masatake YAMATO <yamato@redhat.com>
* lsns: add netnsid columnMasatake YAMATO2017-11-272-2/+185
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Linux network subsystem assigns an unique integer to a network namespace. term0# ip netns add UTIL-LINUX-LSNS-TEST-NS term0# ip netns list UTIL-LINUX-LSNS-TEST-NS term0# ip link add name lsns-vetha type veth peer name lsns-vethb term0 # ip link set lsns-vethb netns UTIL-LINUX-LSNS-TEST-NS term0# ip netns list UTIL-LINUX-LSNS-TEST-NS (id: 0) term0# ip link show dev lsns-vetha 230: lsns-vetha@if229: <BROADCAST,MULTICAST> mtu 1500 qdisc noop ... link/ether 3e:27:68:ba:b3:95 brd ff:ff:ff:ff:ff:ff link-netnsid 0 In this example 0 is assigned to UTIL-LINUX-LSNS-TEST-NS net namespace. The name, UTIL-LINUX-LSNS-TEST-NS, and it semantics is given and defined by iproute2 in userland; and nothing to do with util-linux. However, the id, 0, is managed in linux kernel. If lsns can show the ids, it helps users understand the state of network namespaces. This commit adds NETNSID column to the output. Here is an example of session: term0# ip netns exec UTIL-LINUX-LSNS-TEST-NS cat (Open another terminal) term1# ./lsns --type net NS TYPE NPROCS PID USER NETNSID COMMAND 4026531993 net 383 1 root unassigned /usr/lib/systemd/... 4026532433 net 1 1219 rtkit unassigned /usr/libexec/rtkit-daemon 4026532562 net 1 18201 root 0 cat 0 is shown as NETNSID for the cat process. For the initial name space, "unassigned" is printed. For the namespaces other type than net, "n/a" is printed. If an error occurred during getting the id, "n/a" is printed. Changes in V2: * Remove wrongly used & operators. * Make netnsid field empty if value for the column is not available. Suggested by Karel Zak. * Remove redundant condtion for checking the avaiablebility of netlink socket. Suggested by Karel Zak. Signed-off-by: Masatake YAMATO <yamato@redhat.com>
* rtcwake: fix sys vs. rtc time delta usageKarel Zak2017-11-271-1/+1
| | | | | | | | | | | | | | srett commented: After some head scratching why relative wakeup using -s always works while -t didn't seem to work at all I discovered that the adjustment for time difference between sys and rtc is actually inverted when writing the alarm (code for -m show reading is fine), so if the RTC lags 10 minutes behind, the alarm will be shifted into the future by 10 minutes, resulting in a wakeup that is 20 minutes late. Addresses: https://github.com/karelzak/util-linux/issues/544 Signed-off-by: Karel Zak <kzak@redhat.com>
* libsmartcols: fix mem-leaks in samplesKarel Zak2017-11-232-0/+6
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* tests: allow to use memory checks for libsmartcolsKarel Zak2017-11-232-18/+18
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* docs: update TODO fileKarel Zak2017-11-231-33/+0Star
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* build-sys: add --enable-asan and --memcheck-asan for testsKarel Zak2017-11-233-1/+24
| | | | | | | | | The command ./configure --enable-asan adds -fsanitize=address to the compiler command line. In the regression tests leaks detection is disabled by default. You have to use --memcheck-asan on test command line to enable. Signed-off-by: Karel Zak <kzak@redhat.com>
* tests: rename --memcheck to --memcheck-valgrindKarel Zak2017-11-232-20/+29
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* tests: rename ts_valgrind to ts_runKarel Zak2017-11-2312-115/+115
| | | | | | | Let's make our tests more generic, so we can later hide more stuff into ts_run call. Signed-off-by: Karel Zak <kzak@redhat.com>
* hwclock: revert ioctl testKarel Zak2017-11-231-2/+2
| | | | | | | | | | This commit reverts 1d5cffa16a0183175684809cf215294ec20b8fd9. (I did this revert manually as there was another changes in the code and git-revert does not work in this case.) Addresses: https://github.com/karelzak/util-linux/issues/543 Signed-off-by: Karel Zak <kzak@redhat.com>
* tests: update columns test due to dda229c7b2b16a31fae8e99079ab4f4ae5bc8eacKarel Zak2017-11-221-1/+1
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* column: use \x<hex> for invalid multibyte seq.Karel Zak2017-11-222-3/+15
| | | | | Addresses: https://github.com/karelzak/util-linux/issues/542 Signed-off-by: Karel Zak <kzak@redhat.com>
* lib/mbsalign: add mbs_invalid_encode()Karel Zak2017-11-222-0/+83
| | | | | | Like mbs_safe_encode(), but it does not care about control chars. Signed-off-by: Karel Zak <kzak@redhat.com>
* mount: add hint about -t and root perms to the man pageKarel Zak2017-11-221-0/+4
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* lsblk: add hint about perms to man pageKarel Zak2017-11-221-1/+3
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* Merge branch 'master' of https://github.com/pali/util-linuxKarel Zak2017-11-213-1/+13
|\ | | | | | | | | * 'master' of https://github.com/pali/util-linux: libblkid: udf: Fix parsing UDF revision
| * libblkid: udf: Fix parsing UDF revisionPali Rohár2017-11-203-1/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | UDF revision is stored as decimal number in hexadecimal format. E.g. number 0x0150 is revision 1.50, number 0x0201 is revision 2.01. Apparently all UDF test images have number which has same representation in decimal and hexadecimal format, so problem was not detected. This patch adds new test image with UDF revision 1.50. Internally number is stored as 0x0150. In decimal format it is (incorrectly) 1.80, but in hexadecimal correct 1.50. $ dd if=/dev/zero of=udf-hdd-mkudffs-1.3-8.img bs=1M count=10 $ mkudffs -r 0x150 -b 512 udf-hdd-mkudffs-1.3-8.img Signed-off-by: Pali Rohár <pali.rohar@gmail.com>
* | libmount: add nsfs between pseudo filesystemsKarel Zak2017-11-211-0/+1
| | | | | | | | Signed-off-by: Karel Zak <kzak@redhat.com>