]> git.ipfire.org Git - thirdparty/util-linux.git/log
thirdparty/util-linux.git
10 years agochrt: make the usage synopsis clearer
Benno Schulenberg [Thu, 11 Jun 2015 09:04:01 +0000 (11:04 +0200)] 
chrt: make the usage synopsis clearer

Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
10 years agolosetup: be careful with errno
Karel Zak [Mon, 15 Jun 2015 12:54:15 +0000 (14:54 +0200)] 
losetup: be careful with errno

Signed-off-by: Karel Zak <kzak@redhat.com>
10 years agotests: add JSON sfdisk dumps
Karel Zak [Mon, 15 Jun 2015 12:02:36 +0000 (14:02 +0200)] 
tests: add JSON sfdisk dumps

Signed-off-by: Karel Zak <kzak@redhat.com>
10 years agosfdisk: add --json
Karel Zak [Mon, 15 Jun 2015 11:23:36 +0000 (13:23 +0200)] 
sfdisk: add --json

Signed-off-by: Karel Zak <kzak@redhat.com>
10 years agolibfdisk: add JSON dump output
Karel Zak [Mon, 15 Jun 2015 11:18:09 +0000 (13:18 +0200)] 
libfdisk: add JSON dump output

Signed-off-by: Karel Zak <kzak@redhat.com>
10 years agolibfdisk: rename script functions to improve readability
Karel Zak [Mon, 15 Jun 2015 08:38:38 +0000 (10:38 +0200)] 
libfdisk: rename script functions to improve readability

Signed-off-by: Karel Zak <kzak@redhat.com>
10 years agotests: update fdisk BSD
Karel Zak [Thu, 11 Jun 2015 13:13:17 +0000 (15:13 +0200)] 
tests: update fdisk BSD

Signed-off-by: Karel Zak <kzak@redhat.com>
10 years agolibfdisk: add new API to read label specific data
Karel Zak [Thu, 11 Jun 2015 12:19:47 +0000 (14:19 +0200)] 
libfdisk: add new API to read label specific data

* removes list() label operation from internal API

  The list() has been based on fdisk_info() it was useless for
  anything else than print on stdout...

* add a new get_item() label operation and fdisk_get_disklabel_item() public API

  The new API provides abstract and pretty simple way how to get label
  specific disk label information, for example

     fdisk_get_disklabel_item(cxt, GPT_LABELITEM_ENTRIESLBA, &iterm);

  return LBA of the array with GPT entries.

  Note that this patch does not implement public functions to get
  data from the @item object.

* removes get_id() label operation -- it's subset of the new get_item()

* the new internal API is also used to implement backwardly compatible
  fdisk_list_disklabel() and fdisk_get_disklabel_id()

Signed-off-by: Karel Zak <kzak@redhat.com>
10 years agolibfdisk: (dos) fix cylinders calculation
Karel Zak [Wed, 10 Jun 2015 14:55:29 +0000 (16:55 +0200)] 
libfdisk: (dos) fix cylinders calculation

Signed-off-by: Karel Zak <kzak@redhat.com>
10 years agofstrim: de-duplicate by mount source too
Karel Zak [Wed, 10 Jun 2015 12:19:45 +0000 (14:19 +0200)] 
fstrim: de-duplicate by mount source too

Now fstrim de-duplicates by target (mountpoint). This patch adds
de-duplication according to mount source (device) to avoid bind mounts
or devices mounted more than once. Note that the patch also check FS
root, the different FS roots of the same multi-root FS (e.g. btrfs)
maybe mounted on different places.

  # mount --bind /home/wine /mnt/test

old version:

  # fstrim -av
  /mnt/test: 0 B (0 bytes) trimmed            <---
  /home/wine: 0 B (0 bytes) trimmed           <---
  /boot: 0 B (0 bytes) trimmed
  /home: 0 B (0 bytes) trimmed
  /: 0 B (0 bytes) trimmed

new version:

  # fstrim -av
  /mnt/test: 0 B (0 bytes) trimmed            <---
  /boot: 0 B (0 bytes) trimmed
  /home: 171.8 MiB (180113408 bytes) trimmed
  /: 0 B (0 bytes) trimmed

Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=1162213
Signed-off-by: Karel Zak <kzak@redhat.com>
10 years agofdisk: differentiate between +<sector> and +<size>{M,G,...}
Karel Zak [Wed, 10 Jun 2015 10:45:53 +0000 (12:45 +0200)] 
fdisk: differentiate between +<sector> and +<size>{M,G,...}

Signed-off-by: Karel Zak <kzak@redhat.com>
10 years agolibblkid: (nilfs2) check size for backup superblock only
Karel Zak [Tue, 9 Jun 2015 13:53:20 +0000 (15:53 +0200)] 
libblkid: (nilfs2) check size for backup superblock only

The size of the device seems irrelevant for the primary superblock.
The primary superblock is stored on fixed offset, possible collision
between last partition and whole-disk is possible only for backup
superblock only.

Signed-off-by: Karel Zak <kzak@redhat.com>
10 years agochrt: fix --help inconsistency
Karel Zak [Tue, 9 Jun 2015 09:16:45 +0000 (11:16 +0200)] 
chrt: fix --help inconsistency

