Re: [ptxdist] [PATCH v4 1/2] Add libfaketime as a core component of ptxdist for patchin support
On Fri, Aug 03, 2018 at 11:44:55AM -0400, j...@ringle.org wrote: > From: Jon Ringle > > libfaketime will be used during patchin so that committer timestamps always > have a fixed value and therefore making the ${PKG}_SERIES_SHA256 value > repeatable > > The minimal set of source files was picked out of libfaketime-0.9.7 I think it should be possible to provide the correct timestamps with GIT_AUTHOR_DATE and/or GIT_COMMITTER_DATE or something like that. Michael > > Signed-off-by: Jon Ringle > --- > Makefile.in | 14 +- > scripts/libfaketime/Makefile | 118 ++ > scripts/libfaketime/faketime.c| 385 ++ > scripts/libfaketime/faketime_common.h | 61 + > scripts/libfaketime/libfaketime.c | 2410 > + > scripts/libfaketime/libfaketime.map | 10 + > scripts/libfaketime/time_ops.h| 104 ++ > 7 files changed, 3101 insertions(+), 1 deletion(-) > create mode 100644 scripts/libfaketime/Makefile > create mode 100644 scripts/libfaketime/faketime.c > create mode 100644 scripts/libfaketime/faketime_common.h > create mode 100644 scripts/libfaketime/libfaketime.c > create mode 100644 scripts/libfaketime/libfaketime.map > create mode 100644 scripts/libfaketime/time_ops.h > > diff --git a/Makefile.in b/Makefile.in > index 40c676c..6e08377 100644 > --- a/Makefile.in > +++ b/Makefile.in > @@ -22,7 +22,7 @@ export SHELL > > @BUILD_NCONF_TRUE@NCONF = nconf > > -all: kconfig environment > +all: kconfig libfaketime environment > @touch .done > > kconfig: > @@ -41,6 +41,17 @@ kconfig: > conf mconf $(NCONF) > @echo "done." > > +libfaketime: > + @echo "building libfaketime ..." > + @CC="$(CC)" \ > + CXX="$(CXX)" \ > + CFLAGS="$(CFLAGS)" \ > + CXXFLAGS="$(CXXFLAGS)" \ > + CPPFLAGS="$(CPPFLAGS)" \ > + LDFLAGS="$(LDFLAGS)" \ > + $(MAKE) -C "$(abs_srcdir)/scripts/libfaketime" all > + @echo "done." > + > environment: > @echo -n "preparing PTXdist environment ..." > @ln -sf @AWK@ "$(abs_srcdir)/bin/awk" > @@ -89,6 +100,7 @@ clean: > @rm -f .done > @find "$(abs_srcdir)/bin" -type l -print0 | xargs -0 rm -f > @$(MAKE) -C "$(abs_srcdir)/scripts/kconfig" clean > + @$(MAKE) -C "$(abs_srcdir)/scripts/libfaketime" clean > > dirty-check: > @case "$(version)" in \ > diff --git a/scripts/libfaketime/Makefile b/scripts/libfaketime/Makefile > new file mode 100644 > index 000..a557c38 > --- /dev/null > +++ b/scripts/libfaketime/Makefile > @@ -0,0 +1,118 @@ > +# > +# Notes: > +# > +# * Compilation Defines: > +# > +# FAKE_STAT > +# - Enables time faking also for files' timestamps. > +# > +# NO_ATFILE > +# - Disables support for the fstatat() group of functions > +# > +# PTHREAD > +# - Define this to enable multithreading support. > +# > +# PTHREAD_SINGLETHREADED_TIME > +# - Define this if you want to single-thread time() ... there ARE > +# possibile caching side-effects in a multithreaded environment > +# without this, but the performance impact may require you to > +# try it unsynchronized. > +# > +# FAKE_INTERNAL_CALLS > +# - Also intercept libc internal __functions, e.g. not just time(), > +# but also __time(). Enhances compatibility with applications > +# that make use of low-level system calls, such as Java Virtual > +# Machines. > +# > +# FAKE_SLEEP > +# - Also intercept sleep(), nanosleep(), usleep(), alarm(), > [p]poll() > +# > +# FAKE_TIMERS > +# - Also intercept timer_settime() and timer_gettime() > +# > +# MULTI_ARCH > +# - If MULTI_ARCH is set, the faketime wrapper program will put > a literal > +#$LIB into the LD_PRELOAD environment variable it creates, > which makes > +#ld automatically choose the correct library version to use > for the > +#target binary. Use for Linux platforms with Multi-Arch > support only! > +# > +# * Compilation addition: second libMT target added for building the > pthread- > +# enabled library as a separate library > +# > +# * Compilation switch change: previous versions compiled using > '-nostartfiles' > +# This is no longer the case since there is a 'startup' constructor for > the library > +# which is used to activate the start-at times when specified. This also > initializes > +# the dynamic disabling of the FAKE_STAT calls. > +# > +# By default, libfaketime will be compiled for your system's default > architecture. > +# To build 32-bit libraries and binaries, add -m32 to CFLAGS and LDFLAGS. > +# > +# Change PREFIX to where you want libfaketime (libraries and wrapper binary) > installed. > +# LIBDIRNAME is relative to PREFIX. The default is to install into > $PREFIX/lib/faketime, > +# but you can set LIBDIRNAME to, e.g., /lib64 if you wa
Re: [ptxdist] [PATCH v4 1/2] Add libfaketime as a core component of ptxdist for patchin support
On Wed, Aug 8, 2018 at 6:58 AM Jon Ringle wrote: > On Wed, Aug 8, 2018 at 5:50 AM Roland Hieber wrote: >> On Fri, Aug 03, 2018 at 11:44:55AM -0400, j...@ringle.org wrote: >> > From: Jon Ringle >> > >> > libfaketime will be used during patchin so that committer timestamps always >> > have a fixed value and therefore making the ${PKG}_SERIES_SHA256 value >> > repeatable >> > >> > The minimal set of source files was picked out of libfaketime-0.9.7 >> > >> > Signed-off-by: Jon Ringle >> > --- >> > Makefile.in | 14 +- >> > scripts/libfaketime/Makefile | 118 ++ >> > scripts/libfaketime/faketime.c| 385 ++ >> > scripts/libfaketime/faketime_common.h | 61 + >> > scripts/libfaketime/libfaketime.c | 2410 >> > + >> > scripts/libfaketime/libfaketime.map | 10 + >> > scripts/libfaketime/time_ops.h| 104 ++ >> >> Uh. Does it really make more sense to vendor libfaketime instead of >> using the package from the host system, like we do it with python, bash, >> etc.? > > > The reason that this is needed as a core component of ptxdist rather than > just being built as a host package is that patchin step uses libfaketime and > therefore is potentially needed before even a single package is ever built. > What would happen if we just used a host-libfaketime package and someone adds > a patch series for libfaketime? (In fact, I actually do have such a patch > series locally that I will be sending to the ptxdist ml later). This is a > chicken vs egg problem that is resolved by making libfaketime an integral > part of ptxdist. The ptxdist usage of libfaketime in the patchin step does > not need a patched version of libfaketime (it just needs to set an absolute > date time and the libfaketime code I have here does that). It doesn’t need > new configuration features or bug fixes for fixing the time manipulation via > some specific system call. Roland, I think I see now what you are getting at. However, do you think it is ok to ask everyone to install libfaketime on their system (`sudo apt-get install libfaketime`) before they are able to configure the next version of ptxdist? On ubuntu 14.04 this package installs the following files for me: /usr/lib/x86_64-linux-gnu/faketime/libfaketime.so.1 /usr/lib/x86_64-linux-gnu/faketime/libfaketimeMT.so.1 /usr/share/doc/libfaketime/README.gz /usr/share/doc/libfaketime/changelog.Debian.gz /usr/share/doc/libfaketime/copyright There is nothing here that I see that can be used to properly set the correct location of the libfaketime.so.1 when setting LD_PRELOAD environment. It could be in a different location on some other distribution. The libfaketime code is fairly small and making it a part of ptxdist like kconfig is just makes sense to me given the use case where it is needed -Jon ___ ptxdist mailing list ptxdist@pengutronix.de
Re: [ptxdist] [PATCH v4 1/2] Add libfaketime as a core component of ptxdist for patchin support
On Wed, Aug 8, 2018 at 5:50 AM Roland Hieber wrote: > On Fri, Aug 03, 2018 at 11:44:55AM -0400, j...@ringle.org wrote: > > From: Jon Ringle > > > > libfaketime will be used during patchin so that committer timestamps > always > > have a fixed value and therefore making the ${PKG}_SERIES_SHA256 value > > repeatable > > > > The minimal set of source files was picked out of libfaketime-0.9.7 > > > > Signed-off-by: Jon Ringle > > --- > > Makefile.in | 14 +- > > scripts/libfaketime/Makefile | 118 ++ > > scripts/libfaketime/faketime.c| 385 ++ > > scripts/libfaketime/faketime_common.h | 61 + > > scripts/libfaketime/libfaketime.c | 2410 > + > > scripts/libfaketime/libfaketime.map | 10 + > > scripts/libfaketime/time_ops.h| 104 ++ > > Uh. Does it really make more sense to vendor libfaketime instead of > using the package from the host system, like we do it with python, bash, > etc.? > The reason that this is needed as a core component of ptxdist rather than just being built as a host package is that patchin step uses libfaketime and therefore is potentially needed before even a single package is ever built. What would happen if we just used a host-libfaketime package and someone adds a patch series for libfaketime? (In fact, I actually do have such a patch series locally that I will be sending to the ptxdist ml later). This is a chicken vs egg problem that is resolved by making libfaketime an integral part of ptxdist. The ptxdist usage of libfaketime in the patchin step does not need a patched version of libfaketime (it just needs to set an absolute date time and the libfaketime code I have here does that). It doesn’t need new configuration features or bug fixes for fixing the time manipulation via some specific system call. -Jon ___ ptxdist mailing list ptxdist@pengutronix.de
Re: [ptxdist] [PATCH v4 1/2] Add libfaketime as a core component of ptxdist for patchin support
On Fri, Aug 03, 2018 at 11:44:55AM -0400, j...@ringle.org wrote: > From: Jon Ringle > > libfaketime will be used during patchin so that committer timestamps always > have a fixed value and therefore making the ${PKG}_SERIES_SHA256 value > repeatable > > The minimal set of source files was picked out of libfaketime-0.9.7 > > Signed-off-by: Jon Ringle > --- > Makefile.in | 14 +- > scripts/libfaketime/Makefile | 118 ++ > scripts/libfaketime/faketime.c| 385 ++ > scripts/libfaketime/faketime_common.h | 61 + > scripts/libfaketime/libfaketime.c | 2410 > + > scripts/libfaketime/libfaketime.map | 10 + > scripts/libfaketime/time_ops.h| 104 ++ Uh. Does it really make more sense to vendor libfaketime instead of using the package from the host system, like we do it with python, bash, etc.? - Roland > 7 files changed, 3101 insertions(+), 1 deletion(-) > create mode 100644 scripts/libfaketime/Makefile > create mode 100644 scripts/libfaketime/faketime.c > create mode 100644 scripts/libfaketime/faketime_common.h > create mode 100644 scripts/libfaketime/libfaketime.c > create mode 100644 scripts/libfaketime/libfaketime.map > create mode 100644 scripts/libfaketime/time_ops.h > > diff --git a/Makefile.in b/Makefile.in > index 40c676c..6e08377 100644 > --- a/Makefile.in > +++ b/Makefile.in > @@ -22,7 +22,7 @@ export SHELL > > @BUILD_NCONF_TRUE@NCONF = nconf > > -all: kconfig environment > +all: kconfig libfaketime environment > @touch .done > > kconfig: > @@ -41,6 +41,17 @@ kconfig: > conf mconf $(NCONF) > @echo "done." > > +libfaketime: > + @echo "building libfaketime ..." > + @CC="$(CC)" \ > + CXX="$(CXX)" \ > + CFLAGS="$(CFLAGS)" \ > + CXXFLAGS="$(CXXFLAGS)" \ > + CPPFLAGS="$(CPPFLAGS)" \ > + LDFLAGS="$(LDFLAGS)" \ > + $(MAKE) -C "$(abs_srcdir)/scripts/libfaketime" all > + @echo "done." > + > environment: > @echo -n "preparing PTXdist environment ..." > @ln -sf @AWK@ "$(abs_srcdir)/bin/awk" > @@ -89,6 +100,7 @@ clean: > @rm -f .done > @find "$(abs_srcdir)/bin" -type l -print0 | xargs -0 rm -f > @$(MAKE) -C "$(abs_srcdir)/scripts/kconfig" clean > + @$(MAKE) -C "$(abs_srcdir)/scripts/libfaketime" clean > > dirty-check: > @case "$(version)" in \ > diff --git a/scripts/libfaketime/Makefile b/scripts/libfaketime/Makefile > new file mode 100644 > index 000..a557c38 > --- /dev/null > +++ b/scripts/libfaketime/Makefile > @@ -0,0 +1,118 @@ > +# > +# Notes: > +# > +# * Compilation Defines: > +# > +# FAKE_STAT > +# - Enables time faking also for files' timestamps. > +# > +# NO_ATFILE > +# - Disables support for the fstatat() group of functions > +# > +# PTHREAD > +# - Define this to enable multithreading support. > +# > +# PTHREAD_SINGLETHREADED_TIME > +# - Define this if you want to single-thread time() ... there ARE > +# possibile caching side-effects in a multithreaded environment > +# without this, but the performance impact may require you to > +# try it unsynchronized. > +# > +# FAKE_INTERNAL_CALLS > +# - Also intercept libc internal __functions, e.g. not just time(), > +# but also __time(). Enhances compatibility with applications > +# that make use of low-level system calls, such as Java Virtual > +# Machines. > +# > +# FAKE_SLEEP > +# - Also intercept sleep(), nanosleep(), usleep(), alarm(), > [p]poll() > +# > +# FAKE_TIMERS > +# - Also intercept timer_settime() and timer_gettime() > +# > +# MULTI_ARCH > +# - If MULTI_ARCH is set, the faketime wrapper program will put > a literal > +#$LIB into the LD_PRELOAD environment variable it creates, > which makes > +#ld automatically choose the correct library version to use > for the > +#target binary. Use for Linux platforms with Multi-Arch > support only! > +# > +# * Compilation addition: second libMT target added for building the > pthread- > +# enabled library as a separate library > +# > +# * Compilation switch change: previous versions compiled using > '-nostartfiles' > +# This is no longer the case since there is a 'startup' constructor for > the library > +# which is used to activate the start-at times when specified. This also > initializes > +# the dynamic disabling of the FAKE_STAT calls. > +# > +# By default, libfaketime will be compiled for your system's default > architecture. > +# To build 32-bit libraries and binaries, add -m32 to CFLAGS and LDFLAGS. > +# > +# Change PREFIX to where you want libfaketime (libraries and wrapper binary) > installed. > +# LIBDIRNAME is relative to PREFIX. The default is to install into > $PREFIX/lib/faketime, > +# but you can set LIBDIRNAME to, e.g., /l