]> git.ipfire.org Git - thirdparty/util-linux.git/log
thirdparty/util-linux.git
9 years agosulogin: avoid shared memory area usemask but use waitid() for childs
Werner Fink [Thu, 11 Feb 2016 12:35:26 +0000 (13:35 +0100)] 
sulogin: avoid shared memory area usemask but use waitid() for childs

This small patch improves the console detection code and also avoids not
existing device nodes due strdup() which is used in canonicalize_path().
Beside this now the code for emergeny mount does work if enabled at
configure time.

Signed-off-by: Werner Fink <werner@suse.de>
9 years agotests: add test for loop option in fstab
Stanislav Brabec [Thu, 11 Feb 2016 19:45:56 +0000 (20:45 +0100)] 
tests: add test for loop option in fstab

Add a new fstab tests which check loop mount of the same source multiple times
in multiple steps.

The test is currently failing, but it should not fail once the triggering bug
will be fixed.

Signed-off-by: Stanislav Brabec <sbrabec@suse.cz>
9 years agolibmount: fix mnt_table_is_fs_mounted() for loopdev
Karel Zak [Fri, 12 Feb 2016 10:03:32 +0000 (11:03 +0100)] 
libmount: fix mnt_table_is_fs_mounted() for loopdev

Reported-by: Stanislav Brabec <sbrabec@suse.cz>
Signed-off-by: Karel Zak <kzak@redhat.com>
9 years agotests: fix redirection
Stanislav Brabec [Thu, 11 Feb 2016 19:40:29 +0000 (20:40 +0100)] 
tests: fix redirection

Many tests do.
2>&1 >> $TS_OUTPUT
It redirects stdout to $TS_OUTPUT and stderr to stdout.

It could cause unintended ignoring of errors on strerr and false positive result
of the test.

Use
>> $TS_OUTPUT 2>&1
instead to redirect both stdout and stderr to $TS_OUTPUT.

Automatically created by:
cd tests/ts
sed -i 's:2>\&1 >> \$TS_OUTPUT:>> $TS_OUTPUT 2>\&1:g' $(fgrep -rl '2>&1 >> $TS_OUTPUT' .)

Signed-off-by: Stanislav Brabec <sbrabec@suse.cz>
9 years agotests: add btrfs mount tests
Stanislav Brabec [Thu, 11 Feb 2016 18:07:22 +0000 (19:07 +0100)] 
tests: add btrfs mount tests

btrfs needs a special support in mount. Add a testcase for btrfs specific
problems.

Coverage:
352740e8: bind mounts pointing to btrfs
2cd28fc8: mounting default subvolume
d2f82678: use of "auto"
618a8814: use of "subvolid"

Signed-off-by: Stanislav Brabec <sbrabec@suse.cz>
9 years agoagetty: add support for \e in issue file to print \033
Karel Zak [Thu, 11 Feb 2016 11:33:57 +0000 (12:33 +0100)] 
agetty: add support for \e in issue file to print \033

Suggested-by: Victor Ananjevsky <ananasik@gmail.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
9 years agocolcrt: minor cosmetic changes
Karel Zak [Thu, 11 Feb 2016 11:21:14 +0000 (12:21 +0100)] 
colcrt: minor cosmetic changes

Signed-off-by: Karel Zak <kzak@redhat.com>
9 years agoswapon: drop perms if setuid before call mkswap
Karel Zak [Thu, 11 Feb 2016 11:07:34 +0000 (12:07 +0100)] 
swapon: drop perms if setuid before call mkswap

Signed-off-by: Karel Zak <kzak@redhat.com>
9 years agoMerge branch 'colcrt' of git://github.com/kerolasa/lelux-utiliteetit
Karel Zak [Thu, 11 Feb 2016 10:59:58 +0000 (11:59 +0100)] 
Merge branch 'colcrt' of git://github.com/kerolasa/lelux-utiliteetit

* 'colcrt' of git://github.com/kerolasa/lelux-utiliteetit:
  tests: update colcrt test expectations
  colcrt: reimplementation
  tests: add colcrt functional tests

9 years agoswapon: simplify ctl->device usage
Karel Zak [Thu, 11 Feb 2016 10:39:16 +0000 (11:39 +0100)] 
swapon: simplify ctl->device usage

* use and initialize ctl->{label,uuid,device} by do_swapon() only
* remove ctl->canonic, function arguments are good enough for this

Signed-off-by: Karel Zak <kzak@redhat.com>
9 years agoswapon: do not run execvp() calls when swapon is setuid binary
Sami Kerola [Tue, 2 Feb 2016 13:40:10 +0000 (13:40 +0000)] 
swapon: do not run execvp() calls when swapon is setuid binary

swapon(8) is not expected to be setuid binary, but if it is try to avoid
obvious security vulnerability of executing user preferred mkswap file as
someone else, such as root.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
9 years agoswapon: move function arguments to control structure
Sami Kerola [Tue, 2 Feb 2016 13:40:09 +0000 (13:40 +0000)] 
swapon: move function arguments to control structure

This makes reading what the code does easier.  This change also makes error
messages to prefer none-canonical device path, e.g., the one user supplied
rather than the canonical path needed internally.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
9 years agoswapon: add control struct
Sami Kerola [Tue, 2 Feb 2016 13:40:08 +0000 (13:40 +0000)] 
swapon: add control struct

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
9 years agobuild-sys: remove AM_CONDITIONAL from UL_CHECK_SYSCALL
Karel Zak [Wed, 10 Feb 2016 15:59:41 +0000 (16:59 +0100)] 
build-sys: remove AM_CONDITIONAL from UL_CHECK_SYSCALL

Unused, unnecessary, wrong.

Reported-by: J William Piggott <elseifthen@gmx.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
9 years agolibsmartcols: rewrite ./sample-scols-wrap
Karel Zak [Wed, 10 Feb 2016 14:37:30 +0000 (15:37 +0100)] 
libsmartcols: rewrite ./sample-scols-wrap

