Commit graph

1348 commits

Author SHA1 Message Date
Karel Zak
b0d4d09379 cfdisk: fix menu behavior after writing changes
Florian wrote:
  after a successful write, cfdisk remains on the "Write" cursor and
  furthermore when navigating to "Quit" will continue to  show
  "...without writing changes", despite there were writes. This patch
  addresses that.

Based on patch from Florian Zimmermann <florian.zimmermann@gmail.com>

Signed-off-by: Karel Zak <kzak@redhat.com>
2023-06-26 13:27:11 +02:00
Karel Zak
60c81b3272 sfdisk: add hint about duplicate UUIDs when use dump
Signed-off-by: Karel Zak <kzak@redhat.com>
2023-06-21 10:57:37 +02:00
Karel Zak
33e347832e lib: remove pager.c from libcommon
The libcommon is a binary archive to keep compilation and maintenance
simple. The library is not linked as shared or so. The unused symbols
are removed from binaries (for example, by "make install-strip").

But it isn't evident for license analyzers (and some humans) that the
library uses GPL and non-GPL stuff simultaneously. Let's avoid doubts
and keep pager.c (with GPL license) out of the archive

Signed-off-by: Karel Zak <kzak@redhat.com>
2023-06-20 13:15:45 +02:00
Karel Zak
793e8d2ab8 cfdisk: add hint about labels for bootable flag
Addresses: https://github.com/util-linux/util-linux/discussions/2220
Signed-off-by: Karel Zak <kzak@redhat.com>
2023-06-12 12:34:16 +02:00
Thomas Weißschuh
37b2b3fa46 misc: constify some fields
Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
2023-06-03 10:13:59 +02:00
Thomas Weißschuh
ae20b7fb4c blockdev: properly check for BLKGETZONESZ ioctl
Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
2023-05-31 16:11:46 +02:00
Hennie Botha
565eae0cf4
Update fsck.8.adoc
Typo
2023-05-31 08:45:25 +02:00
Karel Zak
96c8ff27a4 Merge branch 'next' 2023-05-29 14:56:52 +02:00
Thomas Weißschuh
c249602368 mkfs.minix: handle 64bit time on 32bit system
Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
2023-05-19 17:48:16 +02:00
Karel Zak
372e026e09 Merge branch 'mkswap/offset' of https://github.com/t-8ch/util-linux
* 'mkswap/offset' of https://github.com/t-8ch/util-linux:
  mkswap: implement --offset
  mkswap: (tests) don't overwrite logfiles
  mkswap: (tests) validate existence of truncate command
2023-05-17 13:27:55 +02:00
Karel Zak
976157c821 Merge branch 'blockdev/zonesz' of https://github.com/t-8ch/util-linux
* 'blockdev/zonesz' of https://github.com/t-8ch/util-linux:
  blockdev: add support for BLKGETZONESZ
2023-05-17 13:26:34 +02:00
Thomas Weißschuh
84ec6f99f7 mkswap: implement --offset
Addresses #2166

Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
2023-05-11 12:09:56 +02:00
Karel Zak
10d477ac78 fsck: use BLKID_SUBLKS_BADCSUM
We need to be a little bit more promiscuou in fsck to see also
inconsistent superblocks.

It would be possible to do not use libmount to ask for filesystem type
and ask directly libblkid, but libmount is also used to parse fstab
and search in the file and in this case it caches FS tags. It seems
better to continue with libmount to reduce overhead and keep the code
simple.

Addresses: https://github.com/util-linux/util-linux/issues/2214
Signed-off-by: Karel Zak <kzak@redhat.com>
2023-05-09 13:25:09 +02:00
Thomas Weißschuh
4832fd9f36 blockdev: add support for BLKGETZONESZ
Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
2023-05-05 10:57:52 +02:00
Karel Zak
ad6d9fd50c cfdisk: ask y/n before wipe
Addresses: https://github.com/util-linux/util-linux/issues/2160
Signed-off-by: Karel Zak <kzak@redhat.com>
2023-04-12 15:07:45 +02:00
Mario Blättermann
57746ff0eb
Fix markup in mkfs.cramfs.8.adoc (again)
There was one more *roff markup left in this file.
2023-03-16 13:35:37 +01:00
Mario Blättermann
d8416a9fd6 mkfs.cramfs: (man) Fix markup in makefs.cramfs.8.adoc
[kzak@redhat.com: - improve optional argument formatting]

Signed-off-by: Karel Zak <kzak@redhat.com>
2023-03-16 12:32:36 +01:00
Thomas Weißschuh
a5e94c1113 fdisk: document expected answers to quit message
Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
2023-02-19 16:13:49 +00:00
Karel Zak
b7e30e588f Merge branch 'chmod' of https://github.com/ferivoz/util-linux
* 'chmod' of https://github.com/ferivoz/util-linux:
  fsck.cramfs: fix error message
