]> git.ipfire.org Git - thirdparty/util-linux.git/log
thirdparty/util-linux.git
10 years agocal: limit year to 32 bit value
Sami Kerola [Wed, 15 Jan 2014 20:15:51 +0000 (20:15 +0000)] 
cal: limit year to 32 bit value

This is done to keep things simple, when considering tests, for both 64
and 32 bit architectures.  Setting the upper limit of a year value to to
2^31-1 (2147483646) should be enough for anyone.

Reported-by: Mike Frysinger <vapier@gentoo.org>
Reference: http://www.spinics.net/lists/util-linux-ng/msg08662.html
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
10 years agofsck: don't return error if fsck.<type> does not exist
Karel Zak [Thu, 6 Feb 2014 15:42:26 +0000 (16:42 +0100)] 
fsck: don't return error if fsck.<type> does not exist

The error message is expected for "really wanted" set of filesystems
(extN, ..), otherwise it does not make sense for filesystems like
btrfs or xfs.

Reported-by: Tom Gundersen <teg@jklm.no>
Signed-off-by: Karel Zak <kzak@redhat.com>
10 years agonsenter: fix set{gid,uid} order,drop supplementary groups
Karel Zak [Thu, 6 Feb 2014 13:14:50 +0000 (14:14 +0100)] 
nsenter: fix set{gid,uid} order,drop supplementary groups

.. always, always setgid() before setuid()!

Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=1061751
Signed-off-by: Karel Zak <kzak@redhat.com>
10 years agodmesg: -w output not line-buffered
Karel Zak [Thu, 6 Feb 2014 10:48:40 +0000 (11:48 +0100)] 
dmesg: -w output not line-buffered

when writing to e.g. a pipe, output from dmesg -w can come many
minutes late due to buffering.

Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=1060925
Signed-off-by: Karel Zak <kzak@redhat.com>
10 years agolosetup: wait for udev
Karel Zak [Fri, 24 Jan 2014 12:58:40 +0000 (13:58 +0100)] 
losetup: wait for udev

On system with /dev/lop-control the udevd creates /dev/loopN nodes.
It seems better to wait a moment after unsuccessful open(/dev/loopN)
and try it to open again.

The problem is pretty visible on systems where udevd also modifies
permission for loopN devices, then open() fails with EACCES when
losetup executed by non-root user (but user who is in "disk" group).

Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=1045432
Signed-off-by: Karel Zak <kzak@redhat.com>
10 years agoinclude/c.h: prefer nanosleep() over usleep()
Karel Zak [Fri, 24 Jan 2014 12:04:14 +0000 (13:04 +0100)] 
include/c.h: prefer nanosleep() over usleep()

Let's use nanosleep() although if usleep() exists. The nanosleep
function does no interact with signals and other timers.

The patch introduces xusleep() as replacement to libc (or our fallback)
usleep(). Yes, we don't want to use struct timespec + nanosleep()
everywhere in code as nano-time resolution is useless for us.

The patch also enlarges delays in some busy wait loops. It seems
enough to try read/write 4x per second.

Signed-off-by: Karel Zak <kzak@redhat.com>
10 years agoflock: Change the 'exit status' man page section to make more sense
Wieland Hoffmann [Thu, 16 Jan 2014 00:06:32 +0000 (01:06 +0100)] 
flock: Change the 'exit status' man page section to make more sense

Signed-off-by: Wieland Hoffmann <themineo@gmail.com>
10 years agowipefs: call BLKRRPART when erase partition table
Karel Zak [Mon, 20 Jan 2014 11:07:35 +0000 (12:07 +0100)] 
wipefs: call BLKRRPART when erase partition table

It's better to be smart than make things inconsistent (without
BLKRRPART kernel still uses the erased PT and udev-db still contains
obsolete information).

Signed-off-by: Karel Zak <kzak@redhat.com>
10 years agolibblkid: detect alone PMBR
Karel Zak [Mon, 20 Jan 2014 09:51:00 +0000 (10:51 +0100)] 
libblkid: detect alone PMBR

wipefs(8) has to also erase PMBR, not GPR header only, otherwise the
device could be still interpreted as a device with a partition table.

Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=1054186
Signed-off-by: Karel Zak <kzak@redhat.com>
10 years agotests: update build-sys tests
Karel Zak [Fri, 17 Jan 2014 14:00:55 +0000 (15:00 +0100)] 
tests: update build-sys tests

Signed-off-by: Karel Zak <kzak@redhat.com>
10 years agobuild-sys: fstrim depends on libmount
Karel Zak [Fri, 17 Jan 2014 13:34:53 +0000 (14:34 +0100)] 
build-sys: fstrim depends on libmount