Signed-off-by: Karel Zak <kzak@redhat.com>
9 years agolibsmartcols: support multi-line cells
Karel Zak [Wed, 10 Feb 2016 14:25:38 +0000 (15:25 +0100)] 
libsmartcols: support multi-line cells

The initial implementation has been introduced by SCOLS_FL_WRAP columns,
but this patch clean ups all and makes things more elegant.

Note that use SCOLS_FL_TREE | SCOLS_FL_WRAP for a column is bad idea
and I don't think we need to fix it.

References: https://github.com/karelzak/util-linux/issues/269
Signed-off-by: Karel Zak <kzak@redhat.com>
9 years agolibsmartcols: use libscols_cell for title
Karel Zak [Tue, 9 Feb 2016 10:21:21 +0000 (11:21 +0100)] 
libsmartcols: use libscols_cell for title

References: https://github.com/karelzak/util-linux/issues/270
Signed-off-by: Karel Zak <kzak@redhat.com>
9 years agolibfdisk: add missing break
Karel Zak [Tue, 9 Feb 2016 09:04:36 +0000 (10:04 +0100)] 
libfdisk: add missing break

Signed-off-by: Karel Zak <kzak@redhat.com>
9 years agoMerge branch 'pylibmount_dependency' of https://github.com/filbranden/util-linux
Karel Zak [Tue, 9 Feb 2016 08:57:48 +0000 (09:57 +0100)] 
Merge branch 'pylibmount_dependency' of https://github.com/filbranden/util-linux

9 years agosfdisk: add ESP shortcut also for Legacy MBR
Karel Zak [Mon, 8 Feb 2016 15:34:14 +0000 (16:34 +0100)] 
sfdisk: add ESP shortcut also for Legacy MBR

References: https://github.com/karelzak/util-linux/issues/267
Signed-off-by: Karel Zak <kzak@redhat.com>
9 years agobuild-sys: Properly order install dependencies of pylibmount
Filipe Brandenburger [Fri, 5 Feb 2016 18:13:40 +0000 (10:13 -0800)] 
build-sys: Properly order install dependencies of pylibmount

Introduce a dependency so that libmount.so is installed before
pylibmount.so, so that when libtool tries to relink it, it can find
libmount.so in the destdir.

We introduce this additional make rule through an AC_SUBST variable, to
prevent automake from trying to interpret that.  This trick has been
suggested in http://stackoverflow.com/a/8643550.

This fixes a failure of `make install DESTDIR=...` when trying to relink
pylibmount against libmount.la.  libtool will look for libmount.so under
${DESTDIR}/${libdir} in that case, but if it is not yet present there,
libtool assumes it is a system installed library and use -lmount
instead, which causes the following failure if libmount is not installed
on the base system yet:

  libtool: install: warning: relinking `pylibmount.la'
  libtool: install: (... libtool --mode=relink gcc -o pylibmount.la \
        -rpath /usr/lib/python2.7/dist-packages/libmount \
        libmount/python/*.lo libmount.la ... -lpython2.7 \
        -inst-prefix-dir /path/to/destdir)
  /usr/bin/ld: cannot find -lmount
  collect2: error: ld returned 1 exit status
  libtool: install: error: relink `pylibmount.la' ...
  make[3]: *** [install-pylibmountexecLTLIBRARIES] Error 1

This seems to be a previously encountered issue, since automake includes
a hack to insert such a dependency rule to install all libLTLIBRARIES
before attempting to install binPROGRAMS, initially introduced in the
commit below:
http://git.savannah.gnu.org/cgit/automake.git/commit/?id=bd4a1d5ad1a72fa780a8b7fd6c365a5dad2e6220

Also related bug from Ubuntu tracker:
https://bugs.launchpad.net/ubuntu/+source/util-linux/+bug/1442076

Tested that `make install` starts working again after this commit, even
when libmount-dev is not installed on the system.  Also confirmed that
`make distcheck` is now functional.

Confirmed that the all the files expected in the Python directory (both
__init__.py and pylibmount.so) are present after an install.

Tested that parallel install works, the dependency is always respected
since it's explicit.

Inspected the generated Makefile and confirmed that the definition of
install-pylibmountexecLTLIBRARIES (generated by automake) and the
explicit dependency we introduced are both present.

Signed-off-by: Filipe Brandenburger <filbranden@google.com>
9 years agoRevert "build-sys: Order pylibmount after usrlib on install"
Filipe Brandenburger [Fri, 5 Feb 2016 18:08:50 +0000 (10:08 -0800)] 
Revert "build-sys: Order pylibmount after usrlib on install"

This reverts commit e61f406913fb9356aed013da7ece34e73929cff6.

9 years agoMerge branch 'master' of https://github.com/rudimeier/util-linux
Karel Zak [Thu, 4 Feb 2016 15:02:17 +0000 (16:02 +0100)] 
Merge branch 'master' of https://github.com/rudimeier/util-linux

* 'master' of https://github.com/rudimeier/util-linux:
  script: fix misspelling
  docs: fix typos found by codespell

9 years agoscript: fix misspelling
Ruediger Meier [Wed, 3 Feb 2016 15:34:12 +0000 (16:34 +0100)] 
script: fix misspelling

9 years agodocs: fix typos found by codespell
Ruediger Meier [Wed, 3 Feb 2016 14:00:37 +0000 (15:00 +0100)] 
docs: fix typos found by codespell

Using "codespell" from https://github.com/lucasdemarchi/codespell

Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
9 years agofdisk: make 'f' command more verbose
Karel Zak [Wed, 3 Feb 2016 12:40:25 +0000 (13:40 +0100)] 
fdisk: make 'f' command more verbose

Signed-off-by: Karel Zak <kzak@redhat.com>
9 years agotests: update colcrt test expectations
Sami Kerola [Sat, 3 Oct 2015 22:39:33 +0000 (23:39 +0100)] 
tests: update colcrt test expectations