Reported-by: Martin Steigerwald <ms@teamix.de>
Signed-off-by: Karel Zak <kzak@redhat.com>
10 years agolibblkid: (nilfs2) check devise size
Karel Zak [Tue, 9 Jun 2015 08:37:11 +0000 (10:37 +0200)] 
libblkid: (nilfs2) check devise size

Unfortunately, nilfs2 have the same problem like many RAIDs. It uses
the end of the device to store (backup) superblock. The end of the
last partition is the same location as the end of the whole-disk. It
means that the superblock seems valid for the last partitions as well
as for whole-device.

Fortunately, nilfs2 superblock contains size of the device, so we can
distinguish between whole-disk and partition device.

Reported-by: Heinz Diehl <htd+ml@fritha.org>
Signed-off-by: Karel Zak <kzak@redhat.com>
10 years agolibfdisk: improve +0 partition size
Karel Zak [Mon, 8 Jun 2015 15:26:31 +0000 (17:26 +0200)] 
libfdisk: improve +0 partition size

Signed-off-by: Karel Zak <kzak@redhat.com>
10 years agolibfdisk: (dos) fix tiny partitions calculation
Karel Zak [Mon, 8 Jun 2015 14:45:15 +0000 (16:45 +0200)] 
libfdisk: (dos) fix tiny partitions calculation

Signed-off-by: Karel Zak <kzak@redhat.com>
10 years agolibfdisk: (gpt) make it possible to create really small partitions
Karel Zak [Mon, 8 Jun 2015 14:02:17 +0000 (16:02 +0200)] 
libfdisk: (gpt) make it possible to create really small partitions

Signed-off-by: Karel Zak <kzak@redhat.com>
10 years agolibfdisk: support alignment to non power of 2
Karel Zak [Mon, 8 Jun 2015 13:41:33 +0000 (15:41 +0200)] 
libfdisk: support alignment to non power of 2

Let's create a disk with 33553920 bytes optimal I/O size:

# modprobe scsi_debug dev_size_mb=1000 opt_blks=65535

and try to create partition:

 echo -e 'n\n\n\n\n+512M\np\nq\n'  | fdisk /dev/sdc

old version:

 Device     Boot Start     End Sectors  Size Id Type
 /dev/sdc1       65535 1114110 1048576  512M 83 Linux

The next partition will be expected on sector 1114110 + 1, but it's
not aligned to optimal I/O:

        ((1114110 + 1) * 512) % 33553920 = 8192

fixed version:

 Device     Boot Start     End Sectors  Size Id Type
 /dev/sdc1       65535 1114094 1048560  512M 83 Linux

        ((1114094 + 1) * 512) % 33553920 = 0

Note that the same problem with alignment calculation has been fixed
in Linux kernel by commit b8839b8c55f3fdd60dc36abcda7e0266aff7985c
(Oct 2014).

The patch also improves fdisk_align_lba_in_range() to not align sizes
smaller than grain (default 1MiB) to make it possible to create really
small partitions.

Reported-by: Tom Yan <tom.ty89@gmail.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
10 years agosulogin: Use read instead of allocated size from getline()
Guillem Jover [Sat, 6 Jun 2015 04:26:43 +0000 (06:26 +0200)] 
sulogin: Use read instead of allocated size from getline()

The getline function distinguishes between the allocated and read
lenghts, and we should not mix them up, as we might end up processing
junk.

Signed-off-by: Guillem Jover <guillem@hadrons.org>
10 years agoinclude/c: Define F_DUPFD_CLOEXEC on kFreeBSD systems if missing
Guillem Jover [Sat, 6 Jun 2015 04:19:07 +0000 (06:19 +0200)] 
include/c: Define F_DUPFD_CLOEXEC on kFreeBSD systems if missing

The kernel of FreeBSD version 10 and higher supports this fcntl command,
but the system libc, in this case glibc, might not yet know about it.

Signed-off-by: Guillem Jover <guillem@hadrons.org>
10 years agolib/sysfs: Use dup_fd_cloexec instead of direct call to fcntl
Guillem Jover [Sat, 6 Jun 2015 04:19:06 +0000 (06:19 +0200)] 
lib/sysfs: Use dup_fd_cloexec instead of direct call to fcntl

Signed-off-by: Guillem Jover <guillem@hadrons.org>
10 years agolib/fileutils: Add new dup_fd_cloexec function
Guillem Jover [Sat, 6 Jun 2015 04:19:05 +0000 (06:19 +0200)] 
lib/fileutils: Add new dup_fd_cloexec function

This function duplicates and marks a file descriptor as close-on-exec.
Takes care of build and run-time support for the fcntl F_DUPFD_CLOEXEC
command, and other errors.

Signed-off-by: Guillem Jover <guillem@hadrons.org>
10 years agoman: fix nolazytime typo in mount(8)
Andreas Henriksson [Wed, 3 Jun 2015 16:32:09 +0000 (18:32 +0200)] 
man: fix nolazytime typo in mount(8)

Avoids double negation...