Signed-off-by: Karel Zak <kzak@redhat.com>
10 years agomkswap: fix compiler warning [-Wunused-variable]
Karel Zak [Fri, 17 Jan 2014 13:33:31 +0000 (14:33 +0100)] 
mkswap: fix compiler warning [-Wunused-variable]

Signed-off-by: Karel Zak <kzak@redhat.com>
10 years agolibblkid: no more probe for btrfs backup superblock
Karel Zak [Thu, 16 Jan 2014 15:38:30 +0000 (16:38 +0100)] 
libblkid: no more probe for btrfs backup superblock

 * Linux kernel cares about the first superblock only

 * backup superblock are FS specific stuff and there is no reason to
   care about it in generic tools

 * the problem with broken btrfs utils has been already fixed (it was
   possible to use the utils on filesystem with erased primary
   superblok without any warning message).

Signed-off-by: Karel Zak <kzak@redhat.com>
10 years agowipefs: add comments to code
Karel Zak [Thu, 16 Jan 2014 15:33:16 +0000 (16:33 +0100)] 
wipefs: add comments to code

10 years agoscript: use all-io.h to make the code more robust
Karel Zak [Thu, 16 Jan 2014 13:44:37 +0000 (14:44 +0100)] 
script: use all-io.h to make the code more robust

Signed-off-by: Karel Zak <kzak@redhat.com>
10 years agoscript: fix inconsistent -q, use poll() rather then O_NONBLOCK
Karel Zak [Thu, 16 Jan 2014 12:18:24 +0000 (13:18 +0100)] 
script: fix inconsistent -q, use poll() rather then O_NONBLOCK

 - don't suppress "Script done" message in typescript file by -q
   (note that -q has no effect to "Script started" message)

 - simplify the code by poll()

Signed-off-by: Karel Zak <kzak@redhat.com>
10 years agoscript: don't wait for empty descriptors if child is dead
Karel Zak [Thu, 16 Jan 2014 11:22:13 +0000 (12:22 +0100)] 
script: don't wait for empty descriptors if child is dead

The current code waits for empty file master and slave descriptors,
but it makes sense only if there is child process that cares (read)
about data in the descriptors.

Signed-off-by: Karel Zak <kzak@redhat.com>
10 years agopartx: use blkid_partlist_get_partition_by_partno()
Karel Zak [Wed, 15 Jan 2014 09:52:47 +0000 (10:52 +0100)] 
partx: use blkid_partlist_get_partition_by_partno()

Signed-off-by: Karel Zak <kzak@redhat.com>
10 years agolibblkid: add blkid_partlist_get_partition_by_partno()
Karel Zak [Wed, 15 Jan 2014 09:52:16 +0000 (10:52 +0100)] 
libblkid: add blkid_partlist_get_partition_by_partno()

Signed-off-by: Karel Zak <kzak@redhat.com>
10 years agolib/sysfs: fix scanf format string [coverity scan]
Karel Zak [Tue, 14 Jan 2014 17:02:06 +0000 (18:02 +0100)] 
lib/sysfs: fix scanf format string [coverity scan]

Signed-off-by: Karel Zak <kzak@redhat.com>
10 years agolibmount: fix scanf format string [coverity scan]
Karel Zak [Tue, 14 Jan 2014 17:00:14 +0000 (18:00 +0100)] 
libmount: fix scanf format string [coverity scan]

Signed-off-by: Karel Zak <kzak@redhat.com>
10 years agorename: fix mem leak [coverity scan]
Karel Zak [Tue, 14 Jan 2014 16:56:47 +0000 (17:56 +0100)] 
rename: fix mem leak [coverity scan]

Signed-off-by: Karel Zak <kzak@redhat.com>
10 years agocolumn: fix mem leak [coverity scan]
Karel Zak [Tue, 14 Jan 2014 16:53:22 +0000 (17:53 +0100)] 
column: fix mem leak [coverity scan]

Signed-off-by: Karel Zak <kzak@redhat.com>
10 years agomore: fix mem leak [coverity scan]
Karel Zak [Tue, 14 Jan 2014 16:49:34 +0000 (17:49 +0100)] 
more: fix mem leak [coverity scan]

... the code is so soo ugly.

Signed-off-by: Karel Zak <kzak@redhat.com>
10 years agopylibmount: import directly from pylibmount in tests
Karel Zak [Tue, 14 Jan 2014 16:34:08 +0000 (17:34 +0100)] 
pylibmount: import directly from pylibmount in tests

This change does not have any impact to in a standard way installed
libmount impact. It's simplification for in-tree tests.

Signed-off-by: Karel Zak <kzak@redhat.com>
10 years agopylibmount: remove unncessary subdirectory
Karel Zak [Tue, 14 Jan 2014 13:57:44 +0000 (14:57 +0100)] 
pylibmount: remove unncessary subdirectory

