From a27b2f9ed1291b345147fe4a65e45ab61d928fd1 Mon Sep 17 00:00:00 2001 From: Eero Kelly Date: Wed, 14 Feb 2024 22:07:55 +0000 Subject: [PATCH] Fix(NODE-1285): Freeze clock when using faketime --- ic-os/bootloader/build-bootloader-tree.sh | 2 +- toolchains/sysimage/build_fat32_image.py | 9 +++++---- toolchains/sysimage/build_vfat_image.py | 7 ++++--- 3 files changed, 10 insertions(+), 8 deletions(-) diff --git a/ic-os/bootloader/build-bootloader-tree.sh b/ic-os/bootloader/build-bootloader-tree.sh index 78ffedd40fd..5b3bf86a7a2 100755 --- a/ic-os/bootloader/build-bootloader-tree.sh +++ b/ic-os/bootloader/build-bootloader-tree.sh @@ -31,7 +31,7 @@ docker build --iidfile ${TMPDIR}/iidfile - <<<" RUN mkdir -p /build/boot/efi/EFI/Boot RUN grub-mkimage --version RUN apt list --installed | grep grub - RUN faketime '1970-1-1 0' grub-mkimage -p '(,gpt2)/' -O x86_64-efi -o /build/boot/efi/EFI/Boot/bootx64.efi \ + RUN faketime -f '1970-1-1 0:0:0' grub-mkimage -p '(,gpt2)/' -O x86_64-efi -o /build/boot/efi/EFI/Boot/bootx64.efi \ boot linux search normal configfile \ part_gpt btrfs ext2 fat iso9660 loopback \ test keystatus gfxmenu regexp probe \ diff --git a/toolchains/sysimage/build_fat32_image.py b/toolchains/sysimage/build_fat32_image.py index ce3f9424e69..0944929388d 100755 --- a/toolchains/sysimage/build_fat32_image.py +++ b/toolchains/sysimage/build_fat32_image.py @@ -38,12 +38,12 @@ def untar_to_fat32(tf, fs_basedir, out_file, path_transform): if path == "": continue os.mkdir(os.path.join(fs_basedir, path)) - subprocess.run(["faketime", "1970-1-1 0", "mmd", "-i", out_file, "::/" + path], check=True) + subprocess.run(["faketime", "-f", "1970-1-1 0:0:0", "mmd", "-i", out_file, "::/" + path], check=True) elif member.type == tarfile.REGTYPE or member.type == tarfile.AREGTYPE: with open(os.path.join(fs_basedir, path), "wb") as f: f.write(tf.extractfile(member).read()) subprocess.run( - ["faketime", "1970-1-1 0", "mcopy", "-o", "-i", out_file, os.path.join(fs_basedir, path), "::/" + path], + ["faketime", "-f", "1970-1-1 0:0:0", "mcopy", "-o", "-i", out_file, os.path.join(fs_basedir, path), "::/" + path], check=True, ) else: @@ -58,7 +58,8 @@ def install_extra_files(out_file, extra_files, path_transform): subprocess.run( [ "faketime", - "1970-1-1 0", + "-f", + "1970-1-1 0:0:0", "mcopy", "-o", "-i", @@ -132,7 +133,7 @@ def path_transform(path, limit_prefix=limit_prefix): os.truncate(image_file, image_size) subprocess.run(["/usr/sbin/mkfs.fat", "-F", "32", "-i", "0", image_file], check=True) if image_label: - subprocess.run(["faketime", "1970-1-1 0", "/usr/sbin/fatlabel", image_file, image_label], check=True) + subprocess.run(["faketime", "-f", "1970-1-1 0:0:0", "/usr/sbin/fatlabel", image_file, image_label], check=True) if in_file: with tarfile.open(in_file, mode="r|*") as tf: diff --git a/toolchains/sysimage/build_vfat_image.py b/toolchains/sysimage/build_vfat_image.py index 4c52b6e4ca7..f1a0d679154 100755 --- a/toolchains/sysimage/build_vfat_image.py +++ b/toolchains/sysimage/build_vfat_image.py @@ -38,12 +38,12 @@ def untar_to_vfat(tf, fs_basedir, out_file, path_transform): if path == "": continue os.mkdir(os.path.join(fs_basedir, path)) - subprocess.run(["faketime", "1970-1-1 0", "mmd", "-i", out_file, "::/" + path], check=True) + subprocess.run(["faketime", "-f", "1970-1-1 0:0:0", "mmd", "-i", out_file, "::/" + path], check=True) elif member.type == tarfile.REGTYPE or member.type == tarfile.AREGTYPE: with open(os.path.join(fs_basedir, path), "wb") as f: f.write(tf.extractfile(member).read()) subprocess.run( - ["faketime", "1970-1-1 0", "mcopy", "-o", "-i", out_file, os.path.join(fs_basedir, path), "::/" + path], + ["faketime", "-f", "1970-1-1 0:0:0", "mcopy", "-o", "-i", out_file, os.path.join(fs_basedir, path), "::/" + path], check=True, ) else: @@ -58,7 +58,8 @@ def install_extra_files(out_file, extra_files, path_transform): subprocess.run( [ "faketime", - "1970-1-1 0", + "-f", + "1970-1-1 0:0:0", "mcopy", "-o", "-i",