The reimplementation caused output to change in some corner cases, such as
how binary inputs, long lines with underscores, and white space trimming,
are handled.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
9 years agocolcrt: reimplementation
Sami Kerola [Wed, 23 Sep 2015 08:42:58 +0000 (09:42 +0100)] 
colcrt: reimplementation

This implementation aims to be easier to read, more robust dealing all sorts
of unexpected inputs, and possibly even more correct.  The correctness
refers to last line handling this implementation does differently than the
previous.  With the previous last line that ended to EOF without \n was not
printed.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
9 years agotests: add colcrt functional tests
Sami Kerola [Tue, 22 Sep 2015 09:40:13 +0000 (10:40 +0100)] 
tests: add colcrt functional tests

Output formats are based on colcrt before recent asan fixes and magic
constant replace, that are the commits ee24ab6f1..70e3fcf29.  It seems the
fixes caused unintentional, and not detected change to output format - which
to me means colcrt has a regression that got to be part of release v2.27.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
9 years agosfdisk: make --quiet really quiet
Karel Zak [Mon, 1 Feb 2016 13:30:31 +0000 (14:30 +0100)] 
sfdisk: make --quiet really quiet

References: https://github.com/karelzak/util-linux/issues/268
Signed-off-by: Karel Zak <kzak@redhat.com>
9 years agosfdisk: add 'U' shortcut for ESP
Karel Zak [Mon, 1 Feb 2016 13:08:04 +0000 (14:08 +0100)] 
sfdisk: add 'U' shortcut for ESP

 echo -e ',512M,U\n,,L' | sfdisk --label gpt /dev/foo

to make ESP system partition.

References: https://github.com/karelzak/util-linux/issues/267
Signed-off-by: Karel Zak <kzak@redhat.com>
9 years agohwclock: remove extra space from --show output
Karel Zak [Mon, 1 Feb 2016 12:43:22 +0000 (13:43 +0100)] 
hwclock: remove extra space from --show output

Signed-off-by: Karel Zak <kzak@redhat.com>
9 years agoMerge branch 'master' of https://github.com/annajonna/util-linux
Karel Zak [Mon, 1 Feb 2016 12:39:48 +0000 (13:39 +0100)] 
Merge branch 'master' of https://github.com/annajonna/util-linux

9 years agolibmount: move btrfs subvol code refactoring
Karel Zak [Mon, 1 Feb 2016 12:10:33 +0000 (13:10 +0100)] 
libmount: move btrfs subvol code refactoring

Signed-off-by: Karel Zak <kzak@redhat.com>
9 years agolibmount: fix target resolving for btrfs stuff
Karel Zak [Mon, 1 Feb 2016 11:36:07 +0000 (12:36 +0100)] 
libmount: fix target resolving for btrfs stuff

and make the code more verbose.

Signed-off-by: Karel Zak <kzak@redhat.com>
9 years agolibmount: code re-indentation
Stanislav Brabec [Wed, 27 Jan 2016 20:37:29 +0000 (21:37 +0100)] 
libmount: code re-indentation

For easier review, the fix of libmount comes in two patches:
PATCH 1/2: libmount: run btrfs subvol checks for "subvolid" option
PATCH 2/2: code re-indentation

No code change is present in this patch.

Signed-off-by: Stanislav Brabec <sbrabec@suse.cz>
9 years agolibmount: run btrfs subvol checks for "subvolid" option
Stanislav Brabec [Wed, 27 Jan 2016 20:37:00 +0000 (21:37 +0100)] 
libmount: run btrfs subvol checks for "subvolid" option

It is possible to identify btrfs subvolume with "subvolid" instead of "subvol".
In such case, btrfs specific check mistakenly assumes that the default subvolume
is going to be mounted, even if subvolid specifies id of non-default subvolume.

Implement a code for "subvolid" option.

For easier review, this fix comes in two patches:
PATCH 1/2: libmount: run btrfs subvol checks for "subvolid" option
PATCH 2/2: code re-indentation

How to reproduce:
truncate -s1G btrfs_test.img
mkdir -p btrfs_mnt
/sbin/mkfs.btrfs -f -d single -m single ./btrfs_test.img
mount -o loop btrfs_test.img btrfs_mnt
pushd .
cd btrfs_mnt
mkdir -p d0/dd0/ddd0
cd d0/dd0/ddd0
touch file{1..5}
btrfs subvol create s1
cd s1
touch file{1..5}
mkdir -p d1/dd1/ddd1
cd d1/dd1/ddd1
btrfs subvol create s2
rid=$(btrfs inspect rootid s2)
echo new default $rid
btrfs subvol get-default .
btrfs subvol set-default $rid .
popd
DEFAULT_SUBVOLID=`btrfs subvolume get-default btrfs_mnt | while read dummy id rest ; do echo $id ; done`
NON_DEFAULT_SUBVOLID=`btrfs subvolume list btrfs_mnt | while read dummy id rest ; do if test $id = $DEFAULT_SUBVOLID ; then continue ; fi ; echo $id ; done`
umount btrfs_mnt
losetup /dev/loop0 $PWD/btrfs_test.img
echo "/dev/loop0 $PWD/btrfs_mnt btrfs subvolid=$NON_DEFAULT_SUBVOLID 0 0" >>/etc/fstab
./mount -a
./mount -a
umount btrfs_mnt
sed -i "/\/dev\/loop0/d" /etc/fstab
losetup -d /dev/loop0
rm btrfs_test.img
rmdir btrfs_mnt

Current behavior of second "mount -a":
    mount: /dev/loop0 is already mounted or /root/btrfs_mnt busy
           /dev/loop0 is already mounted on /root/btrfs_mnt

Signed-off-by: Stanislav Brabec <sbrabec@suse.cz>
9 years agolibmount: run btrfs subvol checks for "auto" fs type
Stanislav Brabec [Tue, 26 Jan 2016 20:59:55 +0000 (21:59 +0100)] 
libmount: run btrfs subvol checks for "auto" fs type

