Commit Graph

12406 Commits

Author SHA1 Message Date
Karel Zak 22db7b5132 tests: use TS_HELPER_CAL
Signed-off-by: Karel Zak <kzak@redhat.com>
2018-02-02 10:16:27 +01:00
Karel Zak b9d9ab7dae cal: add ifdef TEST_CAL
The test program follows CAL_TEST_TIME=<sec> rather than libc time().
It allows to use cal(1) in regression tests in cases where output
depends on the current time.

(We already use the same for example for logger.)

Signed-off-by: Karel Zak <kzak@redhat.com>
2018-02-02 10:05:15 +01:00
Karel Zak 7895231321 tests: update setarch test
Signed-off-by: Karel Zak <kzak@redhat.com>
2018-02-01 16:53:45 +01:00
Karel Zak 8d31f146ed libmount: fix debug message
Signed-off-by: Karel Zak <kzak@redhat.com>
2018-02-01 16:52:14 +01:00
Karel Zak fd777151bf sys-utils: use errexec()
Signed-off-by: Karel Zak <kzak@redhat.com>
2018-02-01 15:44:25 +01:00
Karel Zak 7bc5eeee44 vipw: use errexec()
Signed-off-by: Karel Zak <kzak@redhat.com>
2018-02-01 15:41:42 +01:00
Karel Zak 856fcfd104 newgrp: use errexec()
Signed-off-by: Karel Zak <kzak@redhat.com>
2018-02-01 15:41:23 +01:00
Karel Zak 61b6222269 schedutils: use errexec()
Signed-off-by: Karel Zak <kzak@redhat.com>
2018-02-01 15:40:59 +01:00
Karel Zak 62fa0883be text-utils: use errexec()
Signed-off-by: Karel Zak <kzak@redhat.com>
2018-02-01 15:40:43 +01:00
Karel Zak 0f6adf8673 lib/exec_shell: (and pager) use errexec()
Signed-off-by: Karel Zak <kzak@redhat.com>
2018-02-01 15:38:24 +01:00
Karel Zak 3c29b695dd su: use errexec()
The new macro is fully compatible with original (coreutils) code.

Signed-off-by: Karel Zak <kzak@redhat.com>
2018-02-01 15:37:22 +01:00
Karel Zak cf654e1c3e include/c: add errexec()
The new errexec() macro consolidate and unify the way how util-linux
tools react to failed exec()-like functions:

 * exit code 126 when program located, but not usable
 * exit code 127 when could not find program to exec

The exit codes are compatible with coreutils.

Note that all the change is located in c.h; the file exitcodes.h
contains API specific (mkfs, fsck, ...) codes only.

Addresses: https://github.com/karelzak/util-linux/pull/311
Signed-off-by: Karel Zak <kzak@redhat.com>
2018-02-01 14:58:52 +01:00
Karel Zak 79d6aa3811 findfs: don't include exitcodes.h
The code uses findfs return codes only.

Signed-off-by: Karel Zak <kzak@redhat.com>
2018-02-01 14:51:55 +01:00
Karel Zak 3bf6c44462 fstrim: don't include exitcodes.h
The code uses generic and libmount return codes only.

Signed-off-by: Karel Zak <kzak@redhat.com>
2018-02-01 14:49:49 +01:00
Karel Zak 8e066650e2 build-sys: gtkdoc-fixxref v1.27 requires module option
Signed-off-by: Karel Zak <kzak@redhat.com>
2018-02-01 13:23:40 +01:00
Karel Zak 63c9c05d35 misc: remove %p from debug messages
From libs where suid program may be executed by non-root user.

Signed-off-by: Karel Zak <kzak@redhat.com>
2018-02-01 13:18:57 +01:00
Karel Zak 117d079199 lib/exec_shell: cleanup function attributes
Reported-by: Sami Kerola <kerolasa@iki.fi>
Signed-off-by: Karel Zak <kzak@redhat.com>
2018-02-01 12:25:39 +01:00
Karel Zak 9a84ecc0d8 Merge branch 'libblkid-atari' of https://github.com/yontalcar/util-linux
* 'libblkid-atari' of https://github.com/yontalcar/util-linux:
  libblkid: atari - reject devices with blocksize != 512
  libblkid: atari - don't add duplicate entries
  libblkid: atari - test if any partition fits disk size
  tests: added missing expected outputs for partx (atari)
  libblkid: atari - fix bad variable name
  tests: added test for libblkid atari pt
  libblkid: Support for Atari partitioning scheme
2018-01-31 11:08:06 +01:00
Karel Zak cb1b3a203d docs: update TODO
Signed-off-by: Karel Zak <kzak@redhat.com>
2018-01-31 11:06:40 +01:00
Karel Zak 900d77e419 tests: update cal(1) tests
* remove extra space after year output
	f066c107ce

* don't print blank space behind last char on row
	8315a2ff15

* print just specified number of month for -1, -3 and -n
        2bcf8f7934

