Commit Graph

1262 Commits

Author SHA1 Message Date
Karel Zak 2ce856993b fsck: do not use atoi()
Addresses: https://github.com/karelzak/util-linux/issues/1358
Signed-off-by: Karel Zak <kzak@redhat.com>
2021-06-22 14:49:35 +02:00
Karel Zak 4077526856 blockdev: improve arguments parsing (remove atoi)
old version:
 # blockdev --setfra 4x096 /dev/sdc

new version:
 # blockdev --setfra 4x096 /dev/sdc
 blockdev: failed to parse command argument: '4x096'

Addresses: https://github.com/karelzak/util-linux/issues/1358
Signed-off-by: Karel Zak <kzak@redhat.com>
2021-06-22 12:32:58 +02:00
Karel Zak 94a5b2e84f cfdisk: do not use atoi()
It's unnecessary to use atoi in this case.

Addresses: https://github.com/karelzak/util-linux/issues/1358
Signed-off-by: Karel Zak <kzak@redhat.com>
2021-06-22 11:50:06 +02:00
Karel Zak d8a42b67c8 fsck: check errno after strto..()
Addresses: https://github.com/karelzak/util-linux/issues/1356
Signed-off-by: Karel Zak <kzak@redhat.com>
2021-06-21 15:29:43 +02:00
Karel Zak c6f3632905 fsck.cramfs: use open+fstat rather than stat+open
Fixes: https://github.com/karelzak/util-linux/issues/1353
Signed-off-by: Karel Zak <kzak@redhat.com>
2021-06-21 12:39:33 +02:00
Karel Zak fbae144212 libfdisk: add and fix __format__ attributes
Reported-by: Jan Pazdziora <jpazdziora@redhat.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
2021-06-18 16:42:57 +02:00
Christian Bartolomäus 89456be777
Fix some brackets in synopses 2021-06-17 22:27:17 +02:00
Karel Zak 2384fa6e4d mkfs.cramfs: add comment to explain readlink() use
Signed-off-by: Karel Zak <kzak@redhat.com>
2021-06-17 13:26:50 +02:00
Karel Zak 8a3a74160b mkswap: fix holes detection (infinite loop and/or stack-buffer-underflow)
Reported-by: Brian Lane <bcl@redhat.com>
Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=1971877
Fix: https://github.com/karelzak/util-linux/issues/1348
Signed-off-by: Karel Zak <kzak@redhat.com>
2021-06-15 12:07:34 +02:00
Karel Zak 868cd0dc0a fsck: use mnt_fs_is_regularfs()
Signed-off-by: Karel Zak <kzak@redhat.com>
2021-06-02 12:16:14 +02:00
Karel Zak 3773bb151a mkswap: remove unused variable when compile without libblkid
Signed-off-by: Karel Zak <kzak@redhat.com>
2021-05-07 20:37:51 +02:00
Karel Zak c13ce8f4d6 fsck: fix time_t=long assumptions
References: ce3355cc54
Signed-off-by: Karel Zak <kzak@redhat.com>
2021-05-06 10:40:32 +02:00
Karel Zak d8d54e4bfc build-sys: keep adoc files in dist_noinst_DATA
* rename MANPAGES_EXTRA= to ADOCFILES_COMMON=

* keep track about individual adoc files by dist_noinst_DATA=
  This variable is not effected by automake conditions, so the files
  are always distributed.

Signed-off-by: Karel Zak <kzak@redhat.com>
2021-05-05 13:35:30 +02:00
Karel Zak e5bde19ae2 build-sys: cleanup Makefiles
Signed-off-by: Karel Zak <kzak@redhat.com>
2021-04-20 14:39:32 +02:00
Karel Zak dee0c29c6f fdisk: warn if disk in use
Fixes: https://github.com/karelzak/util-linux/issues/1278
Signed-off-by: Karel Zak <kzak@redhat.com>
2021-04-15 14:43:15 +02:00
Karel Zak d527e8cf70 cfdisk: warn if disk on use
Fixes: https://github.com/karelzak/util-linux/issues/1278
Signed-off-by: Karel Zak <kzak@redhat.com>
2021-04-15 14:39:11 +02:00
Karel Zak a970c2dd51 fdisk: always skips zeros in dumps
The expert command 'D'ump skips zeros when print label hexdump on
terminal, but for non-terminal it prints all buffer. It seems
better to use the same semantic everywhere and skip zeros.

Signed-off-by: Karel Zak <kzak@redhat.com>
2021-04-08 12:42:36 +02:00
Karel Zak 53b37016c3 meson: generate man pages from asciidoc
Signed-off-by: Karel Zak <kzak@redhat.com>
2021-04-06 15:32:46 +02:00
Karel Zak 625e9c61e8 build-sys: make man pages location independent
We need to evaluate "include::" directive relatively to project
top-level source directory rather than to the current document
location.

