Commit Graph

10120 Commits

Author SHA1 Message Date
Ruediger Meier 0024583ca0 build-sys: fix libtoolize for OSX
autoreconf would also call glibtoolize on Darwin.

Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
2016-02-12 14:10:59 +01:00
Karel Zak 173607a254 Merge branch 'compiler-warnings' of https://github.com/rudimeier/util-linux
* 'compiler-warnings' of https://github.com/rudimeier/util-linux:
  exec_shell: prevent basename from modifying env
  lib/path: ifdef path_set_prefix() like in path.h
  lib: fix unused parameters and variables
  misc: fix some printf format strings
  include: add missing includes
  ipcs:  ulong -> unsigned long
  libcommon: don't include sysinfo.h
2016-02-12 13:35:18 +01:00
Karel Zak aa4e57e3ba Merge branch 'travis2' of https://github.com/filbranden/util-linux 2016-02-12 13:15:25 +01:00
Karel Zak 9a18b8bce3 Merge branch 'test-fixes' of https://github.com/rudimeier/util-linux
* 'test-fixes' of https://github.com/rudimeier/util-linux:
  tests: ts_fdisk_clean(), remove optimal iosize
  tests: minor cleanup ts_fdisk_clean()
2016-02-12 13:15:00 +01:00
Karel Zak af86564357 libmount: fix memleak in mnt_pretty_path()
References: https://github.com/karelzak/util-linux/issues/275
Signed-off-by: Karel Zak <kzak@redhat.com>
2016-02-12 13:09:28 +01:00
Karel Zak d0fe12aeb4 sulogin: keep initialization more robust
Signed-off-by: Karel Zak <kzak@redhat.com>
2016-02-12 11:21:50 +01:00
Werner Fink cde7699c27 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>
2016-02-12 11:19:21 +01:00
Stanislav Brabec 5ee870c98c 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>
2016-02-12 11:09:04 +01:00
Karel Zak d58b9706ed libmount: fix mnt_table_is_fs_mounted() for loopdev
Reported-by: Stanislav Brabec <sbrabec@suse.cz>
Signed-off-by: Karel Zak <kzak@redhat.com>
2016-02-12 11:03:32 +01:00
Stanislav Brabec b59c3bf292 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>
2016-02-12 10:39:14 +01:00
Stanislav Brabec c4af75a84e 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>
2016-02-12 10:33:17 +01:00
Ruediger Meier 7f79adb342 exec_shell: prevent basename from modifying env
Fix warning:
passing 'const char *' to parameter of type 'char *' discards
qualifiers [-Wincompatible-pointer-types-discards-qualifiers]

Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
2016-02-11 13:40:28 +01:00
Ruediger Meier 4a04d7f3d6 lib/path: ifdef path_set_prefix() like in path.h
Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
2016-02-11 13:40:25 +01:00
Ruediger Meier 8b9cf26aff lib: fix unused parameters and variables
Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
2016-02-11 13:40:22 +01:00
Ruediger Meier 7231fb2a5b misc: fix some printf format strings
Fix the warnings below for OSX clang and add a few more
casts for timeval:

lib/at.c:131:27: warning: format specifies type 'intmax_t' (aka 'long') but the argument has type 'off_t' (aka 'long long') [-Wformat]

                        printf("%16jd bytes ", st.st_size);

                                ~~~~~          ^~~~~~~~~~

lib/strutils.c:522:52: warning: format specifies type 'intmax_t' (aka 'long') but the argument has type 'uint64_t' (aka 'unsigned long long') [-Wformat]

                snprintf(buf, sizeof(buf), "%d%s%jd%s", dec, dp, frac, suffix);

                                                ~~~              ^~~~

lib/sysfs.c:468:42: warning: format specifies type 'uintmax_t' (aka 'unsigned long') but the argument has type 'uint64_t' (aka 'unsigned long long') [-Wformat]

        len = snprintf(buf, sizeof(buf), "%ju", num);

                                          ~~~   ^~~