It is possible to mount btrfs using "auto" keyword in fstab. In such
case, btrfs specific checks are skipped. Run them for "auto" as well.

Looking at the code, it is a safe approach. In case of btrfs, it will do
what is needed, in case of no btrfs, btrfs_get_default_subvol_id() will
fail, and the rest of the code is skipped.

How to reproduce:
See reproducer in 2cd28fc and replace fstab line by
echo "/dev/loop0 $PWD/btrfs_mnt btrfs auto 0 0" >>/etc/fstab

Current behavior of second "mount -a":
mount: /dev/loop0 is already mounted or /root/btrfs_mnt busy
       /dev/loop0 is already mounted on /root/btrfs_mnt

Testcases for btrfs and ext4:
truncate -s1G btrfs_test.img
truncate -s1G ext4_test.img
mkdir -p btrfs_mnt
mkdir -p ext4_mnt
/sbin/mkfs.btrfs -f -d single -m single ./btrfs_test.img
/sbin/mkfs.ext4 ./ext4_test.img
losetup /dev/loop0 $PWD/btrfs_test.img
losetup /dev/loop1 $PWD/ext4_test.img
echo "/dev/loop0 $PWD/btrfs_mnt auto defaults 0 0" >>/etc/fstab
echo "/dev/loop1 $PWD/ext4_mnt auto defaults 0 0" >>/etc/fstab
./mount -a
./mount -a
umount btrfs_mnt
umount ext4_mnt
sed -i "/\/dev\/loop[01]/d" /etc/fstab
losetup -d /dev/loop0
losetup -d /dev/loop1
rm btrfs_test.img
rm ext4_test.img
rmdir btrfs_mnt
rmdir ext4_mnt

Signed-off-by: Stanislav Brabec <sbrabec@suse.cz>
9 years agolibmount: add 'force-mountinfo' to features list, improve debug
Karel Zak [Mon, 1 Feb 2016 10:01:44 +0000 (11:01 +0100)] 
libmount: add 'force-mountinfo' to features list, improve debug

Signed-off-by: Karel Zak <kzak@redhat.com>
9 years agoChange of output format and documentation.
Anna Jonna Ármannsdóttir [Thu, 28 Jan 2016 19:03:20 +0000 (19:03 +0000)] 
Change of output format and documentation.

9 years agoMerge branch 'fix_pylibmount_install' of https://github.com/filbranden/util-linux
Karel Zak [Wed, 27 Jan 2016 12:00:13 +0000 (13:00 +0100)] 
Merge branch 'fix_pylibmount_install' of https://github.com/filbranden/util-linux

* 'fix_pylibmount_install' of https://github.com/filbranden/util-linux:
  build-sys: Order pylibmount after usrlib on install

9 years agoMerge branch 'fix-static-configuration-and-building' of https://github.com/ladatrimas...
Karel Zak [Wed, 27 Jan 2016 11:52:02 +0000 (12:52 +0100)] 
Merge branch 'fix-static-configuration-and-building' of https://github.com/ladatrimasova/util-linux

* 'fix-static-configuration-and-building' of https://github.com/ladatrimasova/util-linux:
  buildsys: fix static configuration and building

9 years agobuild-sys: Order pylibmount after usrlib on install
Filipe Brandenburger [Thu, 31 Dec 2015 06:36:15 +0000 (22:36 -0800)] 
build-sys: Order pylibmount after usrlib on install

This fixes a failure of `make install DESTDIR=...` when trying to relink
pylibmount against libmount.la.

libtool will look for libmount.so under ${DESTDIR}/${libdir}, but if it
is not yet present, it will assume it is a system installed library and
use -lmount instead.

This makes the install order significant.

Automake lists the install entries in alphabetical order, and as
install-pylibmountexecLTLIBRARIES < install-usrlib_execLTLIBRARIES,
make will try to install pylibmount.so before libmount.so is present
in the DESTDIR, which will then cause libtool to fallback to -lmount
when relinking. This causes the error below:

  libtool: install: warning: relinking `pylibmount.la'
  libtool: install: (... libtool --mode=relink gcc -o pylibmount.la \
        -rpath /usr/lib/python2.7/dist-packages/libmount \
        libmount/python/*.lo libmount.la ... -lpython2.7 \
        -inst-prefix-dir /path/to/destdir)
  /usr/bin/ld: cannot find -lmount
  collect2: error: ld returned 1 exit status
  libtool: install: error: relink `pylibmount.la' ...
  make[3]: *** [install-pylibmountexecLTLIBRARIES] Error 1

Work around this issue by using a zz_ prefix for the pylibmount exec
dir, in order to install it last.

This does not work if parallel make is used for the install step, but
that should be a minor issue (parallel install is probably not that
useful for util-linux, which is not that large a package to actually
benefit from it.) The proper fix should be to introduce a make
dependency of target install-pylibmountexecLTLIBRARIES on target
install-usrlib_execLTLIBRARIES, but unfortunately there is no good way
to accomplish that in automake without overriding it completely.

This issue seems to be previously encountered in automake context, since
automake includes a hack to insert such a dependency rule to install all
libLTLIBRARIES before attempting to install binPROGRAMS, initially
introduced in the commit below:
http://git.savannah.gnu.org/cgit/automake.git/commit/?id=bd4a1d5ad1a72fa780a8b7fd6c365a5dad2e6220

Also, a related bug from Ubuntu tracker:
https://bugs.launchpad.net/ubuntu/+source/util-linux/+bug/1442076

Tested that `make install` starts working again after this commit, even
when libmount-dev is not installed on the system. Also confirmed that
`make distcheck` is now functional.

Confirmed that both __init__.py and the .so library are still installed
in the Python directory.

Tested that it still works without python-devel installed, also
inspected Makefile.in which looks correct.

Tested that `make install pylibmountexecdir=...` still works to override
destination directory at `make install` time.

