Commit Graph

14483 Commits

Author SHA1 Message Date
Evgeny Vereshchagin 07919e55b0 travis: integrate util-linux with Coverity Scan
For this to work, a daily cron job running on the master branch
should be added: https://docs.travis-ci.com/user/cron-jobs/

The report can found at https://scan.coverity.com/projects/karelzak-util-linux

Signed-off-by: Evgeny Vereshchagin <evvers@ya.ru>
2020-07-13 19:54:48 +00:00
Yuri Chornoivan aa1c7a7686 More typo fixes by fossies 2020-07-13 15:33:42 +03:00
Evgeny Vereshchagin b7abdc2dd5 travis: switch to a newer version of macOS
Signed-off-by: Evgeny Vereshchagin <evvers@ya.ru>
2020-07-10 15:58:06 +00:00
Yuri Chornoivan 311e33afef Fix minor typos 2020-07-09 20:14:32 +03:00
Karel Zak 1f4009146a build-sys: release++ (v2.36-rc2)
Signed-off-by: Karel Zak <kzak@redhat.com>
2020-07-09 12:20:57 +02:00
Karel Zak aaa3502334 docs: update v2.36-ReleaseNotes
Signed-off-by: Karel Zak <kzak@redhat.com>
2020-07-09 12:18:44 +02:00
Karel Zak 383130fc5f docs: update AUTHORS file
Signed-off-by: Karel Zak <kzak@redhat.com>
2020-07-09 12:15:33 +02:00
Karel Zak 00675fd5f0 po: merge changes
Signed-off-by: Karel Zak <kzak@redhat.com>
2020-07-09 12:13:54 +02:00
Karel Zak c0eb43f7d3 docs: update ReleaseNotes
Signed-off-by: Karel Zak <kzak@redhat.com>
2020-07-09 11:55:05 +02:00
Karel Zak 10a0a9cbc5 last: fix use of non-terminated utmp->ut_line
Addresses: https://github.com/karelzak/util-linux/pull/1097
Signed-off-by: Karel Zak <kzak@redhat.com>
2020-07-09 10:10:58 +02:00
Karel Zak a102522992 docs: add terminal hyperlinks to TODO
Signed-off-by: Karel Zak <kzak@redhat.com>
2020-07-09 09:34:30 +02:00
Karel Zak ff89765a8f travis: don't ask for Ubuntu release on XOS
Signed-off-by: Karel Zak <kzak@redhat.com>
2020-07-08 15:11:17 +02:00
Karel Zak 7680209f8a libmount: (verity) remove unnecessary empty lines
Signed-off-by: Karel Zak <kzak@redhat.com>
2020-07-08 10:11:57 +02:00
Karel Zak ca4faf2441 Merge branch 'lp1886300' of https://github.com/mfoliveira/util-linux
* 'lp1886300' of https://github.com/mfoliveira/util-linux:
  rename: fix regression for symlink with non-existing target
2020-07-08 10:10:53 +02:00
Karel Zak c9cad81a0c Merge branch 'cryptsetup_dlopen' of https://github.com/bluca/util-linux
* 'cryptsetup_dlopen' of https://github.com/bluca/util-linux:
  cryptsetup: add option to use via dlopen in libmount
2020-07-08 09:55:12 +02:00
Karel Zak c02980d6f2 lsmem: report inaccessible /sys/devices/system/memory
Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=1794160
Signed-off-by: Karel Zak <kzak@redhat.com>
2020-07-08 08:51:45 +02:00
Karel Zak 655d736da3 lib/path: add ul_path_is_accessible()
This function allow to check that path_cxt is usable. Note that
ul_new_path() does not open the path.

Signed-off-by: Karel Zak <kzak@redhat.com>
2020-07-08 08:50:07 +02:00
Karel Zak bf1d0a4ea0 lsmem: make it without leaks for non-error output
Signed-off-by: Karel Zak <kzak@redhat.com>
2020-07-08 08:48:45 +02:00
Mauricio Faria de Oliveira 477239ce0d rename: fix regression for symlink with non-existing target
Since commit 5454df9c31 ("rename: check source file access early")
rename fails early for symlinks with non-existing target (regression),
because access() dereferences the link.

From access(2):

  "access() checks whether the calling process can access the file pathname.
   If pathname is a symbolic link, it is dereferenced."

