summaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
* libmount: fix utab entry on remountKarel Zak2014-11-191-0/+3
| | | | | | | | | | mount(8) command does not set ROOT= field to utab entry on remount, for example: mount -oremount,_netdev /mnt Reported-by: Chris Leech <cleech@redhat.com> Signed-off-by: Karel Zak <kzak@redhat.com>
* libmount: add private mnt_context_get_mtab_for_target()Karel Zak2014-11-193-40/+69
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* libmount: reuse allocated fs in parserKarel Zak2014-11-191-7/+15
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* libmount: improve mnt_reset_fs()Karel Zak2014-11-191-17/+20
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* misc: use monotonic time rater than gettimeofdayKarel Zak2014-11-185-9/+38
| | | | | | Based on patch Alexander Samilovskih <alexsamilovskih@gmail.com> Signed-off-by: Karel Zak <kzak@redhat.com>
* uuidd: Fixed a typo in daemon logging messageNikolay Sivov2014-11-181-1/+1
| | | | Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
* docs: Spelling fixesVille Skyttä2014-11-185-5/+5
| | | | | Signed-off-by: Ville Skyttä <ville.skytta@iki.fi> Signed-off-by: Karel Zak <kzak@redhat.com>
* bash-completion: Invoke actual commands to be completed, not basenamesVille Skyttä2014-11-187-11/+11
| | | | | Addresses partially: http://bugs.debian.org/769462 Signed-off-by: Ville Skyttä <ville.skytta@iki.fi>
* ldattach: GSM0710 support, add intro modem commandKarel Zak2014-11-183-2/+105
| | | | | | | | | | Patch add: --intro-command string : send command to modem --pause value : define delay between intro command and ldattach Based on patch from Martin Schmid <scm@aps-systems.ch> Signed-off-by: Karel Zak <kzak@redhat.com>
* mkswap: remove memory leaks [LeakSanitizer] [valgrind]Sami Kerola2014-11-181-0/+2
| | | | | | | | | | | | | | | | | | | | | ==18922==ERROR: LeakSanitizer: detected memory leaks Direct leak of 8 byte(s) in 1 object(s) allocated from: #0 0x49d12b in __interceptor_malloc (/home/src/util-linux/.libs/lt-mkswap+0x49d12b) #1 0x7faf2a5069c9 in __GI___strdup (/usr/lib/libc.so.6+0x819c9) #2 0xffff96e7e33 (<unknown module>) SUMMARY: AddressSanitizer: 8 byte(s) leaked in 1 allocation(s). And another one that valgrind found. ==6316== 8 bytes in 1 blocks are definitely lost in loss record 1 of 1 ==6316== at 0x4C29F90: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so) ==6316== by 0x5E3F9C9: strdup (in /usr/lib/libc-2.20.so) ==6316== by 0x43A25F: size_to_human_string (strutils.c:495) ==6316== by 0x42B35C: main (mkswap.c:488) Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* tests: mark python libmount tests known to fail with AddressSanitizerSami Kerola2014-11-184-1/+17
| | | | | | | | | | | | | | | The tests fail with an error similar to this. Traceback (most recent call last): File "/home/src/util-linux/libmount/python/test_mount_tab_update.py", line 7, in <module> import pylibmount as mnt ImportError: /home/src/util-linux/.libs/libuuid.so.1: undefined symbol: __asan_option_detect_stack_use_after_return It might be possible to build ASAN-DSO and set LD_PRELOAD, but this solution is not officially supported. See the reference for details. Reference: https://code.google.com/p/address-sanitizer/wiki/AsanAsDso Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* tests: skip kill -SEGV test when running AddressSanitizerSami Kerola2014-11-181-0/+3
| | | | | | | Sending signal indicating invalid memory reference makes AddressSanitizer to report false positive test failure. Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* libmount: fix memory overflow [AddressSanitizer]Sami Kerola2014-11-181-1/+1
| | | | | | | | | | | | | | | | | | ==10918==ERROR: AddressSanitizer: stack-buffer-overflow on address 0x7fffd795b680 at pc 0x0000004447c6 bp 0x7fffd795b3e0 sp 0x7fffd795ab78 WRITE of size 129 at 0x7fffd795b680 thread T0 #0 0x4447c5 in scanf_common(void*, int, bool, char const*, __va_list_tag*) (/home/src/util-linux/.libs/lt-mount+0x4447c5) #1 0x445892 in sscanf (/home/src/util-linux/.libs/lt-mount+0x445892) #2 0x7fe78709a3d3 in get_filesystems /home/src/util-linux/libmount/src/utils.c:581:7 #3 0x7fe78709a1ba in mnt_get_filesystems /home/src/util-linux/libmount/src/utils.c:622:7 #4 0x7fe7870aa78f in do_mount_by_pattern /home/src/util-linux/libmount/src/context_mount.c:833:7 #5 0x7fe7870a9534 in mnt_context_do_mount /home/src/util-linux/libmount/src/context_mount.c:951:9 #6 0x7fe7870aab2b in mnt_context_mount /home/src/util-linux/libmount/src/context_mount.c:1051:8 #7 0x4ba9f5 in main /home/src/util-linux/sys-utils/mount.c:1107:7 #8 0x7fe785caa03f in __libc_start_main (/usr/lib/libc.so.6+0x2003f) #9 0x4b9f9c in _start (/home/src/util-linux/.libs/lt-mount+0x4b9f9c) Signed-off-by: Sami Kerola <kerolasa@iki.fi> Signed-off-by: Karel Zak <kzak@redhat.com>
* tests: fix memory leak [AddressSanitizer]Sami Kerola2014-11-181-0/+1
| | | | Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* build-sys: make scanf_cv_alloc_modifier to work [LeakSanitizer]Sami Kerola2014-11-181-0/+1
| | | | | | | | | | | | | | | | | | | | | The tests failed with following message in config.log ERROR: LeakSanitizer: detected memory leaks Direct leak of 2 byte(s) in 1 object(s) allocated from: #0 0x49a40e in realloc (/home/src/util-linux/conftest+0x49a40e) #1 0x7fbe48633e69 in __GI__IO_vfscanf (/usr/lib/libc.so.6+0x56e69) #2 0x7fbe48649786 in _IO_vsscanf (/usr/lib/libc.so.6+0x6c786) which knocked out libmount from build, and commands depending on it. The reason this change makes sense is that AddressSanitizer seems like a good addition to set of tools that util-linux package can use, when and if needed. Reference: https://code.google.com/p/address-sanitizer/wiki/AddressSanitizer Reviewed-by: Mike Frysinger <vapier@gentoo.org> Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* lscpu: theoretical buffer overflowTobias Stoeckmann2014-11-181-2/+2
| | | | | | | | | | | | there is a theoretical buffer overflow possible in the hypervisor parsing code of lscpu. It would require a proc entry to return way more than expected so it's no high priority. But better be safe than sorry. At first I thought about switching to fgets but there is another code file that adds a format specifier. The diff is less intrusive that way, too. Signed-off-by: Karel Zak <kzak@redhat.com>
* libfdisk: fix partition names on GNU Hurd.Gabriele Giacone2014-11-181-0/+4
|
* libfdisk: fix get_partition_unused_primary()Boris Egorov2014-11-141-23/+27
| | | | | | | | | | | | | | | | Was: Mentioned function returns -1 if adding of primary partition is impossible. Caller treats this value as size_t (res variable) and then compares it for negative values, totally ignoring errors. Becomes: Now function takes address to variable and fills it with partition number. Caller treats return value as int and use it appropriately. [kzak@redhat.com: - don't mix return code and partno at all] Signed-off-by: Boris Egorov <egorov@linux.com> Signed-off-by: Karel Zak <kzak@redhat.com>
* fdisk: missing break in switchBoris Egorov2014-11-131-0/+1
| | | | | Signed-off-by: Boris Egorov <egorov@linux.com> Signed-off-by: Karel Zak <kzak@redhat.com>
* libblkid: (nilfs) fix typoBoris Egorov2014-11-131-1/+1
| | | | | Signed-off-by: Boris Egorov <egorov@linux.com> Signed-off-by: Karel Zak <kzak@redhat.com>
* hwclock: improve wording and formatting of man pageBenno Schulenberg2014-11-131-37/+37
| | | | Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
* libfdisk: (dos) be sure that sorted EBR list is terminatedKarel Zak2014-11-131-5/+8
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* libfdisk: fix table_add_freespace(), add debug messagesKarel Zak2014-11-132-5/+20
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* cfdisk: cleanup menuitem draw functionsKarel Zak2014-11-131-19/+55
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* cfdisk: remove [Load] from menuKarel Zak2014-11-133-22/+9Star
| | | | | | | | | This functionality will be rarely used, so it does not make sense to waste screen space with this menu item. It's enough to provide this functionality in "Select label type" dialog (cfdisk --zero and then 'L' command). Signed-off-by: Karel Zak <kzak@redhat.com>
* cfdisk: add support for sfdisk scriptsKarel Zak2014-11-123-4/+125
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* fdisk: add support for sfdisk scriptsKarel Zak2014-11-122-0/+91
| | | | | | | | | New commands 'I' and 'O' allows to read and write sfdisk compatible scripts by fdisk. It means that you can save your work (partition table) and later use it (in fdisk, sfdisk or cfdisk) to create a new partition table. Signed-off-by: Karel Zak <kzak@redhat.com>
* libfdisk: fix script parser, add debug messagesKarel Zak2014-11-121-7/+26
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* libfdisk: (gpt) don't offer first sector before the first partionKarel Zak2014-11-101-1/+25
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The GPT first usable LBA is usually aligned to grain (1MiB), but for small (<=4MiB) devices we strictly follow sector sizes. In this case there is a small space in front of the aligned begin of the first partition. This useless space should not be offered for the next partitions. Sector size (logical/physical): 512 bytes / 4096 bytes I/O size (minimum/optimal): 4096 bytes / 32768 bytes Disklabel type: gpt Disk identifier: 041E2D54-AD0C-4C7E-A50D-363D23058D47 Device Start End Size Type /dev/sdb1 40 2087 1M Linux filesystem Command (m for help): n Partition number (2-128, default 2): First sector (34-8158, default 2088): ^^ first usable LBA is 34, but first aligned (recommended) LBA is 40, we use it for the first partition. All this is correct, but the space before the first partition should be ignored. Fixed version: Command (m for help): n Partition number (2-128, default 2): First sector (2088-8158, default 2088): ^^^^ Note this problem does not exist for "normal" (large) devices where first usable LBA is aligned to grain. Reported-by: Boaz Harrosh <boaz@plexistor.com> Signed-off-by: Karel Zak <kzak@redhat.com>
* libfdisk: (gpt) make mode more readableKarel Zak2014-11-101-39/+43
| | | | | | | | * use check_ prefix for checking functions * use plural in function names where we work with more partitions than one * always use "ents" when when we work with gpt entries array Signed-off-by: Karel Zak <kzak@redhat.com>
* libfdisk: fdisk_read_firstsector should seek to offset 0Samuel Thibault2014-11-101-0/+7
| | | | | | | The current offset of cxt->dev_fd may not be still 0, notably when blkdev_get_size has to resort to using blkdev_find_size Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org
* tests: simplify and update swaplabel testKarel Zak2014-11-102-8/+4Star
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* include/statfs_magic: use macro rather than type for f_typeKarel Zak2014-11-102-4/+4
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* mkswap: make final report more human readableKarel Zak2014-11-071-10/+10
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* mkswap: device write code refactoringKarel Zak2014-11-071-13/+26
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* mkswap: device open code refactoringKarel Zak2014-11-071-43/+50
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* mkswap: always use header from control structKarel Zak2014-11-071-19/+39
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* mkswap: coding style improvementsKarel Zak2014-11-071-58/+39Star
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* swapon: reword some usage stringsBenno Schulenberg2014-11-071-3/+3
| | | | | | | Also remove some inconsistent periods and properly punctuate the closing sentence. Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
* docs: fix some wording, grammar and formatting in man page of swaponBenno Schulenberg2014-11-072-14/+14
| | | | Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
* mkswap: various minor improvementSami Kerola2014-11-071-16/+17
| | | | | | | | | | | | | | Use correct data type in page_bad(), and add information to error message how many bad pages were seen. In check_blocks() move initialization to variable introduction, fix typo, and avoid memset() when array initializer can do the job. In main() use correct initializer for pointer. Move swap file specific actions to same location, and add warning when request too --check is dismissed by command. At the end remove momory leak. Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* mkswap: set variable only when it's value is knownSami Kerola2014-11-071-10/+8Star
| | | | | | Avoid updating ctl->pagesize twice when user does specify page size. Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* mkswap: make remaining functions to take control structure as argumentSami Kerola2014-11-071-12/+12
| | | | | | The wipe_device() and new_prober(). Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* mkswap: add struct mkswap_control to remove global variablesSami Kerola2014-11-071-114/+115
| | | | Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* mkswap: use err() rather than perror() && exit()Sami Kerola2014-11-071-13/+6Star
| | | | | | | The messsages in err() are verified from po/util-linux.pot to be already part of translations. Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* mkswap: remove unnecessary size checkSami Kerola2014-11-072-8/+0Star
| | | | Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* mkswap: remove system architecture specific max swap size checksSami Kerola2014-11-071-137/+3Star
| | | | | | | | Since kernel version 2.3.4 (June 1999) all architectures has used uint32_t as maximum number or pages in a swap device or file, there is no longer need to support systems earlier than that. Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* tests: update fdisk testsKarel Zak2014-11-077-0/+22
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* swapoff: swapoff swap files by LABEL and UUIDKarel Zak2014-11-072-14/+73
| | | | | | | | | | | | | # swapon --show=NAME,UUID NAME UUID /dev/sda3 8d52fca3-bf48-41d6-b826-2315e518a305 /home/fs-images/2g.img 6fa72b96-b802-441f-a31c-091d65c0212c # swapoff UUID=6fa72b96-b802-441f-a31c-091d65c0212c swapoff: cannot find the device for UUID=6fa72b96-b802-441f-a31c-091d65c0212c Reported-by: Sami Kerola <kerolasa@iki.fi> Signed-off-by: Karel Zak <kzak@redhat.com>
* fdisk: fix and improve -l warningsKarel Zak2014-11-071-2/+11
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>