Signed-off-by: Filipe Brandenburger <filbranden@google.com>
9 years agotests: make swaplabel test more robust
Karel Zak [Tue, 26 Jan 2016 15:49:39 +0000 (16:49 +0100)] 
tests: make swaplabel test more robust

Signed-off-by: Karel Zak <kzak@redhat.com>
9 years agobuildsys: fix static configuration and building
Lada Trimasova [Tue, 26 Jan 2016 15:34:50 +0000 (18:34 +0300)] 
buildsys: fix static configuration and building

In case of uClibc librt depends on libpthread. In particular
timer_create() function uses pthread_XXX(). That means in case of static
builds it's required to link not librt alone but together with libpthread. So
if checking timer_create function in librt fails, it is necessary to check if
timer_create function successfully links with "-lpthread".

That issues was spotted in Buldroot autobuilder failures:
http://autobuild.buildroot.net/results/759/75960db671807091fe9155aee9e46a6245e32590/
http://autobuild.buildroot.org/results/112/112e8b85783f5aaba42a937a6eb064317615a21b/

Signed-off-by: Lada Trimasova <ltrimas@synopsys.com>
9 years agotests: update swapfile output
Karel Zak [Tue, 26 Jan 2016 15:02:54 +0000 (16:02 +0100)] 
tests: update swapfile output

Signed-off-by: Karel Zak <kzak@redhat.com>
9 years agolibmount: cleanup btrfs.c header
Karel Zak [Tue, 26 Jan 2016 14:57:24 +0000 (15:57 +0100)] 
libmount: cleanup btrfs.c header

Signed-off-by: Karel Zak <kzak@redhat.com>
9 years agolibmount: consolidate btrfs stuff, make it more portable
Karel Zak [Tue, 26 Jan 2016 13:39:13 +0000 (14:39 +0100)] 
libmount: consolidate btrfs stuff, make it more portable

- add --with-btrfs (enabled by default)
- check for linux/btrfs.h
- add "btrfs" to libmount features list (see mount -V)
- #ifdef HAVE_BTRFS_SUPPORT for all btrfs stuff in libmount

Signed-off-by: Karel Zak <kzak@redhat.com>
9 years agomore: remove unnecessary compatibility layer
Karel Zak [Tue, 26 Jan 2016 10:50:58 +0000 (11:50 +0100)] 
more: remove unnecessary compatibility layer

Signed-off-by: Karel Zak <kzak@redhat.com>
9 years agobuild-sys: remove libtermcap support
Sami Kerola [Sat, 16 Jan 2016 23:23:04 +0000 (23:23 +0000)] 
build-sys: remove libtermcap support

It is unlikely anyone is going to build this project on system where
libtermcap is available.  Fedora project obsoleted libtermcap 2007-12-12 in
favour of ncurses.  Debian made same move 2005.

Reference: https://fedoraproject.org/wiki/Deprecated_packages
Reference: https://www.debian.org/doc/manuals/debian-faq/ch-compat.en.html#s-termcap
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
9 years agomkswap: add warnings for insecure device permissions/owners
Wayne R. Roth [Wed, 20 Jan 2016 06:09:37 +0000 (22:09 -0800)] 
mkswap: add warnings for insecure device permissions/owners

Logic modified from sys-utils/swapon.c

Signed-off-by: Wayne R. Roth <wayneroth42@gmail.com>
9 years agolibmount: handle btrfs default subvolume mount
Stanislav Brabec [Thu, 21 Jan 2016 21:58:31 +0000 (22:58 +0100)] 
libmount: handle btrfs default subvolume mount

When mounting btrfs volume without subvol= and subvolid=, and the
btrfs volume has default subvolume defined, mount() mounts the default
subvolume and not the volume root as other filesystems do.

To handle this situation correctly (for example for "mount -a"),
libmount has to be capable to detect default subvolume.

Add btrfs.c and btrfs.h that implement needed functions.

This patch adds mnt_table_find_target_with_option() to the library API.

Known problems not covered by this patch:

- Use of subvolid= in fstab is not yet handled.

- Use of type auto in combination with subvol= in fstab is not yet
  handled.

- Use of btrfs in loop devices, where image file is specified in fstab is
  not yet handled (use of /dev/loop0 in fstab works).

- If fstab uses subvol=, and subvol path changes since last "mount -a",
  subsequent "mount -a" will not recognize that it is already mounted,
  and it will attempt to mount it second time. To fix it, libmount should
  remember subvolid in time of mount (subvolid is unique for the
  subvolume, subvol is not).

- mountinfo contains subvol and subvolid since kernel 4.2. Before kernel
  4.2, there is no reasonable way to solve this situation. (One would
  create temporary mount point, mount the default, call needed ioctl() to
  determine what was mounted, deduce the default subvolume, compare it
  with subvolume of mounted volume, unmount and return result.)

How to reproduce:
truncate -s1G btrfs_test.img
mkdir -p btrfs_mnt
/sbin/mkfs.btrfs -f -d single -m single ./btrfs_test.img
mount -o loop btrfs_test.img btrfs_mnt
pushd .
cd btrfs_mnt
mkdir -p d0/dd0/ddd0
cd d0/dd0/ddd0
touch file{1..5}
btrfs subvol create s1
cd s1
touch file{1..5}
mkdir -p d1/dd1/ddd1
cd d1/dd1/ddd1
btrfs subvol create s2
rid=$(btrfs inspect rootid s2)
echo new default $rid
btrfs subvol get-default .
btrfs subvol set-default $rid .
popd
umount btrfs_mnt
losetup /dev/loop0 $PWD/btrfs_test.img
echo "/dev/loop0 $PWD/btrfs_mnt btrfs defaults 0 0" >>/etc/fstab
mount -a
mount -a
umount btrfs_mnt
sed -i "/\/dev\/loop0/d" /etc/fstab
losetup -d /dev/loop0
rm btrfs_test.img
rmdir btrfs_mnt

