Specifying MS_MGC_VAL was required in kernel versions prior to 2.4,
but since Linux 2.4 is no longer required and is ignored if specified
The minimal kernel requirement for util-linux is Linux v2.6.
Signed-off-by: Karel Zak <kzak@redhat.com>
libmount allows to split one library (mount(8)) call to multiple mount(2)
syscalls, for example
--rbind --make-rslave
in this case we have to be careful with MS_REC because the flag is
applied to multiple operations.
# strace -e mount mount --rbind --make-rslave /mnt/A /mnt/B
Old version:
mount("/mnt/A", "/mnt/B", 0x13ecac0, MS_MGC_VAL|MS_BIND, NULL) = 0
mount("none", "/mnt/B", NULL, MS_REC|MS_SLAVE, NULL) = 0
Fixed version:
mount("/mnt/A", "/mnt/B", 0x1f22ac0, MS_MGC_VAL|MS_BIND|MS_REC, NULL) = 0
mount("none", "/mnt/B", NULL, MS_REC|MS_SLAVE, NULL) = 0
Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=1584443
Signed-off-by: Karel Zak <kzak@redhat.com>
It's better to inform libmount about operations by string than by
flags, because for example "rbind,slave" cannot be specified by
MS_REC|MS_BIND|MS_SLAVE.
https://bugzilla.redhat.com/show_bug.cgi?id=1584443
Signed-off-by: Karel Zak <kzak@redhat.com>
The current libmount MS_REMOUNT|MS_BIND support is restricted to
MS_RDONLY (read-only bind mount). This is too restrictive as Linux
kernel supports bind-remount for arbitrary VFS flags.
After this update you can use
# mount /dev/sdc1 /mnt/A
# mount --bind -onosuid,noexec /mnt/A /mnt/B
# findmnt /dev/sdc1 -oTARGET,SOURCE,FS-OPTIONS,VFS-OPTIONS
TARGET SOURCE FS-OPTIONS VFS-OPTIONS
/mnt/A /dev/sdc1 rw,stripe=512,data=ordered rw,relatime
/mnt/B /dev/sdc1 rw,stripe=512,data=ordered rw,nosuid,noexec,relatime
The "mount --bind" is composed from two syscalls of course (1st is
bind, 2nd is bind,remount,nosuid,noexec).
Addresses: https://github.com/karelzak/util-linux/issues/637
Signed-off-by: Karel Zak <kzak@redhat.com>
[sys-utils/mountpoint.c:79]: (style) Redundant condition:
ctl->st.st_dev==pst.st_dev. 'A || (!A && B)' is equivalent to 'A || B'
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
gcc -fsanitize=undefined gives following warning.
include/pt-mbr.h:27:51: runtime error: left shift of 248 by 24 places cannot
be represented in type 'int'
It looks like char is converted internally to int before bit-shift, and that
type overflows when char value is greater than 127. Following code snippet
will show the effect what is stored when undefined behaviour happens.
#include <stdio.h>
#include <inttypes.h>
int main(int argc, unsigned char **argv)
{
char p[] = { 170, 170, 170, 170 };
unsigned int uint = p[3];
uint64_t res = 0;
/* overflow */
res = p[0] | (p[1] << 8) | (p[2] << 16) | (p[3] << 24);
printf("%" PRIu64 "\n", res);
/* this is fine */
res = 0;
res = p[0] | (p[1] << 8) | (p[2] << 16) | (uint << 24);
printf("%" PRIu64 "\n", res);
return 0;
}
I tested gcc 8.1.0, clang 6.0.0, and tcc 0.9.27 and they all printed the
same values.
$ ./a.out
18446744073709551530
4294967210
Because output is result of undefined behavior what is stored may change in
future, and other compilers / version might do something different. In the
case of what pt-mbr.h the destination data type size was commonly 32 bits in
size, that truncated excess rubbish from bitshift. Needless to say that was
not very robust code.
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
While looking earlier commit I noticed everything but formatting was removed
from a message in namei.c file. That inspired me to look if there are more
strings that does not need translation project attention. This change
removes at least some of them, if not all.
Reference: e19cc7b65b
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
Fix shellcheck error.
if ! [ "$paraller_jobs" -ge 0 2>/dev/null ]; then
^-- SC1009: The mentioned parser error was in this if expression.
^-- SC1073: Couldn't parse this test expression.
^-- SC1072: Expected test to end here (don't
wrap commands in []/[[]]). Fix any
mentioned problems and try again.
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
According to the UDF 2.60 specification, the Minimum UDF Read Revision
value shall be at most #0250 for all media with a UDF 2.60 file system.
So in this case use Minimum UDF Write Revision as ID_FS_VERSION to
distinguish between UDF 2.50 and UDF 2.60 discs.
This commit also adds a testing Blu-Ray Recordable image with UDF revision
2.60 created by Nero which really sets Minimum UDF Read Revision to 2.50.
Signed-off-by: Pali Rohár <pali.rohar@gmail.com>
Windows 10 Creators edition has extended the ntfs cluster limit to
2MB. As a consequence blkid does not identify recent partitions with
clusters beyond 65K as ntfs ones.
Addresses: https://github.com/karelzak/util-linux/issues/641
Signed-off-by: Karel Zak <kzak@redhat.com>
Co-Author: Jean-Pierre André <jean-pierre.andre@wanadoo.fr>
Let's follow the standard $id$salt$encrypted password format in
verification code.
The current code is useless and for example PWD-LOCK column is always
FALSE.
Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=1581611
Signed-off-by: Karel Zak <kzak@redhat.com>
Punctuation marks have been left in the only argument of two-fonts
macros, instead of being separated from it to make the second one.
Signed-off-by: Bjarni Ingi Gislason <bjarniig@rhi.hi.is>
Use the correct macro (I, B) for the font change of one argument, not
those that are used for alternating two fonts, like "BR", "IR", "RB",
or "RI".
Signed-off-by: Bjarni Ingi Gislason <bjarniig@rhi.hi.is>
Group include, defines and such together, and move items inbetween functions
on top of the source file so that everything can be seen easily.
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
This patch introduces [...] to store extra information about terminal
to the typescript header. For example:
Script started on 2018-05-14 12:52:32+02:00 [TERM="xterm-256color" TTY="/dev/pts/3" COLS="190" LINES="53"]
or
Script started on 2018-05-14 12:54:01+02:00 [<not executed on terminal>]
if stdout is not terminal.
Addresses: https://github.com/karelzak/util-linux/issues/583
Signed-off-by: Karel Zak <kzak@redhat.com>
* always save "done" timestamp to typescript (use done() for this)
* use FORMAT_TIMESTAMP_MAX as buffer size
Signed-off-by: Karel Zak <kzak@redhat.com>
When script is used on a host with a relatively small free disk space, it
is sometimes desirable to limit the size of the captured output. This
can now be enforced with the --output-limit option.
The --output-limit option lets the user specify a maximum size. The program
uses the size parsing from strutils and thus supports the usual
multiplicative suffixes (kiB, KB, MiB, MB, etc.). After the specified
number of bytes have been written to the output file, the script program
will terminate the child process.
Due to buffering, the size of the output file might exceed the specified
limit. This limit also does not include the start and done messages.
The race test was throwing an error dur to a variable being "" in some cases.
Quoting the variable in the equal test took care of that test.
[kzak@redhat.com: - use done() to stop script
- count also timing file
- remove unnamed member initialization in ctl struct
- add to bash-completion]
Signed-off-by: Fred Mora <fmora@datto.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
* 'fixes' of https://github.com/yontalcar/util-linux:
libfdisk: fix list_del after partition reset
choom: set oom_score_adj before exec
fdisk: fix typo in debug string
chcpu.c mixed maxcpus (number of cpus) and setsize (size of CPU bit
mask). It effectively limits number of CPUs to 1/8 of the supported
amount.
Signed-off-by: Stanislav Brabec <sbrabec@suse.cz>
Cc: Michael Matz <matz@suse.de>
Cc: Heiko Carstens <heiko.carstens@de.ibm.com>
The old CPU macros are limited to 1024 cores. As a result, lscpu cannot
count sockets on large systems. Use new scalable macros.
Signed-off-by: Stanislav Brabec <sbrabec@suse.cz>
Cc: Michael Matz <matz@suse.de>
login-utils/last.c: In function ‘list’:
login-utils/last.c:398:36: warning: argument to ‘sizeof’ in ‘strncat’ call
is the same expression as the source; did you mean to use the size of the
destination? [-Wsizeof-pointer-memaccess]
strncat(utline, p->ut_line, sizeof(p->ut_line));
The sizeof(utline) is defined as sizeof(p->ut_line) + 1, so the compiler got
that wrong. Lets truncate strncat() otherway around to keep gcc 8.1 happy.
Signed-off-by: Sami Kerola <kerolasa@iki.fi>