All of lore.kernel.org
 help / color / mirror / Atom feed
From: Arnout Vandecappelle <arnout@mind.be>
To: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
Cc: "Yann E. MORIN" <yann.morin.1998@free.fr>, buildroot@buildroot.org
Subject: Re: [Buildroot] [autobuild.buildroot.net] Daily results for 2021-08-17
Date: Tue, 24 Aug 2021 00:16:32 +0200	[thread overview]
Message-ID: <efc23fd6-91e4-a26c-c38a-5802ace44c28@mind.be> (raw)
In-Reply-To: <20210824000634.07d68905@windsurf>



On 24/08/2021 00:06, Thomas Petazzoni wrote:
> Hello,
> 
> On Mon, 23 Aug 2021 22:55:30 +0200
> Arnout Vandecappelle <arnout@mind.be> wrote:
> 
>>  I have a theory, but it's a bit far out... We basically have this:
>>
>> gcc -o empty empty.c
>> objcopy --dump-section .interp=/dev/stdout empty > loader.txt
>>
>> The timestamp of 'empty' is going to be near the end of the gcc run. The
>> timestamp of 'loader.txt', on the other hand, is going to be all the way at the
>> beginning of the shell run. So, if the filesystem doesn't have nanosecond
>> precision, it's possible that 'empty' and 'loader.txt' have the same timestamp.
>>
>>  It's not a good theory, though, because make shouldn't consider 'loader.txt'
>> older than 'empty' if they have exactly the same timestamp.
>>
>>
>>
>>  Ooh, I just discovered something nasty! Apparently, objcopy updates the
>> modification time of its input file...
>>
>> $ touch empty; ls -l --full-time empty loader.txt; make SHARED=yes loader.txt;
>> ls -l --full-time empty loader.txt
>> -rwxr-xr-x 1 arnout arnout 24K 2021-08-23 22:53:27.450172624 +0200 empty*
>> -rw-r--r-- 1 arnout arnout  28 2021-08-23 22:52:57.949935937 +0200 loader.txt
>> objcopy --dump-section .interp=/dev/stdout empty > loader.txt
>> -rwxr-xr-x 1 arnout arnout 24K 2021-08-23 22:53:27.563173530 +0200 empty*
>> -rw-r--r-- 1 arnout arnout  28 2021-08-23 22:53:27.563173530 +0200 loader.txt
>>
>> I guess this way there is some chance that loader.txt gets a modification time
>> just before the updated mtime of empty...
>>
>> So the solution would be to touch loader.txt just after creating it. We could
>> patch it like that, give it a go in the autobuilders, then send the patch upstream?
> 
> Wow, great investigation! Really odd that objcopy updates the mtime of
> its input file, though.

 The man page says:

       infile
       outfile
           The input and output files, respectively.  If you do not specify
outfile, objcopy creates a temporary file and destructively renames the result
with the name of infile.


 strace shows that that is exactly what it does.

 With the following command, it no longer overwrites the input file:

objcopy --dump-section .interp=loader.txt empty /dev/null


 I'll spin up a patch.


 Regards,
 Arnout

> 
> Thomas
> 
_______________________________________________
buildroot mailing list
buildroot@busybox.net
http://lists.busybox.net/mailman/listinfo/buildroot

  reply	other threads:[~2021-08-23 22:16 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-18  6:57 [Buildroot] [autobuild.buildroot.net] Daily results for 2021-08-17 Thomas Petazzoni
2021-08-18 10:25 ` Thomas Petazzoni
2021-08-18 11:05   ` Yann E. MORIN
2021-08-18 20:18     ` Thomas Petazzoni
2021-08-18 21:04       ` Yann E. MORIN
2021-08-23 20:55         ` Arnout Vandecappelle
2021-08-23 22:06           ` Thomas Petazzoni
2021-08-23 22:16             ` Arnout Vandecappelle [this message]
2021-08-18 21:44 ` [Buildroot] Analysis of build " Thomas Petazzoni
2021-08-18 22:24   ` Giulio Benetti
2021-08-18 22:26     ` Giulio Benetti
2021-08-19  0:01     ` Giulio Benetti
2021-08-19 13:28     ` Thomas Petazzoni
2021-08-20 14:26       ` Giulio Benetti
2021-08-20 22:00         ` Giulio Benetti
2021-08-21 23:08     ` Giulio Benetti
2021-08-19  9:27   ` Arnout Vandecappelle
2021-08-19 13:24     ` Thomas Petazzoni

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=efc23fd6-91e4-a26c-c38a-5802ace44c28@mind.be \
    --to=arnout@mind.be \
    --cc=buildroot@buildroot.org \
    --cc=thomas.petazzoni@bootlin.com \
    --cc=yann.morin.1998@free.fr \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.