Addresses: http://bugs.debian.org/786554
Reported-by: Felix Zielcke <fzielcke@z-51.de>
Signed-off-by: Andreas Henriksson <andreas@fatal.se>
10 years agobash-completion: remove unused variables [shellcheck]
Boris Egorov [Tue, 2 Jun 2015 17:59:03 +0000 (23:59 +0600)] 
bash-completion: remove unused variables [shellcheck]

Fix shellcheck SC2034 warnings.

Signed-off-by: Boris Egorov <egorov@linux.com>
10 years agobash-completion: sync lscpu completion with code
Boris Egorov [Tue, 2 Jun 2015 17:59:02 +0000 (23:59 +0600)] 
bash-completion: sync lscpu completion with code

Remove unexistent option, add two not listed in completion.

Signed-off-by: Boris Egorov <egorov@linux.com>
10 years agobash-completion: handle comma-separated options
Boris Egorov [Tue, 2 Jun 2015 17:59:01 +0000 (23:59 +0600)] 
bash-completion: handle comma-separated options

This solution can become messy when you have too many options listed,
because it repeats all of them. For example, after invoking completion
with this input:

    $ partx --output END,SECTORS,SCHEME,START,

You got these completions:

    END,SECTORS,SCHEME,START,FLAGS,  END,SECTORS,SCHEME,START,NR,
    END,SECTORS,SCHEME,START,TYPE,
    END,SECTORS,SCHEME,START,NAME,   END,SECTORS,SCHEME,START,SIZE,
    END,SECTORS,SCHEME,START,UUID,

Nevertheless, it works even with numbers (listed options properly
excluded from completion). Try to invoke completion after
'chcpu --disable ' or 'lsblk --exclude ' to see it in action.

Few issues remained:

    * completion interrupts after encountering ':' in listed option,
    like in 'MAJ:MIN' in lsblk, losetup.
    * lscpu completion is broken: it inserts space after '--extended',
    but lscpu assumes there is no space after this option. It also
    doesn't complete '--parse' option.
    * some completion options are outdated (for example, lscpu MMHZ). We
    need to sync them with code. Fix for lscpu follows.

Signed-off-by: Boris Egorov <egorov@linux.com>
10 years agolibsmartcols: keep JSON field names lower-case
Karel Zak [Fri, 5 Jun 2015 09:58:42 +0000 (11:58 +0200)] 
libsmartcols: keep JSON field names lower-case

Signed-off-by: Karel Zak <kzak@redhat.com>
10 years agolslocks: add --json
Karel Zak [Fri, 5 Jun 2015 08:45:15 +0000 (10:45 +0200)] 
lslocks: add --json

Signed-off-by: Karel Zak <kzak@redhat.com>
10 years agolosetup: add --json
Karel Zak [Fri, 5 Jun 2015 08:30:52 +0000 (10:30 +0200)] 
losetup: add --json

Signed-off-by: Karel Zak <kzak@redhat.com>
10 years agofindmnt: add --json
Karel Zak [Fri, 5 Jun 2015 07:47:59 +0000 (09:47 +0200)] 
findmnt: add --json

Signed-off-by: Karel Zak <kzak@redhat.com>
10 years agolsblk: add --json
Karel Zak [Thu, 4 Jun 2015 13:49:52 +0000 (15:49 +0200)] 
lsblk: add --json

Signed-off-by: Karel Zak <kzak@redhat.com>
10 years agolibsmartcols: add JSON output format
Karel Zak [Thu, 4 Jun 2015 13:47:21 +0000 (15:47 +0200)] 
libsmartcols: add JSON output format

Signed-off-by: Karel Zak <kzak@redhat.com>
10 years agolibmount: (docs) fix wording
Ronny Chevalier [Wed, 3 Jun 2015 11:21:52 +0000 (13:21 +0200)] 
libmount: (docs) fix wording

Signed-off-by: Ronny Chevalier <chevalier.ronny@gmail.com>
10 years agolibmount: (docs) fix typo
Ronny Chevalier [Wed, 3 Jun 2015 11:06:59 +0000 (13:06 +0200)] 
libmount: (docs) fix typo

Signed-off-by: Ronny Chevalier <chevalier.ronny@gmail.com>
10 years agolosetup: print more usable error message on failed -f
Karel Zak [Wed, 3 Jun 2015 10:05:09 +0000 (12:05 +0200)] 
losetup: print more usable error message on failed -f

Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=1215370
Signed-off-by: Karel Zak <kzak@redhat.com>
10 years agolibmount: do not call umount helper on --fake
Karel Zak [Wed, 3 Jun 2015 08:59:35 +0000 (10:59 +0200)] 
libmount: do not call umount helper on --fake

The umount.<type> helpers does not support --fake option and it does
not make sense to call the helpers at all. All we need is to remove
mtab/utab entries.

Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=1172297
Signed-off-by: Karel Zak <kzak@redhat.com>
10 years agolscpu: add warning for __SANITIZE_ADDRESS__
Karel Zak [Tue, 2 Jun 2015 12:52:56 +0000 (14:52 +0200)] 
lscpu: add warning for __SANITIZE_ADDRESS__

Signed-off-by: Karel Zak <kzak@redhat.com>
10 years agosys-utils: lscpu segfaults when built with -fsanitize=address
Cristian Rodríguez [Sat, 30 May 2015 18:51:41 +0000 (15:51 -0300)] 
sys-utils: lscpu segfaults when built with -fsanitize=address

