[Buildroot] [autobuild.buildroot.net] Daily results for 2021-08-17

Arnout Vandecappelle arnout at mind.be
Mon Aug 23 22:16:32 UTC 2021



On 24/08/2021 00:06, Thomas Petazzoni wrote:
> Hello,
> 
> On Mon, 23 Aug 2021 22:55:30 +0200
> Arnout Vandecappelle <arnout at 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
> 


More information about the buildroot mailing list