Signed-off-by: Karel Zak <kzak@redhat.com>
2018-01-30 16:19:14 +01:00
Karel Zak f066c107ce cal: remove extra space after year output
Reported-by: Mike Frysinger <vapier@gentoo.org>
Signed-off-by: Karel Zak <kzak@redhat.com>
2018-01-30 16:17:10 +01:00
Karel Zak 37bd991f77 cal: don't use year header for -1, -3 or -n
Signed-off-by: Karel Zak <kzak@redhat.com>
2018-01-30 16:14:15 +01:00
Karel Zak 8315a2ff15 cal: follow terminal width
* modify number of months in row according to the terminal width
* don't print blank space behind last char on row

Signed-off-by: Karel Zak <kzak@redhat.com>
2018-01-30 16:10:06 +01:00
Vaclav Dolezal 046351760f libblkid: atari - reject devices with blocksize != 512
Signed-off-by: Vaclav Dolezal <vdolezal@redhat.com>
2018-01-30 13:50:15 +01:00
Mike Frysinger 2afbcec561 build-sys: (configure) fix bashisms
The `test` command only recognizes =, not ==.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2018-01-30 12:22:16 +01:00
Karel Zak 63bf2439eb zramctl: use xstrdup()
Signed-off-by: Karel Zak <kzak@redhat.com>
2018-01-30 12:21:03 +01:00
Libor Bukata a3612b81fe Added the support for lz4hc, deflate, and 842
compression algorithms in zramctl utility.

Signed-off-by: Libor Bukata <lbukata@gmail.com>
2018-01-24 17:10:09 +01:00
Vaclav Dolezal 568419b1aa libblkid: atari - don't add duplicate entries
This should protect against looped XGMs.

Signed-off-by: Vaclav Dolezal <vdolezal@redhat.com>
2018-01-24 14:40:21 +01:00
Vaclav Dolezal 98d87b95de libblkid: atari - test if any partition fits disk size
Signed-off-by: Vaclav Dolezal <vdolezal@redhat.com>
2018-01-24 14:40:21 +01:00
J William Piggott d7db28c6d6 cal: do not set months_in_row with -3 option
Having the -3 option set months_in_row causes ordinal days
to wrap; it overrides the automatic handling of months_in_row
that falls back to 2 month columns for ordinal days.

Before:
cal -3j 2020
                           2020

            July                         August                      September
Sun Mon Tue Wed Thu Fri Sat   Sun Mon Tue Wed Thu Fri Sat   Sun Mon Tue Wed Thu Fri Sat
    182 183 184 185 186 187                   213 214 215   244 245 246 247 248 249 250
188 189 190 191 192 193 194   216 217 218 219 220 221 222   251 252 253 254 255 256 257
195 196 197 198 199 200 201   223 224 225 226 227 228 229   258 259 260 261 262 263 264
202 203 204 205 206 207 208   230 231 232 233 234 235 236   265 266 267 268 269 270 271
209 210 211 212               237 238 239 240 241 242 243   272 273

Patched:
cal -3j 2020
                           2020

          December                      January
Sun Mon Tue Wed Thu Fri Sat   Sun Mon Tue Wed Thu Fri Sat
335 336 337 338 339 340 341                 1   2   3   4
342 343 344 345 346 347 348     5   6   7   8   9  10  11
349 350 351 352 353 354 355    12  13  14  15  16  17  18
356 357 358 359 360 361 362    19  20  21  22  23  24  25
363 364 365                    26  27  28  29  30  31

          February
Sun Mon Tue Wed Thu Fri Sat
                         32
 33  34  35  36  37  38  39
 40  41  42  43  44  45  46
 47  48  49  50  51  52  53
 54  55  56  57  58  59  60

Signed-off-by: J William Piggott <elseifthen@gmx.com>
2018-01-24 13:24:33 +01:00
J William Piggott 2bcf8f7934 cal: honor num_months when only a year argument
I don't know if this was an oversight or an overzealous
interpretation of POSIX. Just in case, I'll address the
POSIX possibility. POSIX description for cal(1) says:

  If only the year operand is given, cal shall produce a
  calendar for all twelve months in the given calendar year.

It also says that cal(1) has no options, so in that context
if an option is given then it should be expected to override
POSIX behavior.

Before patched all of these command displayed a full year:
cal -1 2020
cal -3 2020
cal -n6 2020

Patched the number of months options are honored.

This patch also fixes the -1 option which was a no-op.

Signed-off-by: J William Piggott <elseifthen@gmx.com>
2018-01-24 13:24:33 +01:00
Mike Frysinger 0aade1d319 mount(8): drop redundant filesystem-specific sections
Add a new section to the top of the filesystem-specific chapter to point
people generally to the filesystem-specific man pages.  This way we can
delete all the redundant subsections that say the same thing.

These subsections are deleted because they offer no options.  Which is
the same as all the filesystems the kernel supports but this man page
doesn't explicitly list (of which there are a few).
  coherent minix ramfs romfs squashfs sysv xenix