Current behavior:
mount: /dev/loop0 is already mounted or /root/btrfs_mnt busy
       /dev/loop0 is already mounted on /root/btrfs_mnt

Expected behavior is to ignore already mounted FS.

[kzak@redhat.com: - make 'var' optional for mnt_table_find_target_with_option(),
                  - add mnt_table_find_target_with_option() to symbols table and docs
                  - add "btrfs" string between supported debug modes
                  - minor coding style changes]

Signed-off-by: Stanislav Brabec <sbrabec@suse.cz>
Cc: David Štěrba <dsterba@suse.cz>
Signed-off-by: Karel Zak <kzak@redhat.com>
9 years agodoap: fix download URL
Karel Zak [Mon, 25 Jan 2016 14:42:53 +0000 (15:42 +0100)] 
doap: fix download URL

Signed-off-by: Karel Zak <kzak@redhat.com>
9 years agolibsmartcols: make SCOLS_FL_WRAP usable in tree
Karel Zak [Mon, 25 Jan 2016 14:31:24 +0000 (15:31 +0100)] 
libsmartcols: make SCOLS_FL_WRAP usable in tree

Signed-off-by: Karel Zak <kzak@redhat.com>
9 years agolibsmartcols: reduce also SCOLS_FL_WRAP columns
Karel Zak [Mon, 25 Jan 2016 14:17:36 +0000 (15:17 +0100)] 
libsmartcols: reduce also SCOLS_FL_WRAP columns

Signed-off-by: Karel Zak <kzak@redhat.com>
9 years agolibsmartcols: add wrap.c sample
Karel Zak [Mon, 25 Jan 2016 14:17:21 +0000 (15:17 +0100)] 
libsmartcols: add wrap.c sample

Signed-off-by: Karel Zak <kzak@redhat.com>
9 years agolibsmartcols: fix title sample
Karel Zak [Mon, 25 Jan 2016 12:45:34 +0000 (13:45 +0100)] 
libsmartcols: fix title sample

Signed-off-by: Karel Zak <kzak@redhat.com>
9 years agolibsmartcols: fix samples build, add title.c
Karel Zak [Mon, 25 Jan 2016 12:42:51 +0000 (13:42 +0100)] 
libsmartcols: fix samples build, add title.c

Signed-off-by: Karel Zak <kzak@redhat.com>
9 years agolibsmartcols: add samples directory
Karel Zak [Mon, 25 Jan 2016 12:17:43 +0000 (13:17 +0100)] 
libsmartcols: add samples directory

Signed-off-by: Karel Zak <kzak@redhat.com>
9 years agoMerge branch 'scols_fl_wrap' of https://github.com/ignatenkobrain/util-linux
Karel Zak [Mon, 25 Jan 2016 12:03:29 +0000 (13:03 +0100)] 
Merge branch 'scols_fl_wrap' of https://github.com/ignatenkobrain/util-linux

* 'scols_fl_wrap' of https://github.com/ignatenkobrain/util-linux:
  libsmartcols: add scols_column_is_wrap to docs
  libsmartcols: don't loose colors when wrapping
  libsmartcols: wrap columns correctly with unicode
  libsmartcols: implement SCOLS_FL_WRAP

9 years agolibsmartcols: document v2.27 symbols
Karel Zak [Mon, 25 Jan 2016 11:57:10 +0000 (12:57 +0100)] 
libsmartcols: document v2.27 symbols

Signed-off-by: Karel Zak <kzak@redhat.com>
9 years agoadd util-linux.doap
Igor Gnatenko [Sun, 24 Jan 2016 23:47:07 +0000 (00:47 +0100)] 
add util-linux.doap

This is also well-known RDF Schema supported by some editors.

Reference: https://github.com/edumbill/doap/wiki
Signed-off-by: Igor Gnatenko <i.gnatenko.brain@gmail.com>
9 years agoadd .editorconfig
Igor Gnatenko [Sun, 24 Jan 2016 22:57:51 +0000 (23:57 +0100)] 
add .editorconfig

EditorConfig is very well known config file for text editors/IDE's
with settings for project. This format supported by Vim, GNOME Builder,
Atom, Sublime and many others.

We will provide this configuration to be more friendly for newcomers.

Signed-off-by: Igor Gnatenko <i.gnatenko.brain@gmail.com>
9 years agolibsmartcols: add 'Since' tag for gtkdoc for some functions
Igor Gnatenko [Sun, 24 Jan 2016 22:52:41 +0000 (23:52 +0100)] 
libsmartcols: add 'Since' tag for gtkdoc for some functions

Signed-off-by: Igor Gnatenko <i.gnatenko.brain@gmail.com>
9 years agolibsmartcols: add few methods to get information about title
Igor Gnatenko [Sun, 24 Jan 2016 22:47:42 +0000 (23:47 +0100)] 
libsmartcols: add few methods to get information about title

Signed-off-by: Igor Gnatenko <i.gnatenko.brain@gmail.com>
9 years agolibsmartcols: position of title in fact unsigned
Igor Gnatenko [Sun, 24 Jan 2016 22:34:53 +0000 (23:34 +0100)] 
libsmartcols: position of title in fact unsigned

Signed-off-by: Igor Gnatenko <i.gnatenko.brain@gmail.com>
9 years agolsblk: remove useless warnings
Karel Zak [Fri, 22 Jan 2016 18:38:18 +0000 (19:38 +0100)] 
lsblk: remove useless warnings

It's seems better to keep the warnings only in the debug output.

Reported-by: Kay Sievers <kay@vrfy.org>
Signed-off-by: Karel Zak <kzak@redhat.com>
9 years agolibsmartcols: support multibyte titles, rename wrap to padding
Karel Zak [Fri, 22 Jan 2016 15:51:59 +0000 (16:51 +0100)] 
libsmartcols: support multibyte titles, rename wrap to padding