This is expected and a false positive, exclude the vmware detection
trick when __SANITIZE_ADDRESS__ is defined.

10 years agolsblk.8: Fix description of output format
Stanislav Brabec [Thu, 28 May 2015 15:41:39 +0000 (17:41 +0200)] 
lsblk.8: Fix description of output format

Signed-off-by: Stanislav Brabec <sbrabec@suse.cz>
10 years agolibmount: fix mnt_monitor_event_cleanup()
Karel Zak [Mon, 1 Jun 2015 11:17:41 +0000 (13:17 +0200)] 
libmount: fix mnt_monitor_event_cleanup()

We have to call epoll to drain mountinfo events too. The problem is
visible if the monitor epoll FD is within another (top-level) epoll.

Signed-off-by: Karel Zak <kzak@redhat.com>
10 years agolsblk: use internally sysfs devnames
Karel Zak [Fri, 29 May 2015 08:55:01 +0000 (10:55 +0200)] 
lsblk: use internally sysfs devnames

It seems better to keep the strange sysfs devnames internally and
translate to real devnames only on output or when we read from /dev.

Signed-off-by: Karel Zak <kzak@redhat.com>
10 years agodocs: fix gtk-docs related warnings
Karel Zak [Thu, 28 May 2015 10:28:23 +0000 (12:28 +0200)] 
docs: fix gtk-docs related warnings

Signed-off-by: Karel Zak <kzak@redhat.com>
10 years agolib/sysfs: rename devname functions, cleanup
Karel Zak [Thu, 28 May 2015 10:09:41 +0000 (12:09 +0200)] 
lib/sysfs: rename devname functions, cleanup

Well, I don't have mental power to use function names like

 sysfs_devname_to_dev_name()

so this patch renames to

 sysfs_devname_sys_to_dev()
 sysfs_devname_dev_to_sys()

It also cleanups usage of the functions. We have to be sure that
sysfs.c code returns regular devnames. The existence of the sysfs
devnames (with '!') should be completely hidden in sysfs specific
code.

Signed-off-by: Karel Zak <kzak@redhat.com>
10 years agolib/sysfs: Fix /dev to /sys node name translation
Stanislav Brabec [Wed, 27 May 2015 13:12:08 +0000 (15:12 +0200)] 
lib/sysfs: Fix /dev to /sys node name translation

d0dc6c1 introduced translation of /sys names to /dev names, as required
by the kernel linux/drivers/base/core.c: device_get_devnode(). But there
are other places of code that use /dev names in /sys. They need reverse
translation from '/' to '!'.

For example, fdisk -l returns empty list since a22c6eb for device nodes
in subdirectories (used e. g. by cciss driver).

Introduce yet another helper sysfs_dev_name_to_devname() and use it where
appropriate.

Signed-off-by: Stanislav Brabec <sbrabec@suse.cz>
10 years agolibfdisk: Use predictable /dev/mapper partition names for /dev/dm-N
Stanislav Brabec [Tue, 26 May 2015 15:59:29 +0000 (17:59 +0200)] 
libfdisk: Use predictable /dev/mapper partition names for /dev/dm-N

It is impossible to predict /dev/dm-N partition names. Use predictable
and better readable /dev/mapper names instead.

[kzak@redhat.com: - remove if-before-free]

Signed-off-by: Stanislav Brabec <sbrabec@suse.cz>
Signed-off-by: Karel Zak <kzak@redhat.com>
10 years agoUse correct partition names for /dev/mapper
Stanislav Brabec [Mon, 25 May 2015 19:17:52 +0000 (21:17 +0200)] 
Use correct partition names for /dev/mapper

The default configuration of multipath-tools appends "-partN" to
partition nodes. Follow this conventions and do the same.

It fixes for example fdisk -l /dev/mapper/name_of_the_device.

Note that the current implementation only partially fixes the problem. It
does not reflect any udev configuration changes, as udev does not provide
any function to return names of future (or current) partitions of a
particular device. It also does not fix fdisk -l /dev/dm-0.

Signed-off-by: Stanislav Brabec <sbrabec@suse.cz>
10 years agoFix /sys to /dev node name translation
Stanislav Brabec [Mon, 25 May 2015 16:21:36 +0000 (18:21 +0200)] 
Fix /sys to /dev node name translation

linux/drivers/base/core.c: device_get_devnode() defines a translation of
'!' in sysfs nodes to '/' in /dev nodes. The same translation has to be
done to properly support device nodes with slash (e. g. device nodes of
cciss driver and several other drivers).

Introduce new helper sysfs_devname_to_devno() and use it where
appropriate.

Fixes for example lsblk -f on devices using cciss driver.

Signed-off-by: Stanislav Brabec <sbrabec@suse.cz>
10 years agohwclock: don't allow non-root access
Karel Zak [Tue, 26 May 2015 08:32:38 +0000 (10:32 +0200)] 
hwclock: don't allow non-root access

Fortunately very few people are crazy enough to install hwclock as
setuid. Some comments in code and unfortunately also man page
advertising that setuid is no problem. That's pretty stupid promise.