Signed-off-by: Karel Zak <kzak@redhat.com>
10 years agotests: update lscpu tests
Karel Zak [Tue, 14 Jan 2014 12:58:38 +0000 (13:58 +0100)] 
tests: update lscpu tests

Signed-off-by: Karel Zak <kzak@redhat.com>
10 years agolscpu: sort NUMA nodes to keep output human readable
Karel Zak [Tue, 14 Jan 2014 12:56:27 +0000 (13:56 +0100)] 
lscpu: sort NUMA nodes to keep output human readable

Signed-off-by: Karel Zak <kzak@redhat.com>
10 years agodocs: add lslogins(1) to TODO
Karel Zak [Tue, 14 Jan 2014 09:17:16 +0000 (10:17 +0100)] 
docs: add lslogins(1) to TODO

Signed-off-by: Karel Zak <kzak@redhat.com>
10 years agotests: add partx --update test
Karel Zak [Tue, 14 Jan 2014 08:51:02 +0000 (09:51 +0100)] 
tests: add partx --update test

Signed-off-by: Karel Zak <kzak@redhat.com>
10 years agotests: update partx sgi test
Karel Zak [Tue, 14 Jan 2014 08:41:04 +0000 (09:41 +0100)] 
tests: update partx sgi test

Since commit 4253275490926cf533bfd0bc33279729e9ff427a the libblkid
lists system partitions for SGI label.

Signed-off-by: Karel Zak <kzak@redhat.com>
10 years agopartx: fix --update ranges and out of order tables
Scott Moser [Mon, 13 Jan 2014 20:32:49 +0000 (15:32 -0500)] 
partx: fix --update ranges and out of order tables

partx --update DEVICE NUMBER
was broken in 2 cases:
 * if NUMBER != 1
 * if the partition table was "out of order".
   Ie, where sda2 came after sda3.

References: https://bugs.launchpad.net/ubuntu/+source/cloud-utils/+bug/1244662
Signed-off-by: Scott Moser <smoser@ubuntu.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
10 years agomount: update man page ext3/4 mount options
Carlos Maiolino [Mon, 13 Jan 2014 14:05:49 +0000 (15:05 +0100)] 
mount: update man page ext3/4 mount options

Add missing mount options to ext3 and ext4 filesystems. This also
remove resize option information from the man page.

Signed-off-by: Carlos Maiolino <cmaiolino@redhat.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
10 years agofallocate: prefer FALLOC_FL_* flags from libc headers
Karel Zak [Mon, 13 Jan 2014 13:53:18 +0000 (14:53 +0100)] 
fallocate: prefer FALLOC_FL_* flags from libc headers

Reported-by: Sami Kerola <kerolasa@iki.fi>
Signed-off-by: Karel Zak <kzak@redhat.com>
10 years agolibblkid: (nilfs2) check also backup superblock
Karel Zak [Mon, 13 Jan 2014 13:30:51 +0000 (14:30 +0100)] 
libblkid: (nilfs2) check also backup superblock

* read also backup superblock
* check which superblock is newer
* set minimal device size to 1MiB

Reported-by: Phillip Susi <psusi@ubuntu.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
10 years agodmesg: fix --raw zero timestamp for kmsg
Karel Zak [Tue, 7 Jan 2014 16:41:42 +0000 (17:41 +0100)] 
dmesg: fix --raw zero timestamp for kmsg

Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=1049438
Signed-off-by: Karel Zak <kzak@redhat.com>
10 years agouuidd: use pkg-config to find systemd-deamon support
Sami Kerola [Mon, 6 Jan 2014 23:39:08 +0000 (23:39 +0000)] 
uuidd: use pkg-config to find systemd-deamon support

[kzak@redhat.com: - remove USE_SOCKET_ACTIVATION and use
                    HAVE_* as we use for another libs]

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
Signed-off-by: Karel Zak <kzak@redhat.com>
10 years agounshare: Add possibility to add mapping into root user in user namespace
Lubomir Rintel [Fri, 27 Dec 2013 21:14:48 +0000 (22:14 +0100)] 
unshare: Add possibility to add mapping into root user in user namespace

This makes it very convenient to use make use of privileged actions
on CONFIG_USER_NS enabled kernels, without having to manually tinker
with uid_map and gid_map to obtain required credentials (as those
given upon unshare() vanish with call to execve() and lot of userspace
checks for euid==0 anyway).

Usage example:

$ unshare --uts
unshare: unshare failed: Operation not permitted

$ unshare --user --uts
[nfsnobody@odvarok ~]$ hostname swag
hostname: you must be root to change the host name

$ unshare -r --uts
[root@odvarok util-linux]# hostname swag
[root@odvarok util-linux]#

[kzak@redhat.com: - move code to map_id()
                  - use all-io.h
                  - add paths to pathnames.h]

