public inbox for systemtap@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] dtrace: Allow for reproducible .o file builds
@ 2017-08-10 20:31 Bernhard M. Wiedemann
  2017-08-14 21:37 ` David Smith
  0 siblings, 1 reply; 2+ messages in thread
From: Bernhard M. Wiedemann @ 2017-08-10 20:31 UTC (permalink / raw)
  To: systemtap; +Cc: Bernhard M. Wiedemann

When building packages like libvirt on openSUSE
that link a libvirt_probes.o from dtrace
the build results differed across builds,
because the source's temporary filename was in the .o

See https://reproducible-builds.org/ for why this matters.

---
I tried to think of downsides of not using mkstemp
such as malicious symlink overwrite (unlikely in build dir)
or problems with parallel builds (make -j),
but think it should be fine
---
 dtrace.in | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/dtrace.in b/dtrace.in
index 5e1cf80..2e2e002 100644
--- a/dtrace.in
+++ b/dtrace.in
@@ -410,7 +410,7 @@ def main():
         else:
             print("header: " + fname)
 
-        (ignore, fname) = mkstemp(suffix=".c")
+        fname = filename + ".dtrace-temp.c"
         fdesc = open(fname, mode='w')
         providers.semaphore_write(fdesc)
         fdesc.close()
-- 
2.12.3

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] dtrace: Allow for reproducible .o file builds
  2017-08-10 20:31 [PATCH] dtrace: Allow for reproducible .o file builds Bernhard M. Wiedemann
@ 2017-08-14 21:37 ` David Smith
  0 siblings, 0 replies; 2+ messages in thread
From: David Smith @ 2017-08-14 21:37 UTC (permalink / raw)
  To: Bernhard M. Wiedemann; +Cc: systemtap

On Thu, Aug 10, 2017 at 3:29 PM, Bernhard M. Wiedemann
<bwiedemann@suse.de> wrote:
> When building packages like libvirt on openSUSE
> that link a libvirt_probes.o from dtrace
> the build results differed across builds,
> because the source's temporary filename was in the .o
>
> See https://reproducible-builds.org/ for why this matters.
>
> ---
> I tried to think of downsides of not using mkstemp
> such as malicious symlink overwrite (unlikely in build dir)
> or problems with parallel builds (make -j),
> but think it should be fine
> ---
>  dtrace.in | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/dtrace.in b/dtrace.in
> index 5e1cf80..2e2e002 100644
> --- a/dtrace.in
> +++ b/dtrace.in
> @@ -410,7 +410,7 @@ def main():
>          else:
>              print("header: " + fname)
>
> -        (ignore, fname) = mkstemp(suffix=".c")
> +        fname = filename + ".dtrace-temp.c"
>          fdesc = open(fname, mode='w')
>          providers.semaphore_write(fdesc)
>          fdesc.close()

I couldn't really see any downsides of not using mkstemp either, so I
added this in commit c245153ca.

Thanks for the patch.

-- 
David Smith
Principal Software Engineer
Red Hat

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2017-08-14 21:37 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-08-10 20:31 [PATCH] dtrace: Allow for reproducible .o file builds Bernhard M. Wiedemann
2017-08-14 21:37 ` David Smith

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).