- let's support multibyte table titles
- use lib/mbalign.c to align the title
- rename title_wrap to title_padding (we already use "wrap" on another
  places for another things)

Signed-off-by: Karel Zak <kzak@redhat.com>
9 years agolibsmartcols: add scols_column_is_wrap to docs
Igor Gnatenko [Fri, 22 Jan 2016 13:48:46 +0000 (14:48 +0100)] 
libsmartcols: add scols_column_is_wrap to docs

Signed-off-by: Igor Gnatenko <i.gnatenko.brain@gmail.com>
9 years agolibsmartcols: don't loose colors when wrapping
Igor Gnatenko [Fri, 22 Jan 2016 13:30:39 +0000 (14:30 +0100)] 
libsmartcols: don't loose colors when wrapping

Signed-off-by: Igor Gnatenko <i.gnatenko.brain@gmail.com>
9 years agolibsmartcols: wrap columns correctly with unicode
Igor Gnatenko [Fri, 22 Jan 2016 13:29:16 +0000 (14:29 +0100)] 
libsmartcols: wrap columns correctly with unicode

Signed-off-by: Igor Gnatenko <i.gnatenko.brain@gmail.com>
9 years agolibsmartcols: add title to the test application
Karel Zak [Fri, 22 Jan 2016 12:50:02 +0000 (13:50 +0100)] 
libsmartcols: add title to the test application

Signed-off-by: Karel Zak <kzak@redhat.com>
9 years agolibsmartcols: add JSON to the test application
Karel Zak [Fri, 22 Jan 2016 12:46:29 +0000 (13:46 +0100)] 
libsmartcols: add JSON to the test application

Signed-off-by: Karel Zak <kzak@redhat.com>
9 years agolibsmartcols: add new functions to docs
Karel Zak [Fri, 22 Jan 2016 12:40:19 +0000 (13:40 +0100)] 
libsmartcols: add new functions to docs

Signed-off-by: Karel Zak <kzak@redhat.com>
9 years agoMerge branch 'table_title' of https://github.com/ignatenkobrain/util-linux
Karel Zak [Fri, 22 Jan 2016 12:34:05 +0000 (13:34 +0100)] 
Merge branch 'table_title' of https://github.com/ignatenkobrain/util-linux

* 'table_title' of https://github.com/ignatenkobrain/util-linux:
  libsmartcols: set everything once in scols_table_set_title()
  libsmartcols: put new line after title
  libsmartcols: fix title aligning to center
  libsmartcols: don't try to align title if it's more that term
  libsmartcols: use symbols for title wrap
  libsmartcols: implement title of table

9 years agolibsmartcols: set everything once in scols_table_set_title()
Igor Gnatenko [Fri, 22 Jan 2016 11:54:02 +0000 (12:54 +0100)] 
libsmartcols: set everything once in scols_table_set_title()

Reported-by: Karel Zak <kzak@redhat.com>
Signed-off-by: Igor Gnatenko <i.gnatenko.brain@gmail.com>
9 years agolibsmartcols: implement SCOLS_FL_WRAP
Igor Gnatenko [Thu, 21 Jan 2016 08:57:31 +0000 (09:57 +0100)] 
libsmartcols: implement SCOLS_FL_WRAP

Reference: https://github.com/karelzak/util-linux/issues/257
Signed-off-by: Igor Gnatenko <i.gnatenko.brain@gmail.com>
9 years agolibsmartcols: put new line after title
Igor Gnatenko [Thu, 21 Jan 2016 16:37:21 +0000 (17:37 +0100)] 
libsmartcols: put new line after title

Signed-off-by: Igor Gnatenko <i.gnatenko.brain@gmail.com>
9 years agolibsmartcols: fix title aligning to center
Igor Gnatenko [Thu, 21 Jan 2016 16:36:53 +0000 (17:36 +0100)] 
libsmartcols: fix title aligning to center

Signed-off-by: Igor Gnatenko <i.gnatenko.brain@gmail.com>
9 years agolibsmartcols: don't try to align title if it's more that term
Igor Gnatenko [Thu, 21 Jan 2016 16:25:15 +0000 (17:25 +0100)] 
libsmartcols: don't try to align title if it's more that term

Signed-off-by: Igor Gnatenko <i.gnatenko.brain@gmail.com>
9 years agolibsmartcols: use symbols for title wrap
Igor Gnatenko [Thu, 21 Jan 2016 16:09:16 +0000 (17:09 +0100)] 
libsmartcols: use symbols for title wrap

Signed-off-by: Igor Gnatenko <i.gnatenko.brain@gmail.com>
9 years agolibsmartcols: implement title of table
Igor Gnatenko [Thu, 21 Jan 2016 09:02:31 +0000 (10:02 +0100)] 
libsmartcols: implement title of table

Reference: https://github.com/karelzak/util-linux/issues/258
Signed-off-by: Igor Gnatenko <i.gnatenko.brain@gmail.com>
9 years agozramctl: fix typo
Karel Zak [Thu, 21 Jan 2016 10:21:27 +0000 (11:21 +0100)] 
zramctl: fix typo

Reported-by: Rafael Fontenelle <rffontenelle@gmail.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
9 years agomount: allow nofail to silence ENOMEDIUM cases
Mike Frysinger [Wed, 20 Jan 2016 20:20:08 +0000 (15:20 -0500)] 
mount: allow nofail to silence ENOMEDIUM cases

Allow people to use nofail to ignore empty cd/dvd drive errors.

URL: https://bugs.gentoo.org/559356
Reported-by: William Hubbs <williamh@gentoo.org>
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
9 years agochrt: use sched_getattr()
Karel Zak [Wed, 20 Jan 2016 14:32:30 +0000 (15:32 +0100)] 
chrt: use sched_getattr()

9 years agochrt: make man page more structured
Karel Zak [Wed, 20 Jan 2016 13:30:52 +0000 (14:30 +0100)] 
chrt: make man page more structured