Signed-off-by: Lubomir Rintel <lkundrak@v3.sk>
Signed-off-by: Karel Zak <kzak@redhat.com>
10 years agocal: in man page improve grammar and wording of the reformation limitation
Benno Schulenberg [Mon, 6 Jan 2014 20:43:44 +0000 (21:43 +0100)] 
cal: in man page improve grammar and wording of the reformation limitation

Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
10 years agolscpu: support discontinuous NUMA nodes
Karel Zak [Mon, 6 Jan 2014 15:48:44 +0000 (16:48 +0100)] 
lscpu: support discontinuous NUMA nodes

lscpu fails to print proper NUMA node values in a system with
discontinuous nodes. This patch adds support by creating a nodeidx
array to map node numbers.

Based on patch from Madhavan Srinivasan <maddy@linux.vnet.ibm.com>.

Reported-by: Madhavan Srinivasan <maddy@linux.vnet.ibm.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
10 years agolib/path: add path_strdup()
Karel Zak [Mon, 6 Jan 2014 15:48:13 +0000 (16:48 +0100)] 
lib/path: add path_strdup()

Signed-off-by: Karel Zak <kzak@redhat.com>
10 years agohexdump: convert a variable type according with fmt
Andrew Vagin [Fri, 27 Dec 2013 13:45:57 +0000 (17:45 +0400)] 
hexdump: convert a variable type according with fmt

hexdump works uncorrectly on Rassberry Pi (raspbian wheezy):
0000000 3200000000 3400000000 3600000000 3800000000 a00000000
000000a

The problem is that the %qx format is used for printing
the (short int) variable.

Here is the output from hexdump with this patch:
0000000 3231 3433 3635 3837 0a39
000000a

Currently raspbian uses hexdump from bsdmainutils.
bsdmainutils: /usr/bin/hexdump

Signed-off-by: Andrew Vagin <avagin@openvz.org>
10 years agohexdump: don't access hex after freeing it
Andrew Vagin [Mon, 6 Jan 2014 12:58:51 +0000 (13:58 +0100)] 
hexdump: don't access hex after freeing it

[kzak@redhat.com: - remove unnecessary code]

Signed-off-by: Andrew Vagin <avagin@openvz.org>
Signed-off-by: Karel Zak <kzak@redhat.com>
10 years agohexdump: use xcalloc()
Karel Zak [Mon, 6 Jan 2014 12:54:48 +0000 (13:54 +0100)] 
hexdump: use xcalloc()

Reported-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Karel Zak <kzak@redhat.com>
10 years agotests: libmount: skip tabfiles-py when pylibmount is disabled
Mike Frysinger [Mon, 23 Dec 2013 00:01:32 +0000 (19:01 -0500)] 
tests: libmount: skip tabfiles-py when pylibmount is disabled

The default configure disables python support, so this test fails by
default.  Add a simple check for module availability.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
10 years agotests: last: skip when last is not enabled
Mike Frysinger [Sun, 22 Dec 2013 23:20:29 +0000 (18:20 -0500)] 
tests: last: skip when last is not enabled

References: https://bugs.gentoo.org/489794
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
10 years agocal: in man page admit that any week has just one Sunday
Benno Schulenberg [Mon, 6 Jan 2014 11:40:13 +0000 (12:40 +0100)] 
cal: in man page admit that any week has just one Sunday

Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
Signed-off-by: Karel Zak <kzak@redhat.com>
10 years agocal: mention where Gregorian reformation happen in September 1752
Sami Kerola [Sun, 22 Dec 2013 18:06:04 +0000 (18:06 +0000)] 
cal: mention where Gregorian reformation happen in September 1752

In September 1752 the Gregorian reformation happen in Great Britain and
Dominions (including what is now the USA).  One could argue the cal(1)
should consider locale when determining the reformation, but such is
nearly impossible implement correctly.

The dates when reformation happen are split by areas that cannot be
expressed with current locales, for example the Netherlands is split to
two and Germany three categories depending on where in the modern country
one is.  Secondly the track when reformation happen is lost for some
countries, Lithuania or Japan are good examples of such.

One of the worst for a programmer is Sweden.  They got gradual calendar
change which made Swedish calendar to be completely out of sync.  Later
the Swedish calendar jumped in 1753 to be in sync with everyone else.

Notice that some countries, including Saudi Arabia, Ethiopia, Nepal, Iran
and Afghanistan, still have not adopted the Gregorian calendar.  Hence
the output of the cal(1) cannot be considered to be correct for everyone.

References: http://calendopedia.com/gregory.htm
References: http://en.wikipedia.org/wiki/Gregorian_calendar#Gregorian_reform
Reviewed-by: Benno Schulenberg <bensberg@justemail.net>
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
10 years agolosetup: remove warning for unsupported -e and -E
Karel Zak [Mon, 6 Jan 2014 08:08:40 +0000 (09:08 +0100)] 
losetup: remove warning for unsupported -e and -E

