#1059360 sbuild: How to use it in combination with faketime?

#1059360#5
Date:
2023-12-23 14:50:24 UTC
From:
To:
Hello.

I'm trying to use faketime with sbuild. Currently, I managed to
make it work by replacing dpkg-buildpackage inside the chroot
with a wrapper script:

#!/bin/sh
faketime -f "@2028-12-31 12:00:00" real-dpkg-buildpackage

But I would prefer not to fiddle with the contents of the chroot.
Is there a less intrusive way?

Somewhere in the source I see this hardcoded:

         system('/usr/bin/dpkg-buildpackage',

so maybe we would just need some new environment variable
string to be used as a prefix for that.

Thanks.

#1059360#8
Date:
2024-12-02 14:03:48 UTC
From:
To:
Hi Santiago,

sorry for taking so long to follow up here... This must've slipped through the
cracks and I only found it again now thanks to some bug triage by Richard
Lewis.

To prefix dpkg-buildpackage with something else, you can use BUILD_ENV_CMND or
$build_env_cmnd in your ~/.config/sbuild/conf.pl. Can you confirm that this
works for you?

Thanks!

cheers, josch

#1059360#13
Date:
2024-12-06 22:48:34 UTC
From:
To:
owner 1059360 !
thanks

Hi.

Unfortunately, I found a workaround (at the time) and abandoned the idea
of using faketime.

The workaround was to uninstall ntpsec and any other similar
service and put the machine in the future by changing the
system clock.

This has worked well enough since then, so I'm not in a hurry
to try other things.

I take the responsibility of checking what you said, some day,
so I'm putting myself as the "owner" of this bug.

Thanks.

#1059360#20
Date:
2025-01-26 17:49:07 UTC
From:
To:
Hello,

On Mon, 02 Dec 2024 15:03:48 +0100 Johannes Schauer Marin Rodrigues <josch@debian.org> wrote:

I've been keen to try this out since I'm currently looking into one of
those "will FTBFS during trixie support period bugs".

Unfortunately, this doesn't work when added to the sbuild config:

     $build_env_cmnd = 'faketime -f "@2028-06-10 12:00:00"';

which results in:

     Can't exec "faketime -f "@2028-06-10 12:00:00"": No such file or
directory at /usr/libexec/sbuild-usernsexec line 515.

In addition, it seems that this configuration setting only accepts a
string, since using an array doesn't work, it tries to use the variable
reference in the command line rather than expand the array items.

So, it would be quite useful if $build_env_cmnd was adjusted to be able
to accept not only an executable but command-line arguments as well.

Thanks,

#1059360#23
Date:
2025-01-26 18:07:07 UTC
From:
To:
Hi,

Quoting Jérôme Charaoui (2025-01-26 18:49:07)

I agree. This can be added and I'll gladly accept patches.

Other users of this option have put their own custom script into the chroot to
work around this limitation: https://lists.reproducible-builds.org/pipermail/rb-general/2023-February/002876.html

It is rare that this option is getting used. Another potential use-case is
eatmydata.

In general though, I'd caution against the use of faketime for this purpose.
faketime uses the LD_PRELOAD mechanism. I'd expect that time bombs are
especially likely in package test suites. At the same time, any funkiness
surrounding a custom LD_PRELOAD is *also* most common in package tests.

I know that Santiago Vila does similar tests but sets the system time to carry
them out. I think doing it that way is the far superior approach. I think you
will miss breaking packages when you use faketime.

Thanks!

cheers, josch