build: Used FAIL_EXIT1 () on failure to exec child [BZ #23990]

Message ID CALkY8p8m=_f0fqkWmZ2cpxvXa+ePCfnMLng4QdU-ABtiOb9zHg@mail.gmail.com
State Committed
Headers
Series build: Used FAIL_EXIT1 () on failure to exec child [BZ #23990] |

Commit Message

Girish Joshi May 9, 2020, 8:02 p.m. UTC
  From 9c3e8d18343e29aa1f65d1403d4c3878dd2b9865 Mon Sep 17 00:00:00 2001
From: Girish Joshi <girish946@gmail.com>
Date: Sun, 10 May 2020 01:22:04 +0530
Subject: [PATCH] build: Used FAIL_EXIT1 () on failure to exec child [BZ
#23990]

---
support/test-container.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)




Girish Joshi
  

Comments

Florian Weimer May 11, 2020, 12:14 p.m. UTC | #1
* Girish Joshi via Libc-alpha:

> diff --git a/support/test-container.c b/support/test-container.c
> index afc23db148..1423320b8a 100644
> --- a/support/test-container.c
> +++ b/support/test-container.c
> @@ -392,7 +392,7 @@ recursive_remove (char *path)
> /* "rm" would have already printed a suitable error message. */
> if (! WIFEXITED (status)
> || WEXITSTATUS (status) != 0)
> - exit (1);
> + FAIL_EXIT1 ("failed to exec child");
> break;
> }

Sorry, this patch arrived corrupted on the list.

The error message is not correct because the child process returned an
error status.  This can mean that execvp failed, or something else.  It
would also make sense to add the status value to the error message.

Thanks,
Florian
  
Girish Joshi May 23, 2020, 10:02 a.m. UTC | #2
Thanks Florian for the review.

> Sorry, this patch arrived corrupted on the list.
>
> The error message is not correct because the child process returned an
> error status.  This can mean that execvp failed, or something else.  It
> would also make sense to add the status value to the error message.
>

Reposting the patch with corrected error message.
Please let me know if it works.

From f1cc58ee37ded9a6bb3f5764143c6ea8c3572741 Mon Sep 17 00:00:00 2001
From: Girish Joshi <girish946@gmail.com>
Date: Sun, 10 May 2020 01:22:04 +0530
Subject: [PATCH] build: Used FAIL_EXIT1 () on failure to exec child BZ #23990

---
 support/test-container.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/support/test-container.c b/support/test-container.c
index afc23db148..e9109f9e3d 100644
--- a/support/test-container.c
+++ b/support/test-container.c
@@ -392,7 +392,7 @@ recursive_remove (char *path)
     /* "rm" would have already printed a suitable error message.  */
     if (! WIFEXITED (status)
     || WEXITSTATUS (status) != 0)
-      exit (1);
+      FAIL_EXIT1 ("exec child returned status: %d", status);

     break;
   }
  
Girish Joshi May 23, 2020, 10:05 a.m. UTC | #3
Thanks Florian for the review.

> Sorry, this patch arrived corrupted on the list.
>
> The error message is not correct because the child process returned an
> error status.  This can mean that execvp failed, or something else.  It
> would also make sense to add the status value to the error message.
>
> Thanks,
> Florian
>

Reposting the patch with corrected error message.
Please let me know if it works.

From f1cc58ee37ded9a6bb3f5764143c6ea8c3572741 Mon Sep 17 00:00:00 2001
From: Girish Joshi <girish946@gmail.com>
Date: Sun, 10 May 2020 01:22:04 +0530
Subject: [PATCH] build: Used FAIL_EXIT1 () on failure to exec child BZ #23990

---
 support/test-container.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/support/test-container.c b/support/test-container.c
index afc23db148..e9109f9e3d 100644
--- a/support/test-container.c
+++ b/support/test-container.c
@@ -392,7 +392,7 @@ recursive_remove (char *path)
     /* "rm" would have already printed a suitable error message.  */
     if (! WIFEXITED (status)
     || WEXITSTATUS (status) != 0)
-      exit (1);
+      FAIL_EXIT1 ("exec child returned status: %d", status);

     break;
   }
--
2.21.3

Thanks.

Girish Joshi
  
Adhemerval Zanella Netto May 29, 2020, 1:16 p.m. UTC | #4
On 23/05/2020 07:05, Girish Joshi via Libc-alpha wrote:
> Thanks Florian for the review.
> 
>> Sorry, this patch arrived corrupted on the list.
>>
>> The error message is not correct because the child process returned an
>> error status.  This can mean that execvp failed, or something else.  It
>> would also make sense to add the status value to the error message.
>>
>> Thanks,
>> Florian
>>
> 
> Reposting the patch with corrected error message.
> Please let me know if it works.
> 
> From f1cc58ee37ded9a6bb3f5764143c6ea8c3572741 Mon Sep 17 00:00:00 2001
> From: Girish Joshi <girish946@gmail.com>
> Date: Sun, 10 May 2020 01:22:04 +0530
> Subject: [PATCH] build: Used FAIL_EXIT1 () on failure to exec child BZ #23990

LGTM, thanks.

I will push it upstream for you.

Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>

> 
> ---
>  support/test-container.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/support/test-container.c b/support/test-container.c
> index afc23db148..e9109f9e3d 100644
> --- a/support/test-container.c
> +++ b/support/test-container.c
> @@ -392,7 +392,7 @@ recursive_remove (char *path)
>      /* "rm" would have already printed a suitable error message.  */
>      if (! WIFEXITED (status)
>      || WEXITSTATUS (status) != 0)
> -      exit (1);
> +      FAIL_EXIT1 ("exec child returned status: %d", status);
> 
>      break;
>    }
> --
> 2.21.3
> 
> Thanks.
> 
> Girish Joshi
>
  
Girish Joshi May 30, 2020, 4:29 p.m. UTC | #5
> LGTM, thanks.
>
> I will push it upstream for you.
>
> Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>

Thanks Adhemerval.

Girish Joshi
  

Patch

diff --git a/support/test-container.c b/support/test-container.c
index afc23db148..1423320b8a 100644
--- a/support/test-container.c
+++ b/support/test-container.c
@@ -392,7 +392,7 @@  recursive_remove (char *path)
/* "rm" would have already printed a suitable error message. */
if (! WIFEXITED (status)
|| WEXITSTATUS (status) != 0)
- exit (1);
+ FAIL_EXIT1 ("failed to exec child");
break;
}
-- 
2.21.3