Signed-off-by: Karel Zak <kzak@redhat.com>
10 years agolosetup, mount: remove --pass-fd at all
Karel Zak [Mon, 6 Jan 2014 08:02:36 +0000 (09:02 +0100)] 
losetup, mount: remove --pass-fd at all

The option is unsupported since v2.23, let's cleanup man pages and
code to remove it at all.

Reported-by: "Dale R. Worley" <worley@alum.mit.edu>
Signed-off-by: Karel Zak <kzak@redhat.com>
10 years agoman: Syntax and spelling fixes.
Ville Skyttä [Wed, 18 Dec 2013 22:13:48 +0000 (00:13 +0200)] 
man: Syntax and spelling fixes.

Signed-off-by: Ville Skyttä <ville.skytta@iki.fi>
10 years agopo: add '--no-wrap' to msgmerge, to not wrap long message lines
Benno Schulenberg [Mon, 16 Dec 2013 21:41:56 +0000 (22:41 +0100)] 
po: add '--no-wrap' to msgmerge, to not wrap long message lines

This avoids unneeded churn during POT-file renewal and PO-file updates,
as the PO files at the TP are made with '--no-wrap'.

Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
Acked-by: Sami Kerola <kerolasa@iki.fi>
10 years agomount: add note about "noauto" to --all description
Karel Zak [Thu, 12 Dec 2013 10:41:07 +0000 (11:41 +0100)] 
mount: add note about "noauto" to --all description

References: https://bugzilla.redhat.com/show_bug.cgi?id=1039905
Signed-off-by: Karel Zak <kzak@redhat.com>
10 years agolibblkid: Identify extN file system properly
Lukas Czerner [Tue, 3 Dec 2013 15:24:44 +0000 (16:24 +0100)] 
libblkid: Identify extN file system properly

Currently when trying to identify extN file system we're playing games
with searching for kernel modules and parsing /proc/filesystem. All of
this just because ext4 module can be used to mount ext3 and ext2 file
systems on recent kernel and also because of ext4dev.

However all of this is not necessary. Ext4 module which does support
mounting ext2 and ext3 file system is able to recognize and mount ext2
and ext3 type so there is no need to disguise it and ext4dev should only
be ever used for testing and not as fallback when other modules are
missing (use -t instead).

This also introduces a bug when in situation that we only have ext4
modules with ext2/ext3 support which is not loaded and we try to mount
ext2 file system we will mount it incorrectly as ext4. This will not
happen if the ext4 module is already loaded.

With this patch we remove all the unnecessary checks and return the real
type of the file system which is on the device. This fixes the issue.
However on the kernel which was not compiled with EXT4_USE_FOR_EXT23
support one would have to provide file system type (-t) to be able to
mount the file system with ext4 driver.

Signed-off-by: Lukas Czerner <lczerner@redhat.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
10 years agotextual: small inprovements to usage and man page of fstrim
Benno Schulenberg [Wed, 11 Dec 2013 11:40:14 +0000 (12:40 +0100)] 
textual: small inprovements to usage and man page of fstrim

Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
10 years agofstrim: de-duplicate list of filesystems
Karel Zak [Wed, 11 Dec 2013 16:01:23 +0000 (17:01 +0100)] 
fstrim: de-duplicate list of filesystems

Reported-by: Pádraig Brady <P@draigBrady.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
10 years agofindmnt: add -U to de-deplicate filesystems
Karel Zak [Wed, 11 Dec 2013 16:01:15 +0000 (17:01 +0100)] 
findmnt: add -U to de-deplicate filesystems

Signed-off-by: Karel Zak <kzak@redhat.com>
10 years agolibmount: add mnt_table_uniq_fs()
Karel Zak [Wed, 11 Dec 2013 15:59:57 +0000 (16:59 +0100)] 
libmount: add mnt_table_uniq_fs()

Signed-off-by: Karel Zak <kzak@redhat.com>
10 years agofindmnt: cleanup usage()
Karel Zak [Wed, 11 Dec 2013 13:47:06 +0000 (14:47 +0100)] 
findmnt: cleanup usage()

Signed-off-by: Karel Zak <kzak@redhat.com>
10 years agofstrim: add --all to discard all filesystem
Karel Zak [Tue, 10 Dec 2013 14:49:49 +0000 (15:49 +0100)] 
fstrim: add --all to discard all filesystem

 * read /proc/self/mountinfo to get filesystems
 * ignore net and pseudo filesystems
 * ignore unaccessible filesystems (over mounted by another FS)
 * read disk sysfs queue/discard_granularity to detect is discard support
 * call FITRIM ioctl
 * silently ignore EOPNOTSUPP (for example LUKS without discard) and ENOTTY
   (for example vfat) errors