The code quality is poor and it's obviously not designed to be secure
(things like popen() without drop privileges, etc.).

This patch removes all notes about "setuid support" and for sure
disable hwclock execution for non-root users.

Addresses: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=786804
Signed-off-by: Karel Zak <kzak@redhat.com>
10 years agosulogin: don't use strcpy(), enlarge pwd line buffer
Karel Zak [Mon, 25 May 2015 13:24:13 +0000 (15:24 +0200)] 
sulogin: don't use strcpy(), enlarge pwd line buffer

* according to "man getpwnam" 16384 bytes is enough to store one
  passwd entry (let's use 2*BUFSIZE to avoid magic numbers in code)

* don't use strcpy() to set empty password

Signed-off-by: Karel Zak <kzak@redhat.com>
10 years agobuild-sys: add --without-* for all libs
Karel Zak [Fri, 22 May 2015 10:43:33 +0000 (12:43 +0200)] 
build-sys: add --without-* for all libs

It's necessary for people who want to compile util-linux in very
unusual environment and disable as much as possible dependencies.
For example distro bootstrap.

References: https://bugzilla.redhat.com/show_bug.cgi?id=1223894
Signed-off-by: Karel Zak <kzak@redhat.com>
10 years agoblkid: another hint to the man page
Karel Zak [Thu, 21 May 2015 11:13:49 +0000 (13:13 +0200)] 
blkid: another hint to the man page

Signed-off-by: Karel Zak <kzak@redhat.com>
10 years agoblkid: be more precise in the man page
Karel Zak [Thu, 21 May 2015 10:37:18 +0000 (12:37 +0200)] 
blkid: be more precise in the man page

Signed-off-by: Karel Zak <kzak@redhat.com>
10 years agoblkid: don't ignore info about partitions on non-formated devices
Karel Zak [Thu, 21 May 2015 10:14:32 +0000 (12:14 +0200)] 
blkid: don't ignore info about partitions on non-formated devices

 # blkid -p /dev/sdc1; echo $?
 2

but libblkid provides information about partition, fixed version:

 # blkid -p /dev/sdc1; echo $?
 /dev/sdc1: PART_ENTRY_SCHEME="dos" PART_ENTRY_UUID="4c1e518c-01" PART_ENTRY_TYPE="0x83" PART_ENTRY_NUMBER="1" PART_ENTRY_OFFSET="2048" PART_ENTRY_SIZE="1021952" PART_ENTRY_DISK="8:32"
 0

Signed-off-by: Karel Zak <kzak@redhat.com>
10 years agodocs: update TODO
Karel Zak [Tue, 19 May 2015 12:40:42 +0000 (14:40 +0200)] 
docs: update TODO

Signed-off-by: Karel Zak <kzak@redhat.com>
10 years agobuild-sys: support unshare.static
Georg Schiesser [Tue, 5 May 2015 11:19:51 +0000 (13:19 +0200)] 
build-sys: support unshare.static

This patch adds support for building a static version of unshare.
We need to add unshare to the list of possible static programs, and
provide build flags for the compiler and linker, which are equivalent to
the flags of the non-static program, except additional static linking.
See also: commit 2fa60c5 build-sys: support nsenter.static

Signed-off-by: Georg Schiesser <georg.schiesser@opentech.at>
10 years agocal: fix January 1753 week number printout
Sami Kerola [Sun, 17 May 2015 17:27:42 +0000 (18:27 +0100)] 
cal: fix January 1753 week number printout

Earlier output was clearly broken.

$ cal -w 1 1753
      January 1753
   Su Mo Tu We Th Fr Sa
51     1  2  3  4  5  6
52  7  8  9 10 11 12 13
52 14 15 16 17 18 19 20
52 21 22 23 24 25 26 27
52 28 29 30 31

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
10 years agozramctl: add MEM-LIMIT, MEM-USED and MIGRATED columns
Karel Zak [Mon, 18 May 2015 09:30:56 +0000 (11:30 +0200)] 
zramctl: add MEM-LIMIT, MEM-USED and MIGRATED columns

Signed-off-by: Karel Zak <kzak@redhat.com>
10 years agozramctl: support /sys/block/zram<id>/mm_stat
Karel Zak [Mon, 18 May 2015 09:13:44 +0000 (11:13 +0200)] 
zramctl: support /sys/block/zram<id>/mm_stat

Linux >= 4.1 provides all memory related statistics by one file.

Signed-off-by: Karel Zak <kzak@redhat.com>
10 years agolib/strv: add new functions (from systemd)
Karel Zak [Fri, 15 May 2015 12:57:04 +0000 (14:57 +0200)] 
lib/strv: add new functions (from systemd)

Signed-off-by: Karel Zak <kzak@redhat.com>
10 years agoscript: Fix mangled EOF and hang on big endian
Stanislav Brabec [Thu, 14 May 2015 15:55:56 +0000 (17:55 +0200)] 
script: Fix mangled EOF and hang on big endian

On s390 and other big endian machines, doinput() sends NUL instead of
EOF to the tty master. NUL does not even reach the slave, and it is
waiting for more data forever.

If STDIN is not a tty, the bug caused "^@" being into the log, and since
commit 032228c it also causes hang.

Signed-off-by: Stanislav Brabec <sbrabec@suse.cz>
10 years agoMerge branch 'test-fixes' of https://github.com/rudimeier/util-linux
Karel Zak [Wed, 13 May 2015 13:08:04 +0000 (15:08 +0200)] 
Merge branch 'test-fixes' of https://github.com/rudimeier/util-linux

* 'test-fixes' of https://github.com/rudimeier/util-linux:
  tests: fix kill/all_processes
  tests: add $top_builddir to $PATH

10 years agotests: update lscpu tests (due to CPU flags in output)
Karel Zak [Wed, 13 May 2015 13:06:22 +0000 (15:06 +0200)] 
tests: update lscpu tests (due to CPU flags in output)

Signed-off-by: Karel Zak <kzak@redhat.com>
10 years agolscpu: add cpu flags entry to summary output
WANG Chao [Wed, 13 May 2015 03:15:05 +0000 (11:15 +0800)] 
lscpu: add cpu flags entry to summary output

It'd be convenient to have unified cpu "Flags: " entry in the summary
output.

Signed-off-by: WANG Chao <wcwxyz@gmail.com>
10 years agolibfdisk: keep FDISK_FIELD_CYLINDERS independent on context mode
Karel Zak [Mon, 11 May 2015 11:01:26 +0000 (13:01 +0200)] 
libfdisk: keep FDISK_FIELD_CYLINDERS independent on context mode

Signed-off-by: Karel Zak <kzak@redhat.com>
10 years agofdisk: provide more information by 'i'nfo command
Karel Zak [Mon, 11 May 2015 10:45:21 +0000 (12:45 +0200)] 
fdisk: provide more information by 'i'nfo command

Signed-off-by: Karel Zak <kzak@redhat.com>
10 years agolibfdisk: add fdisk_label_get_fields_ids_all()
Karel Zak [Mon, 11 May 2015 10:42:24 +0000 (12:42 +0200)] 
libfdisk: add fdisk_label_get_fields_ids_all()

The current fdisk_label_get_fields_ids() is too smart as it
differentiate between details mode etc. It's useful for default
output, but in some cases it's better to provide all output fields.

Signed-off-by: Karel Zak <kzak@redhat.com>
10 years agofdisk: add the 'i'nfo command
Jean-Loup 'clippix' Bogalho [Sat, 9 May 2015 21:15:23 +0000 (23:15 +0200)] 
fdisk: add the 'i'nfo command

Add the 'i'nfo command to fdisk that prints details about a specific partition.
Details are everything the function 'fdisk_label_get_field' can return.

Signed-off-by: Jean-Loup 'clippix' Bogalho <clippix@lse.epita.fr>
10 years agotests: add hexdump from GPT
Karel Zak [Mon, 11 May 2015 10:18:12 +0000 (12:18 +0200)] 
tests: add hexdump from GPT

* use hardcoded UUIDs for partitions in sfdisk GPT test
* output hexdump of the GPT header (it would be possible to use MD5
  sum, but from hexdump it's more obvious where is problem)

Signed-off-by: Karel Zak <kzak@redhat.com>
10 years agolibfdisk: (gpt) fix attributes endianess
Ruediger Meier [Fri, 8 May 2015 11:39:53 +0000 (13:39 +0200)] 
libfdisk: (gpt) fix attributes endianess

The new libfdisk/gpt test (4a4a0927) discovered that we read and write
partition attributes wrongly on BE systems.

Our temporarily used char[8] bits are always LE and do not need to be
converted.

CC: Michael Marineau <michael.marineau@coreos.com>
Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
10 years agotests: fix kill/all_processes
Ruediger Meier [Thu, 7 May 2015 13:20:47 +0000 (15:20 +0200)] 
tests: fix kill/all_processes

We have to wait for the killed helper.

Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
10 years agotests: add $top_builddir to $PATH
Ruediger Meier [Mon, 13 Apr 2015 13:51:02 +0000 (15:51 +0200)] 
tests: add $top_builddir to $PATH

Since we have dropped some more hardcoded search paths we should
make sure that our tested binaries would use the right helpers
from our build directory.

See 07b51567 and follow-up commits.

Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
10 years agoRevert "travise: try to add coverity_scan"
Karel Zak [Wed, 6 May 2015 14:43:35 +0000 (16:43 +0200)] 
Revert "travise: try to add coverity_scan"

This reverts commit 3053e14997194849b17a7dae3d4a0366a52c6b45.

10 years agotravise: try to add coverity_scan
Karel Zak [Wed, 6 May 2015 14:16:17 +0000 (16:16 +0200)] 
travise: try to add coverity_scan

Signed-off-by: Karel Zak <kzak@redhat.com>
10 years agoflock: NULL deref
Brad Forschinger [Tue, 5 May 2015 01:51:24 +0000 (11:51 +1000)] 
flock: NULL deref

cmd_argv[2] will be initialised only if it's specificed with -c.  NULL
deref otherwise resulting in crash.

Signed-off-by: Brad Forschinger <bnjf@bnjf.id.au>
10 years agobuild-sys: fix parallel builds w/setarch links
Mike Frysinger [Mon, 4 May 2015 03:51:04 +0000 (23:51 -0400)] 
build-sys: fix parallel builds w/setarch links

The symlink generation tries to write to the sys-utils/ subdir but does
not make sure that dir exists.  This can sometimes lead to parallel build
failures when building out-of-tree like:
...
echo ".so man8/setarch.8" > sys-utils/linux64.8
/bin/bash: sys-utils/linux64.8: No such file or directory
Makefile:11503: recipe for target 'sys-utils/linux64.8' failed
make: *** [sys-utils/linux64.8] Error 1

References: https://bugs.gentoo.org/511812
Signed-off-by: Mike Frysinger <vapier@chromium.org>
10 years agolibfdisk: (gpt) add API for raw partition attributes
Michael Marineau [Sat, 2 May 2015 22:52:48 +0000 (15:52 -0700)] 
libfdisk: (gpt) add API for raw partition attributes

The existing APIs can only toggle individual bits or get and set bits in
a complex text representation, making it impractical to use libfdisk for
manipulating the GPT partition attribute field in more complex ways such
as updating a value that is multiple bits wide. For example priority
based partition selection originally designed for ChromeOS includes two
integer values that are 4-bits wide.

http://www.chromium.org/chromium-os/chromiumos-design-docs/disk-format#TOC-Trusting-the-GPT

[kzak@redhat.com: - add new symbols to .sym file and docs
                  - remove unused variables from test program]

Signed-off-by: Michael Marineau <michael.marineau@coreos.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
10 years agolibfdisk: (gpt) fix check for beginning of protective partition
Michael Marineau [Sat, 2 May 2015 04:44:33 +0000 (21:44 -0700)] 
libfdisk: (gpt) fix check for beginning of protective partition

Search for the protective partition before attempting to validate that
it covers the GPT header. Some hybrid MBRs list partitions out of order.
For example, CoreOS images ship with a hybrid MBR that lists the boot
partition first and the protective partition second in order to maintain
compatibility with old versions of Xen's PV-GRUB.

Signed-off-by: Michael Marineau <michael.marineau@coreos.com>
10 years agofsck: Fix parsing of -r
Stanislav Brabec [Wed, 29 Apr 2015 16:49:47 +0000 (18:49 +0200)] 
fsck: Fix parsing of -r

Fix regression introduced by commit 658c089: -r cannot be used as a last
option:

fsck -r /dev/sda1
fsck: invalid argument -r: '/dev/sda1'

Signed-off-by: Stanislav Brabec <sbrabec@suse.cz>
10 years agodocs: fix TODO typos
Karel Zak [Tue, 28 Apr 2015 12:04:15 +0000 (14:04 +0200)] 
docs: fix TODO typos

Signed-off-by: Karel Zak <kzak@redhat.com>
10 years agodocs: update TODO
Karel Zak [Tue, 28 Apr 2015 12:00:28 +0000 (14:00 +0200)] 
docs: update TODO

Signed-off-by: Karel Zak <kzak@redhat.com>
10 years agofsck: print errors on invalid -r argument
Karel Zak [Tue, 28 Apr 2015 11:43:14 +0000 (13:43 +0200)] 
fsck: print errors on invalid -r argument

The patch also add support for -r 0.

Signed-off-by: Karel Zak <kzak@redhat.com>
10 years agofsck: implement fsck -r {fd}
Stanislav Brabec [Mon, 27 Apr 2015 15:20:55 +0000 (17:20 +0200)] 
fsck: implement fsck -r {fd}

Make possible sending of statistics to a dedicated file descriptor.

Rationale: When UI is calling fsck from a remote terminal, fsck progress
needs to be sent to stdout. It is mixed there with output of statistics,
and it is impossible to parse the output to get the statistics.

Now it will be possible e. g. with "fsck -C -r 3 /dev/sda1"

Note: Code in if and else is intentionally partially duplicated. Current
human readable output of floats does not conform to locale conventions,
and may be changed in future. But we want to keep machine readable output
exactly same as it is now.

[kzak@redhat.com: - don't use report_stats_fd globally]

Signed-off-by: Stanislav Brabec <sbrabec@suse.cz>
Signed-off-by: Karel Zak <kzak@redhat.com>
10 years agohwclock: fix spelling, punctuation and formatting mistakes in the man page
Benno Schulenberg [Wed, 8 Apr 2015 08:22:43 +0000 (10:22 +0200)] 
hwclock: fix spelling, punctuation and formatting mistakes in the man page

Also improve some wordings.

Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
10 years agohwclock: clean up man page header
Karel Zak [Tue, 28 Apr 2015 10:27:18 +0000 (12:27 +0200)] 
hwclock: clean up man page header

We already use .TQ in another man pages for years and nobody
complains, so I guess the fallback is unnecessary.

The patch also minimize in-header change-log. We have git for this
purpose.

Signed-off-by: Karel Zak <kzak@redhat.com>
10 years agohwclock: remove an untrue phrase from the man page
Benno Schulenberg [Tue, 17 Mar 2015 20:34:51 +0000 (21:34 +0100)] 
hwclock: remove an untrue phrase from the man page

Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
10 years agofsck: use PATH or fallback to /sbin
Karel Zak [Mon, 27 Apr 2015 08:51:33 +0000 (10:51 +0200)] 
fsck: use PATH or fallback to /sbin

It's overkill to support all the obscure paths like /sbin/fs.d. We
have PATH for customization, that's enough.

It still seems like a good idea to keep fsck robust, because it's used
by boot scripts/systemd. For this reason fsck fallbacks to "/sbin" if
PATH is undefined or empty.

Signed-off-by: Karel Zak <kzak@redhat.com>
10 years agoswapon: search for mkswap via PATH
Mike Frysinger [Sun, 12 Apr 2015 09:06:52 +0000 (05:06 -0400)] 
swapon: search for mkswap via PATH

Rather than hardcode /sbin/mkswap all the time, use a normal PATH search.
This matches the normal behavior of other tools, and makes local testing
easier.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
10 years agomkfs: drop hardcoded search path
Mike Frysinger [Sun, 12 Apr 2015 09:06:51 +0000 (05:06 -0400)] 
mkfs: drop hardcoded search path

Rather than maintain a hardcoded search path for looking up tools and
override the user's PATH env setting, respect whatever the user has.
This matches the convention of just about every other tool out there.

It might break on systems that don't have /sbin in their PATH and they
try to run /sbin/mkfs directly, but so be it.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
10 years agohwclock: flush stdout in hwclock -c
Alexey Galakhov [Thu, 16 Apr 2015 15:26:27 +0000 (17:26 +0200)] 
hwclock: flush stdout in hwclock -c

This allows using hwclock -c in automated test scripts that parse
its output line-by-line. The standard output is flushed before
each 10 second delay.

Signed-off-by: Alexey Galakhov <agalakhov@gmail.com>
10 years agohwclock: Remove TZUTC
J William Piggott [Thu, 23 Apr 2015 23:53:58 +0000 (19:53 -0400)] 
hwclock: Remove TZUTC

commit d53f8ecfbf036eddb2aef737dc0973a613d80ced
introduced the TZUTC environment variable to
facilitate use of the zoneinfo 'right' database.
This was incorrect. Either the TZDIR environment
variable should be used or a system-wide
configuration for the 'right' database should be
used.

See hwclock(8) POSIX vs 'RIGHT' for more details.

TZUTC was undocumented and should be safe to remove.

The commit also caused a regression when using
musl libc, because when TZUTC is unset getenv()
returns a NULL pointer.
Reported-by: Isaac Dunham <ibid.ag@gmail.com>
Signed-off-by: J William Piggott <elseifthen@gmx.com>
10 years agotest_uuidd: add comment
Karel Zak [Fri, 24 Apr 2015 15:09:17 +0000 (17:09 +0200)] 
test_uuidd: add comment

Signed-off-by: Karel Zak <kzak@redhat.com>
10 years agotest_uuidd: add pid, tid and idx back to object
Karel Zak [Fri, 24 Apr 2015 13:53:28 +0000 (15:53 +0200)] 
test_uuidd: add pid, tid and idx back to object

Signed-off-by: Karel Zak <kzak@redhat.com>
10 years agotest_uuidd: make objdump more robust
Karel Zak [Fri, 24 Apr 2015 13:01:23 +0000 (15:01 +0200)] 
test_uuidd: make objdump more robust

Signed-off-by: Karel Zak <kzak@redhat.com>
10 years agotest_uuidd: fix include
Karel Zak [Fri, 24 Apr 2015 12:54:09 +0000 (14:54 +0200)] 
test_uuidd: fix include

Signed-off-by: Karel Zak <kzak@redhat.com>
10 years agotest_uuidd: don't exit on failed pthread_create()
Karel Zak [Fri, 24 Apr 2015 12:47:49 +0000 (14:47 +0200)] 
test_uuidd: don't exit on failed pthread_create()

Signed-off-by: Karel Zak <kzak@redhat.com>
10 years agotest_uuidd: don't exit on failed pthread_create()
Karel Zak [Fri, 24 Apr 2015 12:47:09 +0000 (14:47 +0200)] 
test_uuidd: don't exit on failed pthread_create()

Signed-off-by: Karel Zak <kzak@redhat.com>
10 years agotest_uuidd: improve readability
Karel Zak [Fri, 24 Apr 2015 12:25:30 +0000 (14:25 +0200)] 
test_uuidd: improve readability

Signed-off-by: Karel Zak <kzak@redhat.com>
10 years agotest_uuidd: cleanup counters names
Karel Zak [Fri, 24 Apr 2015 11:39:17 +0000 (13:39 +0200)] 
test_uuidd: cleanup counters names

Signed-off-by: Karel Zak <kzak@redhat.com>
10 years agotest_uuidd: cleanup pid usage
Karel Zak [Fri, 24 Apr 2015 11:35:54 +0000 (13:35 +0200)] 
test_uuidd: cleanup pid usage

Signed-off-by: Karel Zak <kzak@redhat.com>
10 years agotest_uuidd: cleanup used types
Karel Zak [Fri, 24 Apr 2015 11:28:12 +0000 (13:28 +0200)] 
test_uuidd: cleanup used types

Signed-off-by: Karel Zak <kzak@redhat.com>