Signed-off-by: Karel Zak <kzak@redhat.com>
2021-03-31 11:50:47 +02:00
Karel Zak 25ce8fb1ed Merge remote-tracking branch 'mariobl/topic/asciidoc'
* mariobl/topic/asciidoc: (71 commits)
  Asciidoc: Update .pot template
  Asciidoc: Reorder example command sequence
  Asciidoc: Update .pot template
  Asciidoc: Better gettext message splitting in nsenter.1.adoc
  Asciidoc: Update .pot template
  Asciidoc: Fix typo and remove invisible spaces which confuse po4a
  Asciidoc: Update .pot template
  Asciidoc: Fix typo
  Asciidoc: Fix artifact from initial import, sixth attempt
  Asciidoc: Update .pot template
  Asciidoc: Fix artifacts from initial import, fifth attempt
  Asciidoc: Fix artifacts from initial import, fourth attempt
  Asciidoc: Update .pot template
  Asciidoc: Fix artifacts from initial import, third attempt
  Asciidoc: Fix artifacts from initial import, second attempt
  Asciidoc: Fix artifacts from initial import
  Asciidoc: Add po4a config file and initial translation template for man pages
  Asciidoc: Small indentation fix in mount.8.adoc
  Asciidoc: Review sys-utils man pages, part 2
  build-sys: fix out-of-tree build
  ...

Signed-off-by: Karel Zak <kzak@redhat.com>
2021-03-29 15:09:27 +02:00
Mario Blättermann ab3e786dd1 Asciidoc: Fix artifact from initial import, sixth attempt 2021-03-27 00:10:27 +01:00
Mario Blättermann b53360d8a8 Asciidoc: Fix artifacts from initial import 2021-03-26 20:12:42 +01:00
Karel Zak 4f79d3032e build-sys: split man pages and man page links
The symlinks are generated by asciidoctor and current dist_man_MANS
depends on order (nan page before man link). This solutions is useless
when execute "make -j". The real solution is to keep man pages in
separate variable and use only this variable evaluate what we need to
generate.

Signed-off-by: Karel Zak <kzak@redhat.com>
2021-03-26 11:49:59 +01:00
Karel Zak 8207f99b7a sfdisk: fix resources leak [coverity scan]
Signed-off-by: Karel Zak <kzak@redhat.com>
2021-03-25 10:25:12 +01:00
Mario Blättermann 299604dd0b Asciidoc: Review disk-utils man pages 2021-03-24 18:53:27 +01:00
Mario Blättermann f37298c2c2 Asciidoc: Yet another formatting fix 2021-03-21 18:24:47 +01:00
Mario Blättermann 99157f44da Asciidoc: Formatting cleanup 2021-03-21 13:02:56 +01:00
Mario Blättermann 295b3979d9 Asciidoc: Add Po4a hint to file headers 2021-03-20 16:42:47 +01:00
Mario Blättermann d315cc4d96 Asciidoc: Re-add empty lines to man pages 2021-03-19 20:52:00 +01:00
Mario Blättermann 4d29743519 Asciidoc: Some formatting cleanup in man pages 2021-03-19 18:25:50 +01:00
Karel Zak 308a097968 meson: update sources and dependencies
Signed-off-by: Karel Zak <kzak@redhat.com>
2021-03-17 15:07:27 +01:00
Zbigniew Jędrzejewski-Szmek d4c880d5a4 meson: add second build system
To build: meson build && ninja -C build
To run tests: ninja -C build check
To install for packaging: DESTDIR=/var/tmp/inst ninja -C build install
To install for realz: sudo ninja -C build install

v2:
- Optional items are now based on the 'feature' feature in meson.
  Built libraries which are disabled turn into disabler() objects
  and also poison any executables which link to them.

What is there:
- building of the binaries and libs and the python module
- installation of binaries, libs, python module, localization files,
  man pages, pkgconfig files
- running of tests
- most options to configure build equivalently to the
  ./configure settings

Partially implemented:
- disabling of stuff when things missing. In the C code, the defines
  are all used, so that should be fine. In the build system, some
  files should be skipped, but that is probably not always done properly.
  Getting this right might require some testing of various build option
  combinations to get the details right.

Not implemented:
- static builds of fdisk and other binaries
- things marked with XXX or FIXME
- ???

Differences:
- .la files are not created. They are useless and everybody hates them.
- Requires.private in pkgconfig files are not present in the
  autogenerated .pc file. Not sure if they should be there or not. If
  necessary, they can be added by hand.
- man pages and systemd units are installed by the install target. Not
  sure why 'make install' doesn't do that.
- the split between / and /usr is probably wrong. But it's all pointless
  anyway, so maybe we could simplify things but not implementing it at
  all under meson?
2021-03-17 15:07:27 +01:00
Mario Blättermann 47a2685b44 Asciidoc: Remove already imported disk-utils *roff man pages 2021-03-16 21:13:57 +01:00
Mario Blättermann c6a568fccb Asciidoc: Import disk-utils man pages 2021-03-16 21:08:43 +01:00
Karel Zak 347332796f fdisk: (man) add info about order for -l
Reported-by: Dan Jacobson <jidanni@jidanni.org>
Signed-off-by: Karel Zak <kzak@redhat.com>
2021-03-08 10:56:47 +01:00
Karel Zak 8d720dbed6 fdisk: support partition type name in dialogs
Command (m for help): t

