[v4,1/5] autobuild-run: check if reproducibile_results exists before checking its size
diff mbox series

Message ID 20190820145231.15507-1-itsatharva@gmail.com
State New
Headers show
Series
  • [v4,1/5] autobuild-run: check if reproducibile_results exists before checking its size
Related show

Commit Message

Atharva Lele Aug. 20, 2019, 2:52 p.m. UTC
This was causing some reproducible configs to crash autobuild script since it
tried to check the size of a file that did not exist.

Signed-off-by: Atharva Lele <itsatharva@gmail.com>
---
 scripts/autobuild-run | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Arnout Vandecappelle Sept. 8, 2019, 4:43 p.m. UTC | #1
On 20/08/2019 16:52, Atharva Lele wrote:
> This was causing some reproducible configs to crash autobuild script since it
> tried to check the size of a file that did not exist.

 How does it happen that it doesn't exist? A few lines above, we have:

with open(reproducible_results, 'w') as diff:
   ..

This will create the file, even if nothing is written to it.

 Or maybe this issue only occurs after patch 4 has been applied?

 Regards,
 Arnout

> 
> Signed-off-by: Atharva Lele <itsatharva@gmail.com>
> ---
>  scripts/autobuild-run | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/scripts/autobuild-run b/scripts/autobuild-run
> index ead81a0..99b57dd 100755
> --- a/scripts/autobuild-run
> +++ b/scripts/autobuild-run
> @@ -461,7 +461,7 @@ class Builder:
>                  log_write(self.log, "INFO: diffoscope not installed, falling back to cmp")
>                  subprocess.call(["cmp", "-b", build_1_image, build_2_image], stdout=diff, stderr=self.log)
>  
> -        if os.stat(reproducible_results).st_size > 0:
> +        if os.path.exists(reproducible_results) and os.stat(reproducible_results).st_size > 0:
>              log_write(self.log, "INFO: Build is non-reproducible.")
>              return -1
>  
>
Atharva Lele Sept. 12, 2019, noon UTC | #2
On Sun, Sep 8, 2019 at 10:13 PM Arnout Vandecappelle <arnout@mind.be> wrote:
>
>
>
> On 20/08/2019 16:52, Atharva Lele wrote:
> > This was causing some reproducible configs to crash autobuild script since it
> > tried to check the size of a file that did not exist.
>
>  How does it happen that it doesn't exist? A few lines above, we have:
>

Exactly. I was baffled by this as well. It seems to happen randomly.

> with open(reproducible_results, 'w') as diff:
>    ..
>
> This will create the file, even if nothing is written to it.
>
>  Or maybe this issue only occurs after patch 4 has been applied?
>

It occurs even without patch 4 applied.

>  Regards,
>  Arnout
>
> >
> > Signed-off-by: Atharva Lele <itsatharva@gmail.com>
> > ---
> >  scripts/autobuild-run | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/scripts/autobuild-run b/scripts/autobuild-run
> > index ead81a0..99b57dd 100755
> > --- a/scripts/autobuild-run
> > +++ b/scripts/autobuild-run
> > @@ -461,7 +461,7 @@ class Builder:
> >                  log_write(self.log, "INFO: diffoscope not installed, falling back to cmp")
> >                  subprocess.call(["cmp", "-b", build_1_image, build_2_image], stdout=diff, stderr=self.log)
> >
> > -        if os.stat(reproducible_results).st_size > 0:
> > +        if os.path.exists(reproducible_results) and os.stat(reproducible_results).st_size > 0:
> >              log_write(self.log, "INFO: Build is non-reproducible.")
> >              return -1
> >
> >

Apologies for the late reply. I was recommended to rest for a couple
of days after being hit by the flu.

Patch
diff mbox series

diff --git a/scripts/autobuild-run b/scripts/autobuild-run
index ead81a0..99b57dd 100755
--- a/scripts/autobuild-run
+++ b/scripts/autobuild-run
@@ -461,7 +461,7 @@  class Builder:
                 log_write(self.log, "INFO: diffoscope not installed, falling back to cmp")
                 subprocess.call(["cmp", "-b", build_1_image, build_2_image], stdout=diff, stderr=self.log)
 
-        if os.stat(reproducible_results).st_size > 0:
+        if os.path.exists(reproducible_results) and os.stat(reproducible_results).st_size > 0:
             log_write(self.log, "INFO: Build is non-reproducible.")
             return -1