2023-01-26 17:00:28 +01:00
Samanta Navarro
18f96355de fsck.cramfs: check directory entry names
Do not accept slashes in names or the special entries "." and ".." in
directories while extracting files.

[kzak@redhat.com: - add errx_path() to report the path]

Signed-off-by: Samanta Navarro <ferivoz@riseup.net>
Signed-off-by: Karel Zak <kzak@redhat.com>
2023-01-26 16:58:32 +01:00
Samanta Navarro
aab25aef11 fsck.cramfs: fix error message
The error message for a failing chmod call contains chown as reason.
Fix this by stating that chmod failed.

Signed-off-by: Samanta Navarro <ferivoz@riseup.net>
2023-01-26 11:55:33 +00:00
Karel Zak
46768d677f Merge branch 'signal_safety' of https://github.com/crrodriguez/util-linux
* 'signal_safety' of https://github.com/crrodriguez/util-linux:
  sulogin: only assign to variables written by signal handlers
  hardlink: calling putchar is off-limits on a signal handler
  hardlink: last_signal should be a volatile sig_atomic_t
  pg: calling exit on signal handler is not allowed
  lib📟 fix signal safety issues
  write: signal_received should be volatile qualified
  flock: timeout_expired must be volatile qualified
  last: should not use errx/warnx on signal handlers
  su-common: bool is a distinct type in c2x
  fsck: only assign to cancel_requested
  fsck: use sig_atomic_t type fot signal handler global vars
2023-01-24 16:45:42 +01:00
Samanta Navarro
e0771b1b75 fsck.cramfs: print correct error on 32-bit systems
On 32-bit systems the file length check does not handle files correctly
which are larger than 4 GB. Use an unsigned long long which is already
in place for blkdev_get_size.

Proof of Concept:

- Prepare a file containing a CramFS
```
mkdir owo
mkfs.cramfs owo owo.iso
dd if=/dev/zero of=owo.iso bs=1 seek=4294967296 count=1 conv=notrunc
fsck.cramfs owo.iso
```

- Check the file
```
fsck.cramfs owo.iso
```

You will see: `fsck.cramfs: file length too short`
Better message is: `fsck.cramfs: file extends past end of filesystem`

Signed-off-by: Samanta Navarro <ferivoz@riseup.net>
2023-01-23 13:52:00 +01:00
Cristian Rodríguez
4302c9f624 fsck: only assign to cancel_requested
It may be mind bending mad but incrementing may require atomics,
only assign is warranted to work...
2023-01-15 01:33:13 +00:00
Cristian Rodríguez
3399995f60 fsck: use sig_atomic_t type fot signal handler global vars
because the standard says so.
2023-01-15 01:33:13 +00:00
Samanta Navarro
6c88722c17 mkswap: do not use uninitialized stack value
If blkdev_get_size fails, then size is not set. Exit with an error code
and indicate what went wrong instead of continuing with random stack
content.

Proof of Concept:

```
$ mkswap /dev/null
mkswap: warning: truncating swap area to 17179869180 KiB
mkswap: /dev/null: insecure permissions 0666, fix with: chmod 0600 /dev/null
mkswap: unable to assign device to libblkid probe
```

The first output line depends on stack content and sometimes does not
show up at all. Abort operation if argument is neither regular file nor
block device.

Signed-off-by: Samanta Navarro <ferivoz@riseup.net>
2023-01-13 11:54:54 +00:00
Thomas Weißschuh
4bbc219b07 mkswap: make context_string const
Sometimes context_str() return `const char *`.
2023-01-08 16:28:48 +00:00
Karel Zak
3a0a18f6f1 Merge branch 'blockdev' of https://github.com/t-8ch/util-linux
* 'blockdev' of https://github.com/t-8ch/util-linux:
  blockdev: add support for ioctl BLKGETDISKSEQ
2023-01-02 13:07:45 +01:00
Karel Zak
6a81d75b83 Merge branch 'meson-debian' of https://github.com/zeha/util-linux
* 'meson-debian' of https://github.com/zeha/util-linux:
  meson: install uuidd.rc with -Dsysvinit=enabled
  meson: fix pkg-config name of libaudit
  meson: fix build with -Dselinux=enabled
