Commit Graph

7319 Commits

Author SHA1 Message Date
Karel Zak 5f77ce6f32 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>
2014-01-13 14:32:06 +01:00
Karel Zak 1a38ad5c32 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>
2014-01-07 17:41:42 +01:00
Sami Kerola ea45d34c7c 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>
2014-01-07 12:17:37 +01:00
Lubomir Rintel 4da21e374e 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>
2014-01-07 11:04:42 +01:00
Benno Schulenberg cad44d02bd cal: in man page improve grammar and wording of the reformation limitation
Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
2014-01-07 09:44:01 +01:00
Karel Zak e9074a167c 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>
2014-01-06 16:48:44 +01:00
Karel Zak dd3bc51a53 lib/path: add path_strdup()
Signed-off-by: Karel Zak <kzak@redhat.com>
2014-01-06 16:48:13 +01:00
Andrew Vagin 5500c81742 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>
2014-01-06 14:02:21 +01:00
Andrew Vagin 917c3733f8 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>
2014-01-06 14:01:04 +01:00
Karel Zak 2152af7289 hexdump: use xcalloc()
Reported-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Karel Zak <kzak@redhat.com>
2014-01-06 13:54:48 +01:00
Mike Frysinger 1987fdf5dc 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>
2014-01-06 12:45:20 +01:00
Mike Frysinger afe8061952 tests: last: skip when last is not enabled
References: https://bugs.gentoo.org/489794
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2014-01-06 12:45:16 +01:00
Benno Schulenberg 2d4f3bfb7f 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>
2014-01-06 12:42:05 +01:00
Sami Kerola bc36e66a84 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>
2014-01-06 12:41:51 +01:00
Karel Zak 5f68593d7a losetup: remove warning for unsupported -e and -E
Signed-off-by: Karel Zak <kzak@redhat.com>
2014-01-06 09:08:40 +01:00
Karel Zak 961d69f799 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>
2014-01-06 09:02:36 +01:00
Ville Skyttä d640dd9421 man: Syntax and spelling fixes.
Signed-off-by: Ville Skyttä <ville.skytta@iki.fi>
2014-01-06 08:55:09 +01:00
Benno Schulenberg e3e16717ec 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>
2014-01-06 08:33:12 +01:00
Karel Zak 31e93a55be 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>
2013-12-12 11:41:07 +01:00
Lukas Czerner a1ca32fb38 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>
2013-12-12 11:14:26 +01:00
Benno Schulenberg d6bbe8044b textual: small inprovements to usage and man page of fstrim
Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
2013-12-12 11:10:53 +01:00
Karel Zak e05a3400e7 fstrim: de-duplicate list of filesystems
Reported-by: Pádraig Brady <P@draigBrady.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
2013-12-11 17:01:23 +01:00
Karel Zak bebdda3036 findmnt: add -U to de-deplicate filesystems
Signed-off-by: Karel Zak <kzak@redhat.com>
2013-12-11 17:01:15 +01:00
Karel Zak 51fffa7be0 libmount: add mnt_table_uniq_fs()
Signed-off-by: Karel Zak <kzak@redhat.com>
2013-12-11 16:59:57 +01:00
Karel Zak b95c6e88b5 findmnt: cleanup usage()
Signed-off-by: Karel Zak <kzak@redhat.com>
2013-12-11 14:47:06 +01:00
Karel Zak 36c370cbf1 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>
2013-12-10 16:40:31 +01:00
Karel Zak 84ceaf7a19 libmount: add efivarfs to the list of pseudo filesystems
Signed-off-by: Karel Zak <kzak@redhat.com>
2013-12-10 14:05:22 +01:00
Karel Zak a60fa93cb7 fstrim: cleanup usage()
Signed-off-by: Karel Zak <kzak@redhat.com>
2013-12-10 11:36:50 +01:00
Rik van Riel ab0e0fa7a4 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>
2013-12-10 11:33:54 +01:00
Sami Kerola 95f4adde86 cal: use month contents structure for --year printing
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2013-12-06 10:58:55 +01:00
Sami Kerola f60117b53e cal: use month contents structure for --three printing
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2013-12-06 10:58:54 +01:00
Sami Kerola 852c8d2110 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>
2013-12-06 10:58:54 +01:00
Sami Kerola efce94ec1c cal: determine how many header lines are needed at initialization
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2013-12-06 10:58:54 +01:00
Sami Kerola 4d2f0d08f6 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>
2013-12-06 10:58:54 +01:00
Sami Kerola ffc5635798 cal: make user request to be part of read-only control struct
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2013-12-06 10:58:54 +01:00
Sami Kerola dc37cc2912 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>
2013-12-06 10:58:54 +01:00
Sami Kerola 71ff238e49 cal: determine output width at beginning of run and reuse result
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2013-12-06 10:58:54 +01:00
Sami Kerola 44df9bd4bf 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>
2013-12-06 10:58:54 +01:00
Sami Kerola ff90b006eb cal: make day_in_week() use same variable names as other functions
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2013-12-06 10:58:54 +01:00
Sami Kerola 0106c9e26c 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>
2013-12-06 10:58:54 +01:00
Sami Kerola 76c4bbcc6e 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>
2013-12-06 10:58:52 +01:00
Sami Kerola b549058bd5 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>
2013-12-06 10:58:52 +01:00
Karel Zak 3822032da3 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>
2013-12-03 13:32:55 +01:00
Ondrej Oprala 1f77e9c3ad hexdump: Create struct hexdump containing previously global variables.
Signed-off-by: Ondrej Oprala <ooprala@redhat.com>
2013-12-02 13:44:24 +01:00
Ondrej Oprala 1be6ed6ade hexdump: add __attribute__ ((__noreturn__)) to bad*() functions
Signed-off-by: Ondrej Oprala <ooprala@redhat.com>
2013-12-02 13:44:24 +01:00
Ondrej Oprala bb8ae572ef hexdump: rename struct _fs to struct hexdump_fs and remove its typedef
Signed-off-by: Ondrej Oprala <ooprala@redhat.com>
2013-12-02 13:44:23 +01:00
Ondrej Oprala 046921da22 hexdump: rename struct _fu to struct hexdump_fu and remove its typedef
Signed-off-by: Ondrej Oprala <ooprala@redhat.com>
2013-12-02 13:44:22 +01:00
Ondrej Oprala 4c73d29c06 hexdump: Rename struct _pr to struct hexdump_pr and remove it's typedef
Signed-off-by: Ondrej Oprala <ooprala@redhat.com>
2013-12-02 13:44:21 +01:00
Ondrej Oprala 9f399910f2 hexdump: rename rewrite to rewrite_rules
Signed-off-by: Ondrej Oprala <ooprala@redhat.com>
2013-12-02 13:44:21 +01:00
Ondrej Oprala 9fa53cebe4 hexdump: rename add to add_fmt
Signed-off-by: Ondrej Oprala <ooprala@redhat.com>
2013-12-02 13:44:20 +01:00