Thus replace access() with faccessat() and lstat() as fallback,
(as in do_symlink()), that is equivalent for symlink and files.

From fsaccess(2) and stat(2):

  "The faccessat() system call operates in exactly the same way as access(),
   except for the differences described here.
   [...]
   If pathname is relative and dirfd is the special value AT_FDCWD, then pathname
   is interpreted relative to the current working directory of the calling process
   (like access()).
   [...]
   AT_SYMLINK_NOFOLLOW
     If pathname is a symbolic link, do not dereference it:
     instead return information about the link itself."

  "lstat() is identical to stat(), except that if pathname is a symbolic link, then
   it returns information about  the  link  itself, not the file that it refers to."

Testing
-------

  1) symlink with existing target
  2) symlink with non-existing target
  3) non-existing symlink
  4) existing file
  5) non-existing file

Before:

  $ touch file-found
  $ ln -s file-found symlink-1
  $ ./rename sym symbolic- symlink-1	# XPASS.
  $ echo $?
  0

  $ ln -s file-not-found symlink-2
  $ ./rename sym symbolic- symlink-2	# FAIL! REGRESSION.
  rename: symlink-2: not accessible: No such file or directory
  $ echo $?
  1

  $ ./rename sym symbolic- symlink-3	# XFAIL.
  rename: symlink-3: not accessible: No such file or directory
  $ echo $?
  1

  $ touch file-found
  $ ./rename found existing file-found	# XPASS.
  $ echo $?
  0

  $ ./rename found existing file-not-found # XFAIL.
  rename: file-not-found: not accessible: No such file or directory
  $ echo $?
  1

After:

  $ touch file-found
  $ ln -s file-found symlink-1
  $ ./rename sym symbolic- symlink-1	# XPASS.
  $ echo $?
  0

  $ ln -s file-not-found symlink-2
  $ ./rename sym symbolic- symlink-2	# PASS! REGRESSION FIXED.
  $ echo $?
  0

  $ ./rename sym symbolic- symlink-3	# XFAIL.
  rename: symlink-3: not accessible: No such file or directory
  $ echo $?
  1

  $ touch file-found
  $ ./rename found existing file-found	# XPASS.
  $ echo $?
  0

  $ ./rename found existing file-not-found # XFAIL.
  rename: file-not-found: not accessible: No such file or directory
  $ echo $?
  1

