1
0
mirror of https://github.com/systemd/systemd synced 2026-03-28 09:44:50 +01:00

Compare commits

...

7 Commits

Author SHA1 Message Date
Frantisek Sumsal
93caec7ed6
Merge pull request #20769 from weblate/weblate-systemd-master
Translations update from Weblate
2021-09-16 20:23:51 +02:00
Hugo Carvalho
b6c5a863a5 po: Translated using Weblate (Portuguese)
Currently translated at 100.0% (189 of 189 strings)

Co-authored-by: Hugo Carvalho <hugokarvalho@hotmail.com>
Translate-URL: https://translate.fedoraproject.org/projects/systemd/master/pt/
Translation: systemd/main
2021-09-16 20:05:00 +02:00
Christian Wehrli
3b55bd2fa9 po: Translated using Weblate (German)
Currently translated at 71.4% (135 of 189 strings)

Co-authored-by: Christian Wehrli <christian@chw.onl>
Translate-URL: https://translate.fedoraproject.org/projects/systemd/master/de/
Translation: systemd/main
2021-09-16 20:05:00 +02:00
Lennart Poettering
281752e406
Merge pull request #20763 from poettering/fileio-test
test-fileio: test read_virtual_file() with more files from /proc
2021-09-16 17:47:03 +02:00
Piotr Drąg
f0c5e8d452 po: add false positives to POTFILES.skip 2021-09-16 16:19:32 +01:00
Lennart Poettering
f3b751220b test-fileio: test read_virtual_file() with more files from /proc
i.e. let's pick some files we know are too large, or where struct stat's
.st_size is zero even though non-empty, and test read_virtual_file()
with that, to ensure things are handled sensibly. Goal is to ensure all
three major codepaths in read_virtual_file() are tested.

Prompted-by: #20743
2021-09-16 12:23:32 +02:00
Lennart Poettering
00bd9a4a82 fileio: fix truncated read handling in read_virtual_file()
We mishandled the case where the size we read from the file actually
matched the maximum size fully. In that case we cannot really make a
determination whether the file was fully read or only partially. In that
case let's do another loop, so that we operate with a buffer, and
we can detect the EOF (which will be signalled to us via a short read).
2021-09-16 12:23:25 +02:00
5 changed files with 264 additions and 143 deletions

View File

@ -1,3 +1,5 @@
src/boot/efi/boot.c
src/boot/efi/secure-boot.c
src/core/dbus-automount.c
src/core/dbus-device.c
src/core/dbus-job.c
@ -18,4 +20,5 @@ src/locale/localed.c
src/timedate/timedated.c
units/debug-shell.service.in
units/systemd-journald.service.in
units/systemd-timesyncd.service.in
units/user@.service.in

View File

@ -6,13 +6,14 @@
# Bernd Homuth <dev@hmt.im>, 2015.
# Fabian Affolter <mail@fabian-affolter.ch>, 2020.
# Ettore Atalan <atalanttore@googlemail.com>, 2021.
# Christian Wehrli <christian@chw.onl>, 2021.
msgid ""
msgstr ""
"Project-Id-Version: systemd master\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2021-01-08 17:48+0100\n"
"PO-Revision-Date: 2021-08-23 18:04+0000\n"
"Last-Translator: Ettore Atalan <atalanttore@googlemail.com>\n"
"PO-Revision-Date: 2021-09-16 18:04+0000\n"
"Last-Translator: Christian Wehrli <christian@chw.onl>\n"
"Language-Team: German <https://translate.fedoraproject.org/projects/systemd/"
"master/de/>\n"
"Language: de\n"
@ -177,7 +178,7 @@ msgstr ""
#: src/hostname/org.freedesktop.hostname1.policy:51
msgid "Get product UUID"
msgstr ""
msgstr "Die Produkte-UUID erhalten"
#: src/hostname/org.freedesktop.hostname1.policy:52
#, fuzzy
@ -622,7 +623,7 @@ msgstr ""
#: src/login/org.freedesktop.login1.policy:352
msgid "Set the reboot \"reason\" in the kernel"
msgstr ""
msgstr "Den Reboot-\"Grund\" im Kernel festlegen"
#: src/login/org.freedesktop.login1.policy:353
#, fuzzy

372
po/pt.po

File diff suppressed because it is too large Load Diff

View File

@ -470,9 +470,14 @@ int read_virtual_file(const char *filename, size_t max_size, char **ret_contents
if (n <= size)
break;
/* If a maximum size is specified and we already read as much, no need to try again */
if (max_size != SIZE_MAX && n >= max_size) {
n = max_size;
/* If a maximum size is specified and we already read more we know the file is larger, and
* can handle this as truncation case. Note that if the size of what we read equals the
* maximum size then this doesn't mean truncation, the file might or might not end on that
* byte. We need to rerun the loop in that case, with a larger buffer size, so that we read
* at least one more byte to be able to distinguish EOF from truncation. */
if (max_size != SIZE_MAX && n > max_size) {
n = size; /* Make sure we never use more than what we sized the buffer for (so that
* we have one free byte in it for the trailing NUL we add below).*/
truncated = true;
break;
}

View File

@ -1047,7 +1047,11 @@ static void test_read_virtual_file(size_t max_size) {
FOREACH_STRING(filename,
"/proc/1/cmdline",
"/etc/nsswitch.conf",
"/sys/kernel/uevent_seqnum") {
"/sys/kernel/uevent_seqnum",
"/proc/kcore",
"/proc/kallsyms",
"/proc/self/exe",
"/proc/self/pagemap") {
_cleanup_free_ char *buf = NULL;
size_t size = 0;
@ -1055,7 +1059,11 @@ static void test_read_virtual_file(size_t max_size) {
r = read_virtual_file(filename, max_size, &buf, &size);
if (r < 0) {
log_info_errno(r, "read_virtual_file(\"%s\", %zu): %m", filename, max_size);
assert_se(ERRNO_IS_PRIVILEGE(r) || r == -ENOENT);
assert_se(ERRNO_IS_PRIVILEGE(r) || /* /proc/kcore is not accessible to unpriv */
IN_SET(r,
-ENOENT, /* Some of the files might be absent */
-EINVAL, /* too small reads from /proc/self/pagemap trigger EINVAL */
-EFBIG)); /* /proc/kcore and /proc/self/pagemap should be too large */
} else
log_info("read_virtual_file(\"%s\", %zu): %s (%zu bytes)", filename, max_size, r ? "non-truncated" : "truncated", size);
}