Commit Graph

1277 Commits

Author SHA1 Message Date
Karel Zak 54ef08ed37 mkswap: support -U {clear,random,time,uuid}
Let's follow -U from mkfs.ext4 and make it easy to fully control
UUIDs for the swap area.

Fixes: https://github.com/karelzak/util-linux/issues/1453
Signed-off-by: Karel Zak <kzak@redhat.com>
2021-09-23 11:53:26 +02:00
Mario Blättermann e674323904 Man pages: Fix end extend formatting 2021-09-21 20:48:11 +02:00
Karel Zak f362b6c0ea Merge branch 'patch-2' of https://github.com/rffontenelle/util-linux
* 'patch-2' of https://github.com/rffontenelle/util-linux:
  asciidoc: unconstrained formatting pair in fdisk
2021-08-31 12:08:38 +02:00
Rafael Fontenelle 5f618ca4b2 asciidoc: unconstrained formatting pair in fdisk
Not using unconstrained witl result in showing asterisk instead, which is unwanted.
2021-08-30 07:25:20 -03:00
Rafael Fontenelle e3668f436c
asciidoc: fix quoted message in fsck.minix 2021-08-29 17:10:05 -03:00
Karel Zak 0c7e7cc4ec sfdisk: write empty label also when only ignored partition specified
sfdisk writes empty disk label only when "label:" header specified.
Unfortunately, this feature is ignored when all specified partitions
are ignored

  echo -e "label: dos\n0,0,0\n" | sfdisk /dev/sdc

Fixes: https://github.com/karelzak/util-linux/issues/1413
Signed-off-by: Karel Zak <kzak@redhat.com>
2021-08-19 12:10:02 +02:00
Karel Zak 28af0586b7 docs: fix info about LIBSMARTCOLS_DEBUG_PADDING
Signed-off-by: Karel Zak <kzak@redhat.com>
2021-08-10 10:14:22 +02:00
Karel Zak 8ad22184b5 Merge branch 'chs' of https://github.com/pali/util-linux
* 'chs' of https://github.com/pali/util-linux:
  fdisk: Add support for fixing MBR partitions CHS values
  libfdisk: (dos) Add function fdisk_dos_fix_chs() for fixing CHS values for all partitions
  libfdisk: (dos) Add function dos_partition_sync_chs() for updating CHS values
2021-08-02 10:40:10 +02:00
Pali Rohár 973c3fc753 fdisk: Add support for fixing MBR partitions CHS values
Add a new extended option 'F' to fdisk which recalculates and fixes CHS
values for each partition in MBR table according to current fdisk settings
for number of heads and sectors per track.

This allows in interactive mode to repair existing partitions to be
compatible with CHS addressing after changing extended option 'h' (number
of heads) or 's' (sectors per track) as these options do not modify content
of existing partitions.

Signed-off-by: Pali Rohár <pali.rohar@gmail.com>
2021-07-30 11:58:27 +02:00
Karel Zak 26266436c8 blockdev: use snprintf() rather than sprintf()
Signed-off-by: Karel Zak <kzak@redhat.com>
2021-07-27 12:51:43 +02:00
Thomas Abraham d73a71840b blockdev: allow for larger values for start sector
commit 9147d2ad8a ("blockdev: Don't fail on missing start sector") limits
the size of the start sector to 10 digits.

Multi-terrabyte devices can have partitions with a start sector larger than
10 digits, which will cause an sprintf() to abort due to overflowing the buffer.

It causes:
  # blockdev --report /dev/sda4
  RO    RA   SSZ   BSZ   StartSec            Size   Device
  *** buffer overflow detected ***: terminated
  Aborted (core dumped)
2021-07-22 15:43:13 -04:00
Pali Rohár f05a5bb2c2 fdisk: move reorder diag messages to fdisk_reorder_partitions()
The function fdisk_reorder_partitions() is also used in sfdisk and cfdisk
and these commands assume info/warn messages from the library. So move all
messages from fdisk to fdisk_reorder_partitions().

Signed-off-by: Pali Rohár <pali.rohar@gmail.com>
2021-07-13 00:40:00 +02:00
Pali Rohár b948bbf991 fdisk: do not print error message when partition reordering is not needed
Option 'f' currently prints following RED error message:

    Nothing to do. Ordering is correct already.
    Failed to fix partitions order.

This change removes RED error message when ordering is already correct.

Signed-off-by: Pali Rohár <pali.rohar@gmail.com>
2021-07-06 15:35:25 +02:00
Karel Zak 5efc31f9d8 cfdisk: optimize mountpoint detection for PARTUUID
Don't check fstab (and udev symplinks) for new UUIDs.

Fixes: https://github.com/karelzak/util-linux/issues/1331
Signed-off-by: Karel Zak <kzak@redhat.com>
2021-06-25 12:58:51 +02:00
Karel Zak 1d5c14ae1a misc: improve string to number conversions
Signed-off-by: Karel Zak <kzak@redhat.com>
2021-06-24 16:42:53 +02:00
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