These subsections are deleted because they simply point to the respective
<fs>(5) or mount.<fs>(8) page which we now document at the top.  Some also
discuss the syscall ABI, but that doesn't seem appropriate for this page.
  btrfs cifs ext2 ext3 ext4 nfs nfs4 proc smbfs tmpfs xfs

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2018-01-24 13:24:33 +01:00
Ruediger Meier 40defd0c4d rfkill: provide RFKILL_TYPE_FM if undefined
As discussed last year it's nice to be compatible to 2.6.32
https://www.spinics.net/lists/util-linux-ng/msg13963.html

BTW also re-define NUM_RFKILL_TYPES if needed, although we are
not really using it.

Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
2018-01-24 12:53:36 +01:00
Ruediger Meier 839203c00e tests: fix fincore/count KNOWN_FAIL
It has to be set after calling ts_init.

Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
2018-01-24 12:53:35 +01:00
root 20432749c1 tests: suppress warning for old sync(1)
Old sync(1) prints a warning which looks ugly among our
test output: "sync: ignoring all arguments"

Seen on travis, Ubuntu <= 14.04 (Trusty).

Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
2018-01-24 12:53:35 +01:00
Ruediger Meier 68ac426949 fsck.cramfs: fix error message
errno is invalid in case that we just read(3) too short.

Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
2018-01-24 12:53:34 +01:00
Ruediger Meier c990f94cbc tests: rewrite fsck-bad-header
Fix test for systems with pagesize != 4096
Loop over many combinations of sizes, endianness and blocksizes.

Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
2018-01-24 12:53:33 +01:00
Ruediger Meier 2374b1ab75 fsck.cramfs: fix crash when superblock size is too small
This hopefully fixes the original problem addressed by the reverted
patch 7cb962c7.

The bug was introduced by myself in
    f991dbd3 "fsck.cramfs: allow smaller superblock sizes"

CC: Tobias Stoeckmann <tobias@stoeckmann.org>
Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
2018-01-24 12:53:31 +01:00
Ruediger Meier 919e372da8 Revert "fsck.cramfs: Fix bus error on broken file system."
This reverts commit 7cb962c770.

It can't be right that we mmap (start + super.size) bytes from a file
which is usually only super.size bytes large. The patch "fixed" a
problem when super.size is bad but now it fails for the correct case:

$ mkdir -p root/subdir
$ ./mkfs.cramfs -p root cramfs
$ ./fsck.cramfs cramfs
Bus error (core dumped)

We will fix the original problem later.

CC: Tobias Stoeckmann <tobias@stoeckmann.org>
Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
2018-01-24 12:53:28 +01:00
Vaclav Dolezal 8273ef25fa tests: added missing expected outputs for partx (atari)
Signed-off-by: Vaclav Dolezal <vdolezal@redhat.com>
2018-01-24 12:20:11 +01:00
Vaclav Dolezal 1ca8fba830 libblkid: atari - fix bad variable name
Signed-off-by: Vaclav Dolezal <vdolezal@redhat.com>
2018-01-24 12:18:23 +01:00
Vaclav Dolezal 8326045ace tests: added test for libblkid atari pt
Signed-off-by: Vaclav Dolezal <vdolezal@redhat.com>
2018-01-23 17:02:41 +01:00
Vaclav Dolezal 50c71f25ff libblkid: Support for Atari partitioning scheme
Addresses: https://github.com/karelzak/util-linux/issues/517
Signed-off-by: Vaclav Dolezal <vdolezal@redhat.com>
2018-01-23 17:02:41 +01:00
Karel Zak c0b340bc99 tests: use subtests for weeknum cal(1) tests
Signed-off-by: Karel Zak <kzak@redhat.com>
2018-01-22 17:09:25 +01:00
Karel Zak 940b55ac4b tests: use subtests for weekarg cal(1) tests
Signed-off-by: Karel Zak <kzak@redhat.com>
2018-01-22 16:55:07 +01:00
Karel Zak 1b1f6f2511 test: use subtests for jan1753 cal(1) test
Signed-off-by: Karel Zak <kzak@redhat.com>
2018-01-22 16:54:06 +01:00
Karel Zak 5b9138d952 tests: merge year cal(1) tests
* merge tests
* use subtests for cal(1) calls

Signed-off-by: Karel Zak <kzak@redhat.com>
2018-01-22 16:01:14 +01:00
Karel Zak b0636cc11a tests: merge 1m and 3m cal(1) tests
* merge tests
* use subtests for cal(1) calls

Signed-off-by: Karel Zak <kzak@redhat.com>
2018-01-22 16:01:06 +01:00
Karel Zak a88564a061 tests: merge sep1752 cal(1) tests
* merge tests
* use subtests for cal(1) calls

Signed-off-by: Karel Zak <kzak@redhat.com>
2018-01-22 16:00:39 +01:00
Karel Zak 5c8324fb88 tests: use subtests for sep1752w test
Signed-off-by: Karel Zak <kzak@redhat.com>
2018-01-22 15:01:05 +01:00