Signed-off-by: Karel Zak <kzak@redhat.com>
9 years agochrt: add support for SCHED_DEADLINE
Karel Zak [Wed, 20 Jan 2016 13:04:32 +0000 (14:04 +0100)] 
chrt: add support for SCHED_DEADLINE

This patch introduces

-d, --deadline
-T, --sched-runtime
-D, --sched-deadline
-P, --sched-period

command line options. The functionality is available only for Linux with
sched_setattr() [kernel >=3.14]

Signed-off-by: Karel Zak <kzak@redhat.com>
9 years agochrt: use sched_setattr() if available
Karel Zak [Wed, 20 Jan 2016 11:44:27 +0000 (12:44 +0100)] 
chrt: use sched_setattr() if available

Signed-off-by: Karel Zak <kzak@redhat.com>
9 years agochrt: make usage more readable
Karel Zak [Tue, 19 Jan 2016 13:52:51 +0000 (14:52 +0100)] 
chrt: make usage more readable

Signed-off-by: Karel Zak <kzak@redhat.com>
9 years agochrt: set function refactoring
Karel Zak [Tue, 19 Jan 2016 13:46:30 +0000 (14:46 +0100)] 
chrt: set function refactoring

Signed-off-by: Karel Zak <kzak@redhat.com>
9 years agochrt: output function refactoring
Karel Zak [Tue, 19 Jan 2016 13:38:18 +0000 (14:38 +0100)] 
chrt: output function refactoring

Signed-off-by: Karel Zak <kzak@redhat.com>
9 years agochrt: add control struct
Karel Zak [Tue, 19 Jan 2016 13:24:53 +0000 (14:24 +0100)] 
chrt: add control struct

Signed-off-by: Karel Zak <kzak@redhat.com>
9 years agotests: remove redundant check for NULL [cppcheck]
Boris Egorov [Tue, 19 Jan 2016 06:18:21 +0000 (12:18 +0600)] 
tests: remove redundant check for NULL [cppcheck]

We set SA_SIGINFO flag, so we should not get NULL.

[tests/helpers/test_sigreceive.c:45] -> [tests/helpers/test_sigreceive.c:47]: (warning) Either the condition 'if(info)' is redundant or there is possible null pointer dereference: info.

9 years agohwclock: fix format specifier [cppcheck]
Boris Egorov [Tue, 19 Jan 2016 06:16:41 +0000 (12:16 +0600)] 
hwclock: fix format specifier [cppcheck]

[sys-utils/hwclock-rtc.c:435]: (warning) %ld in format string (no. 1) requires 'long' but the argument type is 'unsigned long'.

9 years agolibblkid: check limits before indexing array [cppcheck]
Boris Egorov [Tue, 19 Jan 2016 06:16:03 +0000 (12:16 +0600)] 
libblkid: check limits before indexing array [cppcheck]

[libblkid/src/encode.c:165]: (style) Array index 'i' is used before limits check.

9 years agoreadprofile: add scanf field width limits [cppcheck]
Boris Egorov [Tue, 19 Jan 2016 05:45:15 +0000 (11:45 +0600)] 
readprofile: add scanf field width limits [cppcheck]

[sys-utils/readprofile.c:301]: (warning) scanf without field width limits can crash with huge input data.
[sys-utils/readprofile.c:322]: (warning) scanf without field width limits can crash with huge input data.

9 years agolibblkid,libmount: Do not use void* in calculations [cppcheck]
Boris Egorov [Tue, 19 Jan 2016 05:42:26 +0000 (11:42 +0600)] 
libblkid,libmount: Do not use void* in calculations [cppcheck]

[libblkid/src/superblocks/zfs.c:179]: (portability) 'label' is of type 'const void *'. When using void pointers in calculations, the behaviour is undefined.
[libblkid/src/superblocks/zfs.c:237]: (portability) 'label' is of type 'void *'. When using void pointers in calculations, the behaviour is undefined.
[libblkid/src/topology/topology.c:221]: (portability) 'chn.data' is of type 'void *'. When using void pointers in calculations, the behaviour is undefined.
[libmount/src/fs.c:153]: (portability) 'old' is of type 'const void *'. When using void pointers in calculations, the behaviour is undefined.
[libmount/src/fs.c:154]: (portability) 'new' is of type 'void *'. When using void pointers in calculations, the behaviour is undefined.

9 years agolibblkid: (zfs) add cast to fix UB [cppcheck]
Boris Egorov [Tue, 19 Jan 2016 05:37:57 +0000 (11:37 +0600)] 
libblkid: (zfs) add cast to fix UB [cppcheck]

[libblkid/src/superblocks/zfs.c:173]: (error) Shifting 32-bit value by 56 bits is undefined behaviour
[libblkid/src/superblocks/zfs.c:173]: (error) Shifting 32-bit value by 40 bits is undefined behaviour

9 years agolibblkid: make minix prober more robust
Karel Zak [Mon, 18 Jan 2016 13:35:33 +0000 (14:35 +0100)] 
libblkid: make minix prober more robust

It seems that the current minix probing code is not robust enough and
it returns false positive for Fedora f24 install images. The crazy thing
is that the image pass also all Linux kernel minix_fill_super() checks
and mount(2) fails later when it tries to read filesystem root
directory.

The fsck.minix requires sb->s_log_zone_size to be zero (Linux kernel
does not care about it), let's use the same requirement for libblkid.

Note, it would be possible to check minix root directory inode in
libblkid, but this solution requires minix prober specific seek &
read. We want to avoid extra read operations...

References: https://bugzilla.redhat.com/show_bug.cgi?id=1299255
Signed-off-by: Karel Zak <kzak@redhat.com>
9 years agolibsmartcols: don't sort if cmpfunc() is not set
Karel Zak [Mon, 18 Jan 2016 09:47:22 +0000 (10:47 +0100)] 
libsmartcols: don't sort if cmpfunc() is not set

Reported-by: Igor Gnatenko <i.gnatenko.brain@gmail.com>