Commit Graph

13985 Commits

Author SHA1 Message Date
Karel Zak 3239663361 Merge branch 'master' of https://github.com/pali/util-linux
* 'master' of https://github.com/pali/util-linux:
  tests: Add UDF hdd image with emoji label created by mkudffs 2.2
  libblkid: Fix UTF-16 support in function blkid_encode_to_utf8()
2020-02-10 13:51:23 +01:00
Karel Zak f88034e818 tests: add sfdisk --dump test
Signed-off-by: Karel Zak <kzak@redhat.com>
2020-02-10 13:20:04 +01:00
Pali Rohár ef111c0b3e tests: Add UDF hdd image with emoji label created by mkudffs 2.2
mkudffs 2.2 can create UDF filesystem which label contains Unicode code
points above U+FFFF which cannot be represented by UCS-2 encoding and
therefore UTF-16 needs to be used (via surrogate pairs). Unicode code
points above U+FFFF are encoded in UTF-8 by four bytes and some example is
emoji "😀".

This is test case to check that libblkid correctly supports UTF-16
decoding. It was created by mkudffs 2.2:

$ dd if=/dev/zero of=udf-hdd-mkudffs-2.2.img bs=1M count=10
$ mkudffs -l 😀 udf-hdd-mkudffs-2.2.img
2020-02-09 13:04:39 +01:00
Pali Rohár f8b9b74394 libblkid: Fix UTF-16 support in function blkid_encode_to_utf8()
Function blkid_encode_to_utf8() says that is supports BLKID_ENC_UTF16LE and
BLKID_ENC_UTF16BE encodings, but it is not truth and supports only UCS-2
(and not full UTF-16).

As all places where BLKID_ENC_UTF16LE and BLKID_ENC_UTF16BE is used expects
UTF-16 and not UCS-2, this patch changes implementation of encodings
BLKID_ENC_UTF16LE and BLKID_ENC_UTF16BE to supports full UTF-16, including
surrogate pairs and not only UCS-2.
2020-02-09 13:04:34 +01:00
Karel Zak b7c015d1c5 libfdisk: (docs) fix typos
Signed-off-by: Karel Zak <kzak@redhat.com>
2020-02-05 14:50:05 +01:00
Karel Zak ee5a160250 sfdisk: add --relocate command
This command allows to relocate GPT backup header behind last
partition (--relocate gpt-bak-mini) or to standard position
(--relocate gpt-bak-std).

Hint: use "fdisk --list-details" to see "Alternative LBA".

Signed-off-by: Karel Zak <kzak@redhat.com>
2020-02-05 14:40:45 +01:00
Karel Zak 387ac2771f libfdisk: (gpt) add functionality to move backup header
- add fdisk_gpt_disable_relocation() to disable move backup header to standard location

- add fdisk_gpt_enable_minimize() to move backup header behind last partition

Note that fdisk_gpt_disable_relocation() has to be used before fdisk_assign_device(),
because automatic relocation is done when libfdisk reads the header from the device.

For example:
	lb = fdisk_get_label(cxt, "gpt");

	fdisk_gpt_disable_relocation(lb, 1);
	fdisk_assign_device(cxt, devname, 0);

For fdisk_gpt_enable_minimize() it's not important as recalculation is
done before write, for example:

	fdisk_assign_device(cxt, devname, 0);
	fdisk_gpt_enable_minimize(fdisk_get_label(cxt, NULL), 1);

	... add partition, etc ...

	fdisk_write_disklabel(cxt);

Signed-off-by: Karel Zak <kzak@redhat.com>
2020-02-05 14:37:41 +01:00
Karel Zak 99d78b2fef fdisk: add --list-details
Signed-off-by: Karel Zak <kzak@redhat.com>
2020-02-05 14:31:00 +01:00
Karel Zak 36cd4b3c46 libfdisk: (gpt) add GPT debug mask
Signed-off-by: Karel Zak <kzak@redhat.com>
2020-02-05 14:17:23 +01:00
Karel Zak afb27a8e4c libfdisk: (gpt) cleanup and consolidate write code
- add fsync after write
- use write_all()
- use the same code for all write steps

Signed-off-by: Karel Zak <kzak@redhat.com>
2020-02-05 14:15:23 +01:00
Karel Zak f1970cc557 docs: improve size arguments description in --help output
Let's add "Arguments:" section to the --help output and describe
{K,M,G...}iB suffixes there.

Addresses: https://github.com/karelzak/util-linux/pull/917
Co-Author: ed <ed@s5h.net>
Signed-off-by: Karel Zak <kzak@redhat.com>
2020-02-05 11:01:36 +01:00
Karel Zak 67f938bfba include/c: add USAGE_ARGUMENT
Signed-off-by: Karel Zak <kzak@redhat.com>
2020-02-05 10:17:18 +01:00
Karel Zak ae63d7e832 fstrim: do not use Protect setting in systemd service
The ProtectHome= and ProtectSystem= settings mounts all stuff for the service in read-only mode.

