1
0
mirror of https://github.com/systemd/systemd synced 2026-03-17 10:34:46 +01:00

Compare commits

...

3 Commits

Author SHA1 Message Date
Lennart Poettering
947ecb0812 socket: turn of loud logging when setting up sockopts in container fails due to privs
Various socktops will fail if we run in a container, due to lack of
privs (for example SO_RECVFORCE as used by the journald sockets). That's
typically not a big issue. Hence downgrade the log level.

Follow-up for: f7df0eab8d9520f37a2feaecf532d78de6ab6b7d
2026-01-17 08:47:14 +09:00
Lennart Poettering
834a7dfc12 hostnamectl: tweak three chassis emojis 2026-01-17 08:46:26 +09:00
Yu Watanabe
7d23749ddd mkfs-utils: also set $E2FSPROGS_FAKE_TIME if $SOURCE_DATE_EPOCH is set
Follow-up for 7bf0d0c46e39966ad6080aa3f25eed65bd57ad4b.

To support e2fsprogs older than v1.47.1 (released 2024-05-21).

Suggested-by: ZauberNerd <zaubernerd@zaubernerd.de>
2026-01-17 08:45:50 +09:00
4 changed files with 40 additions and 20 deletions

View File

@ -1031,7 +1031,8 @@ DEFINE_TRIVIAL_CLEANUP_FUNC_FULL(Socket*, socket_close_fds, NULL);
int _e_ = (e); \ int _e_ = (e); \
log_unit_full_errno( \ log_unit_full_errno( \
UNIT(s), \ UNIT(s), \
ERRNO_IS_NOT_SUPPORTED(_e_) ? LOG_DEBUG : LOG_WARNING, \ ERRNO_IS_NOT_SUPPORTED(_e_) || \
ERRNO_IS_PRIVILEGE(_e_) ? LOG_DEBUG : LOG_WARNING, \
_e_, \ _e_, \
"Failed to set %s socket option, ignoring: %m", \ "Failed to set %s socket option, ignoring: %m", \
option); \ option); \

View File

@ -83,11 +83,11 @@ static const char* chassis_string_to_glyph(const char *chassis) {
if (streq_ptr(chassis, "watch")) if (streq_ptr(chassis, "watch"))
return UTF8(""); /* Watch */ return UTF8(""); /* Watch */
if (streq_ptr(chassis, "handset")) if (streq_ptr(chassis, "handset"))
return UTF8("🕻"); /* Left Hand Telephone Receiver */ return UTF8("📱"); /* Mobile Phone */
if (streq_ptr(chassis, "vm")) if (streq_ptr(chassis, "vm"))
return UTF8("🖴"); /* Hard disk */ return UTF8("💽"); /* Computer disk */
if (streq_ptr(chassis, "container")) if (streq_ptr(chassis, "container"))
return UTF8(""); /* Ballot Box */ return UTF8("📦"); /* Package */
return NULL; return NULL;
} }

View File

@ -453,12 +453,24 @@ int make_filesystem(
if (sector_size > 0) { if (sector_size > 0) {
if (strv_extend(&env, "MKE2FS_DEVICE_SECTSIZE") < 0) if (strv_extend(&env, "MKE2FS_DEVICE_SECTSIZE") < 0)
return log_oom(); return log_oom();
if (strv_extendf(&env, "%"PRIu64, sector_size) < 0) if (strv_extendf(&env, "%"PRIu64, sector_size) < 0)
return log_oom(); return log_oom();
} }
/* e2fsprogs supports $SOURCE_DATE_EPOCH since v1.47.1. For older versions, we need to set
* $E2FSPROGS_FAKE_TIME. See the following:
* https://github.com/tytso/e2fsprogs/commit/b6e2913061577ad981464e435026d71a48fd5caf
* Note, $E2FSPROGS_FAKE_TIME and $SOURCE_DATE_EPOCH are mostly equivalent, except for the
* 0 value handling, where $E2FSPROGS_FAKE_TIME=0 is ignored and the current time is used,
* but $SOURCE_DATE_EPOCH=0 sets 1970-01-01 as the timestamp. */
if (!secure_getenv("E2FSPROGS_FAKE_TIME")) { /* honor $E2FSPROGS_FAKE_TIME if already set */
const char *e = secure_getenv("SOURCE_DATE_EPOCH");
if (e && strv_extend_strv(&env, STRV_MAKE("E2FSPROGS_FAKE_TIME", e), /* filter_duplicates= */ false) < 0)
return log_oom();
}
} else if (streq(fstype, "btrfs")) { } else if (streq(fstype, "btrfs")) {
argv = strv_new(mkfs, argv = strv_new(mkfs,
"-L", label, "-L", label,

View File

@ -1896,7 +1896,7 @@ testcase_luks2_integrity() {
} }
testcase_ext_reproducibility() { testcase_ext_reproducibility() {
local defs imgs local defs imgs ts
# Online mode mounts the filesystem which updates inode timestamps non-deterministically # Online mode mounts the filesystem which updates inode timestamps non-deterministically
if [[ "$OFFLINE" != "yes" ]]; then if [[ "$OFFLINE" != "yes" ]]; then
@ -1916,21 +1916,28 @@ Format=ext4
EOF EOF
# Build the image twice with the same seed and verify they are identical # Build the image twice with the same seed and verify they are identical
systemd-repart --offline="$OFFLINE" \ ts=$(date +%s)
--definitions="$defs" \ env SOURCE_DATE_EPOCH="$ts" \
--empty=create \ systemd-repart \
--size=50M \ --offline="$OFFLINE" \
--seed="$seed" \ --definitions="$defs" \
--dry-run=no \ --empty=create \
"$imgs/test1.img" --size=50M \
--seed="$seed" \
--dry-run=no \
"$imgs/test1.img"
systemd-repart --offline="$OFFLINE" \ sleep 2
--definitions="$defs" \
--empty=create \ env SOURCE_DATE_EPOCH="$ts" \
--size=50M \ systemd-repart \
--seed="$seed" \ --offline="$OFFLINE" \
--dry-run=no \ --definitions="$defs" \
"$imgs/test2.img" --empty=create \
--size=50M \
--seed="$seed" \
--dry-run=no \
"$imgs/test2.img"
cmp "$imgs/test1.img" "$imgs/test2.img" cmp "$imgs/test1.img" "$imgs/test2.img"
} }