Commit Graph

18719 Commits

Author SHA1 Message Date
Karel Zak d8379563fe Merge branch 'refine-the-choice-of-stream-related-functions-in-usage' of https://github.com/masatake/util-linux
* 'refine-the-choice-of-stream-related-functions-in-usage' of https://github.com/masatake/util-linux:
  Make the ways of using output stream consistent in usage()
  Use fputs instead of fprintf if possible
2023-10-25 11:37:21 +02:00
Karel Zak 7b4c62b0d5 Merge branch 'umount/recursive-bind' of https://github.com/t-8ch/util-linux
* 'umount/recursive-bind' of https://github.com/t-8ch/util-linux:
  umount: handle bindmounts during --recursive
  mount: (tests) don't create /dev/nul
2023-10-25 11:34:43 +02:00
Karel Zak 765a39dad5 tests: fix memory leak in scols fromfile
Signed-off-by: Karel Zak <kzak@redhat.com>
2023-10-24 20:13:29 +02:00
Masatake YAMATO bad4c72948 Make the ways of using output stream consistent in usage()
Signed-off-by: Masatake YAMATO <yamato@redhat.com>
2023-10-25 02:21:45 +09:00
Masatake YAMATO 38b8eac6eb Use fputs instead of fprintf if possible
Signed-off-by: Masatake YAMATO <yamato@redhat.com>
2023-10-25 01:41:58 +09:00
Karel Zak 24947d367e libsmartcols: fix uninitialized local variable in sample
Signed-off-by: Karel Zak <kzak@redhat.com>
2023-10-23 21:54:01 +02:00
Karel Zak d585a4159d libsmartcols: add wrap-zero test
* modify samples/fromfile.c to use scols_wrapzero_nextchunk() callback
  if "wrapzero" specified for the test colum
* add col-wrapzero and data-string-zero to define the column and zero
  separated data

Signed-off-by: Karel Zak <kzak@redhat.com>
2023-10-23 21:54:01 +02:00
Karel Zak 301d02816f libsmartcols: support \x?? for data by samples/fromfile.c
The test (sample) binary already supports \n in strings to covert it
to the real line-break. It seem more generic to use \x?? (hex) to
support arbitrary byte in the column data.

Signed-off-by: Karel Zak <kzak@redhat.com>
2023-10-23 21:54:01 +02:00
Karel Zak fa4e693983 libsmartcols: add new functions to API docs
Signed-off-by: Karel Zak <kzak@redhat.com>
2023-10-23 21:54:01 +02:00
Karel Zak 295bbcf676 findmnt: use zero to separate lines in multi-line cells
Fixes: https://github.com/util-linux/util-linux/issues/2533
Signed-off-by: Karel Zak <kzak@redhat.com>
2023-10-23 21:54:01 +02:00
Karel Zak a9c1e5e58d libsmartcols: improve cell data preparation for non-wrapping cases
Signed-off-by: Karel Zak <kzak@redhat.com>
2023-10-23 21:54:00 +02:00
Karel Zak b24cdac1e7 libsmartcols: add --{export,raw,json} to wrap sample
Signed-off-by: Karel Zak <kzak@redhat.com>
2023-10-23 21:54:00 +02:00
Karel Zak e2e94816c8 libsmartcols: make calculation more robust
* add debug messages
* make columns stat debug more compact
* default to zero if data undefined
* fix "extreme" column enlarging

Signed-off-by: Karel Zak <kzak@redhat.com>
2023-10-23 21:54:00 +02:00
Karel Zak c5310d4a31 libsmartcols: reset cell wrapping if all done
Signed-off-by: Karel Zak <kzak@redhat.com>
2023-10-23 21:54:00 +02:00
Karel Zak 2eab8ab486 lsblk: use zero to separate lines in multi-line cells
Fixes: https://github.com/util-linux/util-linux/issues/2533
Signed-off-by: Karel Zak <kzak@redhat.com>
2023-10-23 21:54:00 +02:00
Karel Zak 9ab58a4301 libsmartcols: add support for zero separated wrap data
Signed-off-by: Karel Zak <kzak@redhat.com>
2023-10-23 21:54:00 +02:00
Karel Zak c57e73eac9 libsmartcols: add scols_cell_refer_memory()
* allow to use non-string data
* use memcpy() rather than strdup() for data