libuuid/src/gen_uuid.c:316:34: warning: format specifies type 'unsigned long' but the argument has type '__darwin_suseconds_t' (aka 'int') [-Wformat]

                              clock_seq, last.tv_sec, last.tv_usec, adjustment);

                                                      ^~~~~~~~~~~~

Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
2016-02-11 13:39:56 +01:00
Karel Zak 583627ef36 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>
2016-02-11 12:33:57 +01:00
Ruediger Meier 948d1f3114 include: add missing includes
lib/pager.c: signal.h ... raise(3p)
lib/sysfs.c: libgen.h ... basename(3p)
lib/exec_shell.c: libgen.h ... basename(3p)

Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
2016-02-11 12:31:04 +01:00
Ruediger Meier 8fe76cd171 ipcs: ulong -> unsigned long
Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
2016-02-11 12:31:03 +01:00
Ruediger Meier 930a566207 libcommon: don't include sysinfo.h
It was added in 929f939e but should have been removed again
in 08ca3e26.

Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
2016-02-11 12:31:03 +01:00
Karel Zak 79c101427f colcrt: minor cosmetic changes
Signed-off-by: Karel Zak <kzak@redhat.com>
2016-02-11 12:21:22 +01:00
Karel Zak eac478dcfd swapon: drop perms if setuid before call mkswap
Signed-off-by: Karel Zak <kzak@redhat.com>
2016-02-11 12:07:34 +01:00
Karel Zak 8292273fde 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
2016-02-11 11:59:58 +01:00
Karel Zak a125123f8b 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>
2016-02-11 11:39:16 +01:00
Sami Kerola 8843aa41a7 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>
2016-02-11 10:52:18 +01:00
Sami Kerola 2dd3ba2c85 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>
2016-02-11 10:52:18 +01:00
Sami Kerola 9eeba70eed swapon: add control struct
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2016-02-11 10:52:18 +01:00
Ruediger Meier 01e8c90ca2 tests: ts_fdisk_clean(), remove optimal iosize
It's a pity a pity that we have to remove it. In past our test suite
could discover a kernel bug (4.4). But now they've changed optimal
iosizes on purpose.

Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
2016-02-10 21:06:41 +01:00
Ruediger Meier 23d8c55684 tests: minor cleanup ts_fdisk_clean()
Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
2016-02-10 21:06:40 +01:00
Karel Zak a7f160f9e1 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>
2016-02-10 16:59:41 +01:00
Karel Zak 20759a42ec libsmartcols: rewrite ./sample-scols-wrap
Signed-off-by: Karel Zak <kzak@redhat.com>
2016-02-10 15:37:30 +01:00
Karel Zak d94c519877 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>
2016-02-10 15:34:21 +01:00
Filipe Brandenburger 05894f05bd travis: Remove workaround for libtool install of pylibmount
Commit 324330aca6 ("build-sys: Properly order install dependencies
of pylibmount") introduces a proper make dependency for the install
rules, in a way that the workaround is no longer necessary.

Tested that a PR with this commit passes Travis-CI.

Signed-off-by: Filipe Brandenburger <filbranden@google.com>
2016-02-09 15:15:33 -08:00
Karel Zak e865838d6d libsmartcols: use libscols_cell for title
References: https://github.com/karelzak/util-linux/issues/270
Signed-off-by: Karel Zak <kzak@redhat.com>
2016-02-09 11:21:21 +01:00
Karel Zak f4a1d26609 libfdisk: add missing break
Signed-off-by: Karel Zak <kzak@redhat.com>
2016-02-09 10:04:36 +01:00
Karel Zak c78f4d0a4a Merge branch 'pylibmount_dependency' of https://github.com/filbranden/util-linux 2016-02-09 09:57:48 +01:00
Karel Zak 300e24a8ea 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>
2016-02-08 16:37:03 +01:00
Filipe Brandenburger 324330aca6 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>
2016-02-05 11:03:09 -08:00
Filipe Brandenburger d54eb46646 Revert "build-sys: Order pylibmount after usrlib on install"
This reverts commit e61f406913.
2016-02-05 10:08:50 -08:00
Karel Zak b1d31d03de 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
2016-02-04 16:02:17 +01:00
Ruediger Meier 23e35eca15 script: fix misspelling 2016-02-03 16:34:12 +01:00
Ruediger Meier 3fd1f7711e docs: fix typos found by codespell
Using "codespell" from https://github.com/lucasdemarchi/codespell

Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
2016-02-03 15:10:08 +01:00
Karel Zak 4afb337e00 fdisk: make 'f' command more verbose
Signed-off-by: Karel Zak <kzak@redhat.com>
2016-02-03 13:40:25 +01:00
Sami Kerola c1ca4fc108
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>
2016-02-02 17:27:28 +00:00
Sami Kerola ea4ccc9ea1
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>
2016-02-02 17:27:28 +00:00
Sami Kerola 5abd5d8aec
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>
2016-02-02 17:27:28 +00:00
Karel Zak c809b20aa4 sfdisk: make --quiet really quiet
References: https://github.com/karelzak/util-linux/issues/268
Signed-off-by: Karel Zak <kzak@redhat.com>
2016-02-01 14:30:31 +01:00
Karel Zak d09c06baf4 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>
2016-02-01 14:08:04 +01:00
Karel Zak ea7f53cdc5 hwclock: remove extra space from --show output
Signed-off-by: Karel Zak <kzak@redhat.com>
2016-02-01 13:43:22 +01:00
Karel Zak 6fc24cc211 Merge branch 'master' of https://github.com/annajonna/util-linux 2016-02-01 13:39:48 +01:00
Karel Zak 9aa3173bab libmount: move btrfs subvol code refactoring
Signed-off-by: Karel Zak <kzak@redhat.com>
2016-02-01 13:10:33 +01:00