2023-01-02 12:23:11 +01:00
Thomas Weißschuh
c10adc203e blockdev: add support for ioctl BLKGETDISKSEQ 2022-12-28 12:33:49 +00:00
Chris Hofstaedtler
c07f7b4e4f meson: fix build with -Dselinux=enabled
Signed-off-by: Chris Hofstaedtler <zeha@debian.org>
2022-12-18 23:40:44 +01:00
Thomas Weißschuh
2a80192f02 mkswap: create files with specific endianness 2022-12-15 13:33:18 +00:00
Thomas Weißschuh
061282b2a4 cfdisk: prevent unused variables 2022-11-22 14:57:41 +01:00
Karel Zak
897e545002 sfdisk: (man) fix man page move example
Fixes: #1902
Signed-off-by: Karel Zak <kzak@redhat.com>
2022-11-14 13:12:53 +01:00
Karel Zak
3e8228b228 fdisk: make it more obvious that DOS means MBR
Fixes: https://github.com/util-linux/util-linux/issues/1890
Signed-off-by: Karel Zak <kzak@redhat.com>
2022-11-10 09:24:23 +01:00
Karel Zak
55ef593842 fdisk: fix --output option parsing
Fixes: https://github.com/util-linux/util-linux/issues/1859
Addresses: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1022249
Signed-off-by: Karel Zak <kzak@redhat.com>
2022-10-24 09:57:07 +02:00
Karel Zak
bd0c8c85e6 mkfs.bfs, mkfs.cramfs: cleanup optional argument use
* fix --help
* fix getopt() call

Signed-off-by: Karel Zak <kzak@redhat.com>
2022-10-18 12:47:39 +02:00
Karel Zak
b80a9be332 Merge branch 'autotools/endianess' of https://github.com/t-8ch/util-linux
* 'autotools/endianess' of https://github.com/t-8ch/util-linux:
  autotools: stop using AC_C_BIGENDIAN / WORDS_BIGENDIAN
2022-10-17 10:15:28 +02:00
root
57fdc17c92 mkfs.cramfs: Support BSD lock
Addresses: #1842 #921
Signed-off-by: Karel Zak <kzak@redhat.com>
2022-10-17 09:38:07 +02:00
plus
cc4fefc635 mkfs.bfs: Support BSD lock
Addresses: #1842 #921
Signed-off-by: Karel Zak <kzak@redhat.com>
2022-10-17 09:36:56 +02:00
zhanchengbin
240f2ea957 fsck: Processes may kill other processes.
A error in disk-utils/fsck.c, if run the fsck -N command, processes
don't execute, just show what would be done. However, the pid whose
value is -1 is added to the instance_list list in the execute
function,if the kill_all function is called later, kill(-1, signum)
is executed, Signals are sent to all processes except the number one
process and itself. Other processes will be killed if they use the
default signal processing function.

Signed-off-by: zhanchengbin <zhanchengbin1@huawei.com>
Reviewed-by: Lukas Czerner <lczerner@redhat.com>
2022-10-17 09:12:14 +02:00
Thomas Weißschuh
83b418c19c autotools: stop using AC_C_BIGENDIAN / WORDS_BIGENDIAN
This define is specific to autotools. Not defining the macro will lead
to silently miscompiled code as has happened with the meson build.

Instead use macros provided by the compiler itself. It does not need any
support from the buildsystem and is supported by both gcc and clang.

If a compiler does not support this feature we will get a loud error
instead of silent miscompilation.

Furthermore it probably better supports universal binaries on macOS
which compiles multiple architectures in a single build.
2022-10-14 22:00:48 +02:00
Karel Zak
a6a76a5a3e sfdisk: inform about failed fsync() [coverity scan]
Signed-off-by: Karel Zak <kzak@redhat.com>
2022-08-11 13:14:18 +02:00
Karel Zak
a8bc53cbd1 sfdisk: improve code readability for coverity scan
Signed-off-by: Karel Zak <kzak@redhat.com>
2022-08-11 13:04:58 +02:00
Karel Zak
b3d80e6371 sfdisk: (man) fix sector-size description
Addresses: https://github.com/util-linux/util-linux/issues/1744
Signed-off-by: Karel Zak <kzak@redhat.com>
2022-07-11 19:51:21 +02:00
Karel Zak
c417ce68e4 sfdiks: (man) fix example
Fixes: https://github.com/util-linux/util-linux/discussions/1719
Signed-off-by: Karel Zak <kzak@redhat.com>
2022-06-20 13:42:35 +02:00
Rosen Penev
710e8ecb9f fix various formats
Found with -Wformat.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
2022-05-10 13:36:58 -07:00
Karel Zak
9ae0289e81 partx: remove memory leak to make scanners happy [coverity scan]
Signed-off-by: Karel Zak <kzak@redhat.com>
2022-03-17 11:22:29 +01:00
Karel Zak
30cc5f5751 cfdisk: don't use NULL in printf [coverity scan]
Signed-off-by: Karel Zak <kzak@redhat.com>
2022-03-17 10:48:33 +01:00
Mario Blättermann
bd67ca4480 Fix several adoc files as reported by Helge Kreutzmann 2022-02-13 19:26:07 +01:00