Signed-off-by: Karel Zak <kzak@redhat.com>
2023-10-23 21:54:00 +02:00
Karel Zak 958d0b7fbc libsmartcols: always print vertical symbol
Signed-off-by: Karel Zak <kzak@redhat.com>
2023-10-23 21:54:00 +02:00
Karel Zak e222a23f11 libsmartcols: multi-line cells refactoring
* move data wrapping code to column.c
* do data wrapping on one place when copy cell data to buffer
* use table cursor in affected functions
* calculate tree ASCII-art to wrapped data
* mark wrap_chunksize() callback as deprecated; library calculates
  the size itself from real data

Signed-off-by: Karel Zak <kzak@redhat.com>
2023-10-23 21:54:00 +02:00
Karel Zak 97448130fe libsmartcols: add table cursor
The cursor makes it simple for callbacks to access information about
the current cell, line and column. It will reduce number of necessary
arguments for callbacks.

Signed-off-by: Karel Zak <kzak@redhat.com>
2023-10-23 21:54:00 +02:00
Karel Zak 6b7247411d lib/mbsalign: calculate size of decoded string
The "safe" encoding replaces each unsafe byte with \x<hex>, the new
function mbs_safe_decoded_size() calculates the original size of the
string.

Signed-off-by: Karel Zak <kzak@redhat.com>
2023-10-23 21:54:00 +02:00
Karel Zak f9ba5fa0ca lib/buffer: make buffer usable for non-string data
Signed-off-by: Karel Zak <kzak@redhat.com>
2023-10-23 21:54:00 +02:00
Karel Zak 357e6a0efc lib/strutils: add ul_next_string()
The function jumps to the next string in buffer where strings are
separated by \0.

Signed-off-by: Karel Zak <kzak@redhat.com>
2023-10-23 21:54:00 +02:00
Karel Zak c2f3f40ecc Merge branch 'master' of https://github.com/Connor-GH/util-linux
* 'master' of https://github.com/Connor-GH/util-linux:
  Fix man page for col to correct documentation error
  Update col.c to fix option mistake
2023-10-23 12:50:22 +02:00
Karel Zak 4cb795965d Merge branch 'libblkid/vxfs/cleanup' of https://github.com/t-8ch/util-linux
* 'libblkid/vxfs/cleanup' of https://github.com/t-8ch/util-linux:
  libblkid: (vxfs) simplify prober
  libblkid: (superblocks) add helper blkid32_to_cpu()
  libblkid: (vxfs) use hex escape for magic
  libblkid: (vxfs) add test files
2023-10-23 12:47:19 +02:00
Karel Zak b65edc8ada Merge branch 'wdctl/sysfs' of https://github.com/t-8ch/util-linux
* 'wdctl/sysfs' of https://github.com/t-8ch/util-linux:
  wdctl: use only sysfs if sufficient
2023-10-23 12:37:19 +02:00
Karel Zak e0ff28712f Merge branch 'libmount/null-api' of https://github.com/t-8ch/util-linux
* 'libmount/null-api' of https://github.com/t-8ch/util-linux:
  libmount: guard against sysapi == NULL
2023-10-23 12:35:57 +02:00
Karel Zak 42f7e2641e Merge branch 'PR/lscpu-caches-sep' of github.com:karelzak/util-linux-work
* 'PR/lscpu-caches-sep' of github.com:karelzak/util-linux-work:
  lscpu: fix caches separator for --parse=<list>
2023-10-23 12:35:34 +02:00
Karel Zak 1c8e42e2e3 Merge branch 'chfn_gecos' of https://github.com/mator/util-linux
* 'chfn_gecos' of https://github.com/mator/util-linux:
  Use empty libuser config file.
2023-10-23 12:34:56 +02:00
Karel Zak 03133e822d Merge branch 'topic-fix-fail-to-find-exfat-volume-label' of https://github.com/YuezhangMo/util-linux
* 'topic-fix-fail-to-find-exfat-volume-label' of https://github.com/YuezhangMo/util-linux:
  libblkid: exfat: fix fail to find volume label
2023-10-23 12:32:58 +02:00
Karel Zak 89972f74a8 Merge branch 'misc/fixes' of https://github.com/t-8ch/util-linux
* 'misc/fixes' of https://github.com/t-8ch/util-linux:
  meson: don't try to build test_ca without libcap-ng
  blkpr: store return value of getopt_long in int
2023-10-23 12:29:50 +02:00
Karel Zak e15518d0dd Merge branch 'meson/int-cmp' of https://github.com/t-8ch/util-linux
* 'meson/int-cmp' of https://github.com/t-8ch/util-linux:
  meson: avoid int operation with non-int