The fstrim ioctl operates on read-only mountpoint file descriptor, but
on some read-only filesystem the operation can fail, so since
2d22ac64e4 we check for read-only volumes and skip it.

References: Upstream: 2d22ac64e4
Addresses: https://github.com/karelzak/util-linux/issues/948
Signed-off-by: Karel Zak <kzak@redhat.com>
2020-02-04 16:24:10 +01:00
Karel Zak da0debad53 sfdisk: fix ref-counting for the script
Signed-off-by: Karel Zak <kzak@redhat.com>
2020-02-04 15:54:53 +01:00
Karel Zak d74b16bdf1 libfdisk: (script) fix memory leak
Signed-off-by: Karel Zak <kzak@redhat.com>
2020-02-04 15:54:10 +01:00
Karel Zak d8c68b52cc libfdisk: (script) accept sector-size, ignore unknown headers
- add sector-size between supported headers (already in --dump output)

- report unknown headers by -ENOTSUP

- ignore ENOTSUP in sfdisk (but print warning) and in fdisk_script_read_file()

Addresses: https://github.com/karelzak/util-linux/issues/949
Signed-off-by: Karel Zak <kzak@redhat.com>
2020-02-04 15:11:19 +01:00
jonnyh64 fcc3078754 chrt: Use sched_setscheduler system call directly
musl libc does not support the sched_setscheduler library function
because the underlying Linux system call does not confirm to Posix;
this patch makes chrt use the system call directly

[kzak@redhat.com:
    - note that musl libc implements sched_setscheduler()
      but returns -ENOSYS all time...
    - add ifdefs to the patch
    - make sure we include syscall.h]

References: http://git.musl-libc.org/cgit/musl/commit/src/sched/sched_setscheduler.c?id=1e21e78bf7a5c24c217446d8760be7b7188711c2
Addresses: https://github.com/karelzak/util-linux/issues/943
Signed-off-by: Karel Zak <kzak@redhat.com>
2020-01-30 10:45:32 +01:00
Karel Zak caa37b6e18 libfdisk: fix __copy_partition()
The code called free() for pointers copied from the source partition.

Addresses: https://github.com/systemd/systemd/pull/14677
Signed-off-by: Karel Zak <kzak@redhat.com>
2020-01-28 12:46:39 +01:00
Karel Zak 3534b2c7c7 lib/randutils: use explicit data types for bit ops
ASAN is pretty unhappy with getpid() << 16, it seems better to save
into unsigned int and than do the bit-op.

Addresses: https://github.com/karelzak/util-linux/issues/942
Signed-off-by: Karel Zak <kzak@redhat.com>
2020-01-28 12:30:23 +01:00
Karel Zak dfe28f0e01 libfdisk: make sure we use NULL after free
Signed-off-by: Karel Zak <kzak@redhat.com>
2020-01-28 12:29:44 +01:00
Karel Zak 0683647c70 lib/strutils: add test for strdup_to_struct_member()
Signed-off-by: Karel Zak <kzak@redhat.com>
2020-01-28 11:34:04 +01:00
Karel Zak 88f04bf9e6 libmount: fix x- options use for non-root users
libmount returns EPERM for all X- and x- mount options for non-root
users when evaluate X-mount.mkdir. It's bug, we need to be sensitive
to only X-mount.mkdir and only if the target directory is missing.

Addresses: https://github.com/karelzak/util-linux/issues/941
Signed-off-by: Karel Zak <kzak@redhat.com>
2020-01-28 10:54:33 +01:00
Karel Zak e8c21c894e build-sys: add --disable-hwclock-gplv3
The currently used date/time parser (for hwclock --set --date <date>)
is gnulib based code with GPLv3.

This patch allows to avoid this code and replace it with minimalistic
date/time parser.

Addresses: https://github.com/karelzak/util-linux/issues/891
Reported-by: Carlos Santos <unixmania@gmail.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
2020-01-27 16:23:21 +01:00
Karel Zak c2e33769bb Merge branch 'master' of https://github.com/yurchor/util-linux
* 'master' of https://github.com/yurchor/util-linux:
  po: update uk.po (from translationproject.org)
2020-01-23 15:57:37 +01:00
Karel Zak f0b3df38c5 Merge branch 'patch-2' of https://github.com/yurchor/util-linux
* 'patch-2' of https://github.com/yurchor/util-linux:
  Fix minor typo: aliast -> alias
2020-01-23 15:53:19 +01:00
Karel Zak 704156ad63 Merge branch 'patch-1' of https://github.com/yurchor/util-linux
* 'patch-1' of https://github.com/yurchor/util-linux:
  Fix minor typo: ussuported -> unsupported
2020-01-23 15:52:44 +01:00
Karel Zak b1bc5ae39e libfdisk: (gpt) cleanup entries array size calculations
- move all calculations to inline functions
- remove duplicate code
- keep the same names for the same stuff