Signed-off-by: Karel Zak <kzak@redhat.com>
10 years agolibmount: add efivarfs to the list of pseudo filesystems
Karel Zak [Tue, 10 Dec 2013 13:05:22 +0000 (14:05 +0100)] 
libmount: add efivarfs to the list of pseudo filesystems

Signed-off-by: Karel Zak <kzak@redhat.com>
10 years agofstrim: cleanup usage()
Karel Zak [Tue, 10 Dec 2013 10:36:50 +0000 (11:36 +0100)] 
fstrim: cleanup usage()

Signed-off-by: Karel Zak <kzak@redhat.com>
10 years agotaskset: fix PERMISSIONS section of taskset man page
Rik van Riel [Fri, 6 Dec 2013 21:07:54 +0000 (16:07 -0500)] 
taskset: fix PERMISSIONS section of taskset man page

A user is always allowed to change the CPU affinity of his or her
own processes. CAP_SYS_NICE is only required to change the affinity
of another user's process.

Signed-off-by: Rik van Riel <riel@redhat.com>
Reported-by: Joe Mario <jmario@redhat.com>
10 years agocal: use month contents structure for --year printing
Sami Kerola [Sun, 10 Nov 2013 18:23:40 +0000 (18:23 +0000)] 
cal: use month contents structure for --year printing

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
10 years agocal: use month contents structure for --three printing
Sami Kerola [Sun, 10 Nov 2013 18:23:39 +0000 (18:23 +0000)] 
cal: use month contents structure for --three printing

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
10 years agocal: add month contents structure
Sami Kerola [Sun, 10 Nov 2013 18:23:38 +0000 (18:23 +0000)] 
cal: add month contents structure

This changes determination of calendar month content completely, as well
as outputing.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
10 years agocal: determine how many header lines are needed at initialization
Sami Kerola [Sun, 10 Nov 2013 18:23:37 +0000 (18:23 +0000)] 
cal: determine how many header lines are needed at initialization

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
10 years agotests: cal: do not let --week=<num> to adjust requested month
Sami Kerola [Sun, 10 Nov 2013 18:23:36 +0000 (18:23 +0000)] 
tests: cal: do not let --week=<num> to adjust requested month

The previous commit made --week=<number> to have smaller weight value
than a month supplied by user.  The commit started to print the month
that has more days at the week when a week is split to two months, and
only one month output is requested.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
10 years agocal: make user request to be part of read-only control struct
Sami Kerola [Sun, 10 Nov 2013 18:23:35 +0000 (18:23 +0000)] 
cal: make user request to be part of read-only control struct

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
10 years agotests: cal: take account week numbers when determing month lenght
Sami Kerola [Sun, 10 Nov 2013 18:23:34 +0000 (18:23 +0000)] 
tests: cal: take account week numbers when determing month lenght

The month header does not need to wrap if month width with week number
allows printing to single line.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
10 years agocal: determine output width at beginning of run and reuse result
Sami Kerola [Sun, 10 Nov 2013 18:23:33 +0000 (18:23 +0000)] 
cal: determine output width at beginning of run and reuse result

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
10 years agocal: simplify ascii_weeknum() function
Sami Kerola [Sun, 10 Nov 2013 18:23:32 +0000 (18:23 +0000)] 
cal: simplify ascii_weeknum() function

Either the week is or isn't highlighted, there is no need to over
complicate printing of that.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
10 years agocal: make day_in_week() use same variable names as other functions
Sami Kerola [Sun, 10 Nov 2013 18:23:31 +0000 (18:23 +0000)] 
cal: make day_in_week() use same variable names as other functions

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
10 years agocal: add input variable names to function prototypes
Sami Kerola [Sun, 10 Nov 2013 18:23:30 +0000 (18:23 +0000)] 
cal: add input variable names to function prototypes

While prototypes such as 'function(int, int, char, int);' are legal they
do not help when trying to understand how the function is expected to be
used.  Adding variable names gives at least a hint when looking the
prototypes.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
10 years agocal: rename ascii_wnum() to ascii_weeknum()
Sami Kerola [Sun, 10 Nov 2013 18:23:29 +0000 (18:23 +0000)] 
cal: rename ascii_wnum() to ascii_weeknum()

Week is not long word, so it does not need to be enshorted and made more
difficult to understand.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
10 years agocal: use control structure for run time configuration
Sami Kerola [Sun, 10 Nov 2013 18:23:28 +0000 (18:23 +0000)] 
cal: use control structure for run time configuration

Runtime configuration is set at the time of command line option parsing,
and other initialization.  Later the configuration is read-only.  This
should make code a little bit more understandable.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
10 years agoscript: script input redirection / eof handling
Karel Zak [Tue, 3 Dec 2013 12:32:55 +0000 (13:32 +0100)] 
script: script input redirection / eof handling

  echo "ps uf" | script