2023-10-23 12:28:26 +02:00
Karel Zak ed263d9173 Merge branch 'path' of https://github.com/stoeckmann/util-linux
* 'path' of https://github.com/stoeckmann/util-linux:
  sys-utils/lscpu: Use ul_path_scanf where possible
  lib/path: Set errno in case of fgets failure
  lib/path: fix typos
  lib/path: remove ul_prefix_fopen
  lib/path: set errno in case of error
  lib/path: fix possible out of boundary access
2023-10-23 12:26:45 +02:00
Karel Zak aa90cceafd Merge branch 'login-simplify' of https://github.com/stoeckmann/util-linux
* 'login-simplify' of https://github.com/stoeckmann/util-linux:
  login: access login.noauth file directly
  login: use xasprintf
2023-10-23 12:23:51 +02:00
Connor-GH 5fbfa64eb4
Fix man page for col to correct documentation error 2023-10-21 17:58:36 -05:00
Connor-GH 77bf9737bb
Update col.c to fix option mistake 2023-10-21 17:55:49 -05:00
Thomas Weißschuh 2008287928 umount: handle bindmounts during --recursive
Fixes #2551

Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
2023-10-17 18:07:21 +02:00
Thomas Weißschuh cdd1ad7d7b mount: (tests) don't create /dev/nul
Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
2023-10-17 18:07:05 +02:00
Thomas Weißschuh 6de3def84c wdctl: use only sysfs if sufficient
Also avoid opening device if nowayout is set.

Opening the device node starts the watchdog.
With 'nowayout' enabled unstoppably.

Also the device node can only be opened once at the same time which can
be problematic.

Prefer to retrieve the information via sysfs which does not have such
problems.

Fixes #2543

Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
2023-10-14 12:58:04 +02:00
Thomas Weißschuh dc9642802e libblkid: (vxfs) simplify prober
Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
2023-10-14 12:57:26 +02:00
Thomas Weißschuh 5a60209f01 libblkid: (superblocks) add helper blkid32_to_cpu()
Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
2023-10-14 12:57:26 +02:00
Thomas Weißschuh 522af0ff51 libblkid: (vxfs) use hex escape for magic
It's easier to read and more consistent.

Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
2023-10-14 12:57:26 +02:00
Thomas Weißschuh 10ded1a81a libblkid: (vxfs) add test files
The test files have been constructed manually from the prober.
While not providing a real test at least they make sure that the
existing logic stays stable.

Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
2023-10-14 12:57:21 +02:00
Thomas Weißschuh 2adad194ca libmount: guard against sysapi == NULL
Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
2023-10-13 10:17:16 +02:00
Karel Zak 369c89e78e lscpu: fix caches separator for --parse=<list>
Fixes: https://github.com/util-linux/util-linux/issues/2544
Signed-off-by: Karel Zak <kzak@redhat.com>
2023-10-13 00:03:15 +02:00
Anatoly Pugachev cff4e5a68b Use empty libuser config file.
In case of an absence /etc/libuser.conf, use empty file by pointing
LIBUSER_CONF to /dev/null. This allows chfn/gecos to pass without error.

PS: The "libuser" library is no longer maintained, and it was recommended
by the original author to not use it anymore.
2023-10-12 14:13:02 +03:00
Thomas Weißschuh 512c91a647 meson: don't try to build test_ca without libcap-ng
Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
2023-10-11 16:35:45 +02:00
Yuezhang Mo 07b2450d1e libblkid: exfat: fix fail to find volume label
Commit f98b56326 set the maximum number of iterations to 10000.
If the volume label is after the 10000th entry, the volume label
will not be found. So this commit sets the maximum number of
iterations to correct value 256×1024×1024/32.

Fixes: f98b56326 ("libblkid: [exfat] Limit maximum number of iterations in find_label")

Signed-off-by: Yuezhang Mo <Yuezhang.Mo@sony.com>
Reviewed-by: Andy Wu <Andy.Wu@sony.com>
Reviewed-by: Aoyama Wataru <wataru.aoyama@sony.com>
2023-10-11 19:02:14 +08:00
Thomas Weißschuh 95d33617cf blkpr: store return value of getopt_long in int
getopt_long returns an int. Don't try to store it in a char.

See #2538.

Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
2023-10-11 07:20:43 +02:00
Tobias Stoeckmann 9fa970fb94 sys-utils/lscpu: Use ul_path_scanf where possible
Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
2023-10-10 21:08:41 +02:00