Signed-off-by: Karel Zak <kzak@redhat.com>
2020-01-23 15:50:53 +01:00
Karel Zak 3c3b7648c9 libfdisk: fix const char mess
Signed-off-by: Karel Zak <kzak@redhat.com>
2020-01-23 15:50:42 +01:00
Karel Zak 65e27d545c sfdisk: add --disk-id to change disk UUID/ID
Addresses: https://github.com/karelzak/util-linux/issues/916
Signed-off-by: Karel Zak <kzak@redhat.com>
2020-01-23 15:50:28 +01:00
Karel Zak e5f3144616 libfdisk: add fdisk_set_disklabel_id_from_string()
We have fdisk_set_disklabel_id(), but it's old ask-API based function.
It's not comfortable if you want to avoid dialog or template.

Addresses: https://github.com/karelzak/util-linux/issues/916
Signed-off-by: Karel Zak <kzak@redhat.com>
2020-01-23 15:50:12 +01:00
Karel Zak 34fed3ff17 blkdiscard: use O_EXCL, add --force
Let's make it more robust and safe. O_EXCL is an elegant way how to avoid
unwanted discard on mounted device.

Addresses: https://github.com/karelzak/util-linux/issues/915
Signed-off-by: Karel Zak <kzak@redhat.com>
2020-01-23 15:49:55 +01:00
Karel Zak e3e7cd659e Merge branch 'dmverity_sig' of https://github.com/bluca/util-linux
* 'dmverity_sig' of https://github.com/bluca/util-linux:
  libmount: add support for signed verity devices
2020-01-23 15:47:15 +01:00
Karel Zak 5db212c033 flock: make examples in man page more readable
Signed-off-by: Karel Zak <kzak@redhat.com>
2020-01-23 15:43:23 +01:00
Karel Zak 304323fed1 Merge branch 'Jookia-patch-1' of https://github.com/Jookia/util-linux
* 'Jookia-patch-1' of https://github.com/Jookia/util-linux:
  flock: Add new example using shell IO redirection
2020-01-23 15:39:42 +01:00
Karel Zak 9fabc6d5fa sfdisk: remove broken step alignment for --move
* remove unnecessary and broken step alignment
* improve reported information in move log
* improve final progress bar update

Addresses: https://github.com/karelzak/util-linux/issues/938
Signed-off-by: Karel Zak <kzak@redhat.com>
2020-01-23 15:07:32 +01:00
Karel Zak 2b26438c4b sfdisk: make sure we do not overlap on --move
The area we need to move does not have to be aligned to optimal I/O
size (step size) -- we need to be sure we do not move data
after/before the area.

Addresses: https://github.com/karelzak/util-linux/issues/938
Signed-off-by: Karel Zak <kzak@redhat.com>
2020-01-23 12:44:58 +01:00
Jookia 966bcac37a
flock: Add new example using shell IO redirection 2020-01-23 04:55:35 +00:00
Yuri Chornoivan 495ed36ad7 po: update uk.po (from translationproject.org) 2020-01-22 20:52:11 +02:00
Karel Zak d355735912 build-sys: release++ (v2.35)
Signed-off-by: Karel Zak <kzak@redhat.com>
2020-01-21 11:15:21 +01:00
Karel Zak 05bfb8267e docs: update v2.35-ReleaseNotes
Signed-off-by: Karel Zak <kzak@redhat.com>
2020-01-21 11:12:49 +01:00
Karel Zak 4c783547c3 docs: update AUTHORS file
Signed-off-by: Karel Zak <kzak@redhat.com>
2020-01-21 11:07:27 +01:00
Karel Zak b529c736ca po: merge changes
Signed-off-by: Karel Zak <kzak@redhat.com>
2020-01-21 11:03:19 +01:00
Pedro Albuquerque aaa14eefab po: update pt.po (from translationproject.org) 2020-01-21 10:57:45 +01:00
Rafael Fontenelle acda89cb6f po: update pt_BR.po (from translationproject.org) 2020-01-21 10:57:45 +01:00
Jakub Bogusz 6bf7ad87a9 po: update pl.po (from translationproject.org) 2020-01-21 10:57:45 +01:00
Takeshi Hamasaki ad721f1d31 po: update ja.po (from translationproject.org) 2020-01-21 10:57:45 +01:00
Božidar Putanec 7e551d1e97 po: update hr.po (from translationproject.org) 2020-01-21 10:57:45 +01:00
Frédéric Marchal 552499a2f1 po: update fr.po (from translationproject.org) 2020-01-21 10:57:45 +01:00
Antonio Ceballos Roa 88f240929f po: update es.po (from translationproject.org) 2020-01-21 10:57:45 +01:00
Mario Blättermann 955d2cbc14 po: update de.po (from translationproject.org) 2020-01-21 10:57:45 +01:00