And to test/simulate faccessat()'s EINVAL for AT_SYMLINK_NOFOLLOW
for Mac OS X, per commit 826538bf64 ("rename: skip faccessat()
failure if AT_SYMLINK_NOFOLLOW is not a valid flag"), forced 'if'
to evaluate to false so that lstat() is taken.

It still fails early; the error messages are slightly different
('not accessible' vs. 'stat of ... failed') but still tell same
'No such file or directory'; exit code is the same as well.

  $ ./rename sym symbolic- symlink-3	# XFAIL. DIFF MSG/SAME RC.
  rename: stat of symlink-3 failed: No such file or directory
  $ echo $?
  1

  $ ./rename found existing file-not-found # XFAIL. DIFF MSG/SAME RC.
  rename: stat of file-not-found failed: No such file or directory
  $ echo $?
  1

Tested on commit 2b41c409e ("Merge branch 'blkd-err' of ...")

Signed-off-by: Mauricio Faria de Oliveira <mfo@canonical.com>
2020-07-07 16:19:15 -03:00
Luca Boccassi 488fd4c3df cryptsetup: add option to use via dlopen in libmount
Enabling libcrypsetup in libmount had several unintended side
effects.
First of all, it increases the Debian minimal image size by
~2.5% (5.6MB worth of new libraries).
Then, due to libcryptsetup linkage to OpenSSL and libjson-c,
it causes incompatibilities with external programs linking
against both libmount and a private, static, old version of
OpenSSL, or external programs linking against libjansson or
json-glib, which have one symbol in common with libjson-c.

If ./configure is ran with --with-crypsetup=dlopen,
instead of linking to libcrypsetup, use dlopen to resolve
the symbols at runtime only when the verity feature is
used, thus avoiding clashes and keeping images size down.

Fixes #1081

Signed-off-by: Luca Boccassi <luca.boccassi@microsoft.com>
2020-07-07 16:43:55 +01:00
Karel Zak 2b41c409e7 Merge branch 'blkd-err' of https://github.com/evverx/util-linux
* 'blkd-err' of https://github.com/evverx/util-linux:
  tests: turn off detect_leaks on s390x, use more asan options
  tests: skip "blkid/dm-err" when `mknod` doesn't work
2020-07-07 14:24:41 +02:00
Evgeny Vereshchagin 1b9f2ff333 tests: turn off detect_leaks on s390x, use more asan options
Signed-off-by: Evgeny Vereshchagin <evvers@ya.ru>
2020-07-03 13:26:08 +00:00
Evgeny Vereshchagin d3c9e21fe7 tests: skip "blkid/dm-err" when `mknod` doesn't work
Signed-off-by: Evgeny Vereshchagin <evvers@ya.ru>
2020-07-03 11:44:23 +00:00
Karel Zak 7586e9d1aa cal: use size_t to calculate width [lgtm scan]
We use size_t for width. This patch makes it consistent for
years_width too.

Signed-off-by: Karel Zak <kzak@redhat.com>
2020-07-03 13:17:51 +02:00
Karel Zak 2e5819df6c unshare: (man) add note about signals on --fork
Addresses: https://github.com/karelzak/util-linux/pull/1087
Signed-off-by: Karel Zak <kzak@redhat.com>
2020-07-03 13:03:58 +02:00
Karel Zak 9120e39f92 Merge branch 'unshare-signals' of https://github.com/DaanDeMeyer/util-linux 2020-07-03 12:56:54 +02:00
Karel Zak d118738095 libfdisk: (gpt) fix compiler warning [-Wmaybe-uninitialized]
Make sure that variables used in  gpt_calculate_* are always initialized.

Addresses: https://github.com/karelzak/util-linux/issues/1091
Signed-off-by: Karel Zak <kzak@redhat.com>
2020-07-03 12:30:59 +02:00
Karel Zak bc270ae1a8 Merge branch 'werror' of https://github.com/evverx/util-linux 2020-07-03 11:34:12 +02:00
Karel Zak 32e1bc0d72 Merge branch 'travis-arch' of https://github.com/evverx/util-linux
* 'travis-arch' of https://github.com/evverx/util-linux:
  travis: build util-linux on arm64, ppc64le and s390x
2020-07-03 11:32:36 +02:00
Evgeny Vereshchagin b9b65bffc3 travis: turn on CIFuzz
Signed-off-by: Karel Zak <kzak@redhat.com>
2020-07-03 11:19:14 +02:00
Evgeny Vereshchagin 6af515811b tests: ignore the python libmount tests when they're run under UBSan
ts_init_py meddles with LD_LIBRARY_PATH causing those tests to fail with
```
+Traceback (most recent call last):
+  File "/home/travis/build/karelzak/util-linux/libmount/python/test_mount_tab.py", line 8, in <module>
+    import pylibmount as mnt
+ImportError: /home/travis/build/karelzak/util-linux/.libs/libblkid.so.1: undefined symbol: __ubsan_handle_negate_overflow
}}}-diff
```
2020-07-03 11:18:54 +02:00
Evgeny Vereshchagin 5cda653a7b travis: install llvm-* to get llvm-symbolizer
Backtraces like
```
misc-utils/cal.c:295:4: runtime error: signed integer overflow: 2147483647 + 5 cannot be represented in type 'int'
==1405==WARNING: invalid path to external symbolizer!
==1405==WARNING: Failed to use and restart external symbolizer!
    #0 0x4c4c09  (/home/travis/build/karelzak/util-linux/cal+0x4c4c09)
    #1 0x7f4363046b96  (/lib/x86_64-linux-gnu/libc.so.6+0x21b96)
    #2 0x41bab9  (/home/travis/build/karelzak/util-linux/cal+0x41bab9)
SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior misc-utils/cal.c:295:4 in
```
aren't very helpful

It's follow-up to https://github.com/karelzak/util-linux/pull/1075
2020-07-03 11:18:54 +02:00
Evgeny Vereshchagin 5b9df9c40d travis: turn on UBsan on Travis CI to see how it goes
Signed-off-by: Karel Zak <kzak@redhat.com>
2020-07-03 11:18:32 +02:00
Evgeny Vereshchagin e6a4d8cc06 build-sys: add --enable-ubsan to make it possible to build util-linux with UBSan
mostly to prepare for https://github.com/karelzak/util-linux/pull/1068
but it's useful even without fuzzing.

Signed-off-by: Karel Zak <kzak@redhat.com>
2020-07-03 11:17:53 +02:00
Daan De Meyer 3ba6736f3a unshare --fork: Ignore SIGINT and SIGTERM in parent 2020-07-02 16:35:21 +02:00
Evgeny Vereshchagin bf04d98b93 skip hwclock/systohc on Travis CI on Ubuntu Precise
It's flaky there.

Closes https://github.com/karelzak/util-linux/issues/1082
2020-07-02 11:52:46 +00:00
Evgeny Vereshchagin 38c5db359d travis: turn off -Werror on precise and osx
I'm not sure anyone is particularly interested in what the compilers
have to say there.
2020-07-02 10:51:04 +00:00
Evgeny Vereshchagin ad6aef0ea8 revert a680b2abe7
It's not clear what that commit was supposed to fix. Looks like
772420322d should have helped there.
2020-07-02 10:23:47 +00:00
Evgeny Vereshchagin 7b81644f10 travis: turn on -Werror 2020-07-02 09:49:12 +00:00
Evgeny Vereshchagin c7eb1925ee travis: build util-linux on arm64, ppc64le and s390x 2020-07-02 08:08:41 +00:00
Karel Zak a732e4a1d3 libblkid: remove blkid_llseek()
Let's use libc lseek() everywhere like we use in another tools. It's
year 2020 ...

Addresses: https://github.com/karelzak/util-linux/issues/1083
Signed-off-by: Karel Zak <kzak@redhat.com>
2020-07-01 15:47:20 +02:00
Karel Zak 63c80c4cf7 build-sys: add --enable-werror
Add new ./configure option to make all compiler warnings into errors.

Addresses: https://github.com/karelzak/util-linux/issues/1083
Signed-off-by: Karel Zak <kzak@redhat.com>
2020-07-01 15:23:10 +02:00
Karel Zak 077650ff0d docs: remove drone.io, add lgtm.com
Signed-off-by: Karel Zak <kzak@redhat.com>
2020-07-01 09:33:27 +02:00
Karel Zak 313a738832 build-sys: add -Waddress-of-packed-member
Signed-off-by: Karel Zak <kzak@redhat.com>
2020-07-01 09:32:58 +02:00
Karel Zak 96f114455e Merge branch 'bionic' of https://github.com/evverx/util-linux
* 'bionic' of https://github.com/evverx/util-linux:
  travis: make it easier to switch to the next clang/gcc
  travis: switch to clang-10
  travis: switch to gcc-10
  travis: ignore memory leaks in checkusage
  travis: install all the "official" build dependencies
  travis: switch to Bionic
2020-07-01 09:28:23 +02:00
Evgeny Vereshchagin e0967c5b39 travis: make it easier to switch to the next clang/gcc
by just changing the compiler option in .travis.yml

In https://travis-ci.org/github/karelzak/util-linux/builds/703664282 I switched
to gcc-9/clang-9 by simply applying the following patch:
```
diff --git a/.travis.yml b/.travis.yml
index ec1284717..12a247d91 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -7,8 +7,8 @@ git:
   depth: 1500

 compiler:
-  - gcc-10
-  - clang-10
+  - gcc-9
+  - clang-9

 env:
   - MAKE_CHECK="nonroot"
```
2020-06-30 18:11:30 +00:00
Evgeny Vereshchagin d98d498727 travis: switch to clang-10
to prepare the infrastructure for https://github.com/karelzak/util-linux/pull/1068
2020-06-29 14:54:26 +00:00
Evgeny Vereshchagin f99c2464e7 travis: switch to gcc-10
to get around an ASan bug mentioned in https://github.com/karelzak/util-linux/issues/1076
2020-06-29 14:28:42 +00:00
Evgeny Vereshchagin c297ed7533 travis: ignore memory leaks in checkusage
Closes https://github.com/karelzak/util-linux/issues/1077
2020-06-29 12:36:48 +00:00
Karel Zak f9a4f93584 Merge branch 'ufiformat-reference' of https://github.com/wojtekka/util-linux
* 'ufiformat-reference' of https://github.com/wojtekka/util-linux:
  disk-utils: Add reference to ufiformat(8)
2020-06-29 12:49:20 +02:00