Selected partition 1
Partition type or alias (type L to list all): linux root x86
Changed type of partition 'Linux /usr (x86)' to 'Linux root (x86)'.

Signed-off-by: Karel Zak <kzak@redhat.com>
2021-02-23 09:25:57 +01:00
Karel Zak 45c2daa612 sfdisk: support for type="partition type name"
For example:

 # echo 'size=10MiB, type="linux usr x86"' | sfdisk /dev/sdc
 ...
 New situation:

 Device     Start   End Sectors Size Type
 /dev/sdc1   2048 22527   20480  10M Linux /usr (x86)

Signed-off-by: Karel Zak <kzak@redhat.com>
2021-02-23 09:25:36 +01:00
ToddRK deba6720fb fsck.cramfs: fix fsck.cramfs crashes on blocksizes > 4K
fsck.cramfs crashes when extracting a cramfs image with a 16KB blocksize.
The read_buffer is hardcoded for a 4KB blocksize.  When using a blocksize
larger than 4KB, the program's code uses indexes that go past the end of the
allocated space for the read_buffer and this causes the crash.

The following changes fix the problem for me in the latest 2.36.1 release of
fsck.cramfs.c.  However there are hardcoded values of 4096 in the code that
might cause problems under other circumstances and I have not attempted to
fix those.

[kzak@redhat.com: - some coding style changes to code]

Fixes: https://github.com/karelzak/util-linux/issues/1232
Signed-off-by: ToddRK <ToddRK@example.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
2021-01-28 12:46:49 +01:00
Karel Zak b105446e69 mkswap: remove deprecated SELinux matchpathcon()
Signed-off-by: Karel Zak <kzak@redhat.com>
2021-01-13 14:58:43 +01:00
Karel Zak ca27216aa6 build-sys: remove fallback for security_context_t
It seems like overkill to provide this #ifdef. For example coreutils
use "char *" for all selinux contexts (since 2014).

Signed-off-by: Karel Zak <kzak@redhat.com>
2021-01-13 13:12:19 +01:00
Karel Zak 4b447adf50 Merge branch '2020wk47' of https://github.com/kerolasa/util-linux
* '2020wk47' of https://github.com/kerolasa/util-linux:
  build-sys: sort various lists in configure.ac
  mkswap: tell how to fix insecure permissions and owner in warning
  lsipc: make default output byte sizes to be in human units
  man: add missing backslash to caret printing macro
  lscpu: fix variable shadowing
  uuidgen: give hint in usage() what uuid namepaces can be used
  uuidgen: use errx() rather than fprintf() when priting errors
  libuuid: simplify uuid_is_null() check
  uuidparse: use uuid type definitions from libuuid header
  uuidparse: use libuuid function to test nil uuid
2021-01-05 15:20:50 +01:00
Karel Zak c15899c1cb cfdisk: (man) add info when cfdisk writes to the device
This is difference between (c)fdisk and GNU Parted, fdisks keep all
changes in memory until user explicitly ask for write operation.

Addresses: https://github.com/karelzak/util-linux/pull/1227
Signed-off-by: Karel Zak <kzak@redhat.com>
2021-01-05 14:43:01 +01:00
Karel Zak 0257109c33 Merge branch 'disk-utils-document-resize' of https://github.com/vdmz/util-linux 2021-01-05 14:32:22 +01:00
Chris Hofstaedtler 45be288c8f cfdisk: show Q option when choosing label type
The new message is quite terse, but fits into 78 characters.

Bug-Debian: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=894555
Signed-off-by: Chris Hofstaedtler <zeha@debian.org>
2021-01-05 12:53:51 +01:00
Karel Zak 1b39cd7f63 Merge branch 'spelling' of https://github.com/scop/util-linux
* 'spelling' of https://github.com/scop/util-linux:
  *: spelling and grammar fixes
2021-01-04 13:42:08 +01:00
Dmitriy Chestnykh 0d182490e3 cfdisk: Implemented cfdisk's opening in read-only mode
[kzak@redhat.com: - clean up the patch
                  - add note "Changes will remain in memory only."]

Addresses: https://github.com/karelzak/util-linux/issues/1209
Addresses: https://github.com/karelzak/util-linux/pull/1213
Signed-off-by: Karel Zak <kzak@redhat.com>
2021-01-04 12:17:57 +01:00
Vincent McIntyre c186e148ea Show the 'r' option in the help menu 2021-01-02 11:02:35 +11:00
Vincent McIntyre 3e01d4a24d Manual pages: document the 'resize' command
Reported in https://bugs.debian.org/906918, https://bugs.debian.org/915971.

Signed-off-by: Vincent McIntyre <vincent.mcintyre@csiro.au>
2021-01-01 13:37:52 +11:00
Sami Kerola 8d6877239c
mkswap: tell how to fix insecure permissions and owner in warning
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2020-12-28 09:53:13 +00:00
Ville Skyttä 3c56068609 *: spelling and grammar fixes 2020-12-17 23:39:05 +02:00