does not work because script assume that stdin is terminal and
it does not forward EOF to the pty.

This patch:

  * make non-tty use-case more robust (don't call tty ioclts to
    non-tty file descriptors.

  * send EOF (CTL('D') control char) to the master channel when
    detected eof by read() on stdin

  * wait for empty master and slave file descriptors to be sure that
    we don't miss date for typescript. This is also necessary to be
    sure that slave channel (shell) is completely initialized otherwise
    EOF is ignored.

Reported-by: Phillip Susi <psusi@ubuntu.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
10 years agohexdump: Create struct hexdump containing previously global variables.
Ondrej Oprala [Fri, 8 Nov 2013 16:13:14 +0000 (17:13 +0100)] 
hexdump: Create struct hexdump containing previously global variables.

Signed-off-by: Ondrej Oprala <ooprala@redhat.com>
10 years agohexdump: add __attribute__ ((__noreturn__)) to bad*() functions
Ondrej Oprala [Fri, 8 Nov 2013 16:13:13 +0000 (17:13 +0100)] 
hexdump: add __attribute__ ((__noreturn__)) to bad*() functions

Signed-off-by: Ondrej Oprala <ooprala@redhat.com>
10 years agohexdump: rename struct _fs to struct hexdump_fs and remove its typedef
Ondrej Oprala [Fri, 8 Nov 2013 16:13:12 +0000 (17:13 +0100)] 
hexdump: rename struct _fs to struct hexdump_fs and remove its typedef

Signed-off-by: Ondrej Oprala <ooprala@redhat.com>
10 years agohexdump: rename struct _fu to struct hexdump_fu and remove its typedef
Ondrej Oprala [Fri, 8 Nov 2013 16:13:11 +0000 (17:13 +0100)] 
hexdump: rename struct _fu to struct hexdump_fu and remove its typedef

Signed-off-by: Ondrej Oprala <ooprala@redhat.com>
10 years agohexdump: Rename struct _pr to struct hexdump_pr and remove it's typedef
Ondrej Oprala [Fri, 8 Nov 2013 16:13:10 +0000 (17:13 +0100)] 
hexdump: Rename struct _pr to struct hexdump_pr and remove it's typedef

Signed-off-by: Ondrej Oprala <ooprala@redhat.com>
10 years agohexdump: rename rewrite to rewrite_rules
Ondrej Oprala [Fri, 8 Nov 2013 16:13:09 +0000 (17:13 +0100)] 
hexdump: rename rewrite to rewrite_rules

Signed-off-by: Ondrej Oprala <ooprala@redhat.com>
10 years agohexdump: rename add to add_fmt
Ondrej Oprala [Fri, 8 Nov 2013 16:13:08 +0000 (17:13 +0100)] 
hexdump: rename add to add_fmt

Signed-off-by: Ondrej Oprala <ooprala@redhat.com>
10 years agohexdump: Merge hexsyntax.c into hexdump.c
Ondrej Oprala [Fri, 8 Nov 2013 16:13:07 +0000 (17:13 +0100)] 
hexdump: Merge hexsyntax.c into hexdump.c

Signed-off-by: Ondrej Oprala <ooprala@redhat.com>
10 years agohexdump: add the prefix 'hexdump-' to {conv,display,parse}.c
Ondrej Oprala [Fri, 8 Nov 2013 16:13:06 +0000 (17:13 +0100)] 
hexdump: add the prefix 'hexdump-' to {conv,display,parse}.c

Signed-off-by: Ondrej Oprala <ooprala@redhat.com>
10 years agoscript: check that stdin is a terminal
Karel Zak [Mon, 2 Dec 2013 12:42:01 +0000 (13:42 +0100)] 
script: check that stdin is a terminal

Signed-off-by: Karel Zak <kzak@redhat.com>
10 years agosetterm: fix -dump man page info
Karel Zak [Mon, 2 Dec 2013 11:21:47 +0000 (12:21 +0100)] 
setterm: fix -dump man page info

It seems that setterm -dump does not dump terminal attributes, but
the man page says -dump includes the attributes. Let's fix the man
page.

Reported-by: Phillip Susi <psusi@ubuntu.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
10 years agoagetty: support the special terminal on first serial line on a S/390
Werner Fink [Fri, 29 Nov 2013 15:44:25 +0000 (16:44 +0100)] 
agetty: support the special terminal on first serial line on a S/390

which is due legacy reasons a block terminal of type 3270 or higher.
Whereas the second serial line on a S/390(x) is a real character
terminal which is compatible with VT220.

Signed-off-by: Werner Fink <werner@suse.de>
10 years agomount man page cleanups
Phillip Susi [Mon, 25 Nov 2013 15:35:40 +0000 (10:35 -0500)] 
mount man page cleanups

Fowarding this patch submitted by Bjarni Ingi Gislason
<bjarniig@rhi.hi.is> to deb bug #674595.

10 years agomount.8: fix grammar
Phillip Susi [Mon, 25 Nov 2013 15:23:26 +0000 (10:23 -0500)] 
mount.8: fix grammar

Switch "A unbindable" to "An unbindable"

Reported-by: Regid Ichira <regid23@nt1.in>
Signed-off-by: Phillip Susi <psusi@ubuntu.com>
10 years agopylibmount: correctly import from pylibmount.so
Dave Reisner [Thu, 21 Nov 2013 17:25:27 +0000 (12:25 -0500)] 
pylibmount: correctly import from pylibmount.so

Without this, python is unable to find the module:

$ python -c 'import libmount'
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/usr/lib/python3.3/site-packages/libmount/__init__.py", line 1, in <module>
    from pylibmount import *
ImportError: No module named 'pylibmount'

Signed-off-by: Dave Reisner <dreisner@archlinux.org>
10 years agonamei: align missing files with rest of the print out
Sami Kerola [Wed, 20 Nov 2013 00:57:04 +0000 (00:57 +0000)] 
namei: align missing files with rest of the print out

This change should make namei output more readable when multiple
arguments are supplied.

The old:

$ namei -l /usr/foo
f: /usr/foo
drwxr-xr-x root root /
drwxr-xr-x root root usr
foo - No such file or directory

The new:

$ namei -l /usr/foo
f: /usr/foo
drwxr-xr-x root root /
drwxr-xr-x root root usr
                     foo - No such file or directory

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
10 years agolosetup, agetty: remove unnecessary if's before free()
Sami Kerola [Wed, 20 Nov 2013 00:57:03 +0000 (00:57 +0000)] 
losetup, agetty: remove unnecessary if's before free()

Reference: http://git.savannah.gnu.org/cgit/gnulib.git/tree/build-aux/useless-if-before-free
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
10 years agolibfdisk: (dos) warn on type 0
Karel Zak [Wed, 27 Nov 2013 21:04:10 +0000 (22:04 +0100)] 
libfdisk: (dos) warn on type 0

This is old warning, but somehow lost during rewrite to libfdisk. Sorry.

Signed-off-by: Karel Zak <kzak@redhat.com>
10 years agolibfdisk: (dos) fix free part counter
Karel Zak [Wed, 27 Nov 2013 20:42:18 +0000 (21:42 +0100)] 
libfdisk: (dos) fix free part counter

Signed-off-by: Karel Zak <kzak@redhat.com>
10 years agolibblkid: fix sgi PT parser to report system partitions
Karel Zak [Wed, 27 Nov 2013 15:55:08 +0000 (16:55 +0100)] 
libblkid: fix sgi PT parser to report system partitions

... to be compatible with Linux kernel.

Signed-off-by: Karel Zak <kzak@redhat.com>
10 years agofdisk: (gpt) more human readable info about free space
Karel Zak [Mon, 25 Nov 2013 12:18:02 +0000 (13:18 +0100)] 
fdisk: (gpt) more human readable info about free space

Signed-off-by: Karel Zak <kzak@redhat.com>
10 years agofdisk: don't care about partition type
Karel Zak [Mon, 25 Nov 2013 11:00:55 +0000 (12:00 +0100)] 
fdisk: don't care about partition type

fdisk allows to overwrite existing partition if the partition has
partition type set to zero (very unusual, but possible).

This is incorrect because such partition is pretty valid (and Linux
kernel does not care about the type at all). For example:

   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1            2048       22527       10240   83  Linux
/dev/sdb2           22528      227327      102400    0  Empty
                    ^^^^^                            ^^^^^^^^

Command (m for help): n
Partition type:
   p   primary (1 primary, 0 extended, 3 free)
   e   extended
Select (default p):
Using default response p
Partition number (3,4, default 3):
First sector (22528-1228799, default 22528):
                                    ^^^^^^^

.. if user follows the default then the result are overlapping
partitions:

   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1            2048       22527       10240   83  Linux
/dev/sdb2           22528      227327      102400    0  Empty
/dev/sdb3           22528     1228799      603136   83  Linux
                    ^^^^^

... and if you call "mkfs /dev/sdb3" then you lost data on sdb2. Sad
thing.

Reported-by: Marc MERLIN <marc@merlins.org>
Signed-off-by: Karel Zak <kzak@redhat.com>
10 years agofdisk: fix nasty coding style
Karel Zak [Mon, 25 Nov 2013 09:58:18 +0000 (10:58 +0100)] 
fdisk: fix nasty coding style

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