public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
From: Adhemerval Zanella Netto <adhemerval.zanella@linaro.org>
To: Adam Yi <ayi@janestreet.com>
Cc: libc-alpha@sourceware.org, i@adamyi.com
Subject: Re: [PATCH v3] posix: Fix system blocks SIGCHLD erroneously [BZ #30163]
Date: Fri, 3 Mar 2023 09:00:48 -0300	[thread overview]
Message-ID: <96bd4e65-9b53-2392-26f7-aef7dbb984a5@linaro.org> (raw)
In-Reply-To: <CAHwrs-D2KeOPkG-OtOX440QEnA4vheUtYf9WqDh53Vcha3by8A@mail.gmail.com>



On 03/03/23 02:11, Adam Yi wrote:
> Thanks for reviewing!

> 
>     Add some parsing check here:
> 
>        TEST_VERIFY_EXIT  (argv[0] != NULL);
>        char *endptr = NULL;
>        double sec = strtod (argv[0], &endptr);
>        TEST_VERIFY_EXIT (endptr != argv[0] && errno != ERANGE);
>        /* No suffix support and only positive values.  */
>        TEST_VERIFY_EXIT (sec >= 0.0);
> 
> 
> I'm not sure if TEST_VERIFY_EXIT is the correct thing to do here, since it's the mocked /bin/sh,
> not directly part of the test. It's weird that providing invalid argument to `sleep` would crash the shell.
> Would it make more sense to print an error to stderr and return 1? FWIW, I didn't add parsing check
> here because I saw that other functions here do not have any sanity checks. exit and kill are just
> calling atoi without checking for errors and they don't check return values either. There are some
> checks in copy_func but it doesn't even check that there are two arguments before referencing them.

Printing an error to stderr is fine, and indeed it follow better
the mock shell way. 

I want to add some sanity check to avoid issuing invalid argument to sleep 
that returns immediately or setup an unexpected timer, which might be tricky 
to debug (specially in the container environment).  Failing early with a message 
catch possible tests issues.

  reply	other threads:[~2023-03-03 12:00 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-02-24 17:31 [PATCH] " Adam Yi
2023-02-24 15:27 ` [PATCH v3] " Adam Yi
2023-03-02 16:42   ` Adhemerval Zanella Netto
2023-03-03  5:11     ` Adam Yi
2023-03-03 12:00       ` Adhemerval Zanella Netto [this message]
2023-03-06  4:27         ` [PATCH v4] " Adam Yi
2023-03-06  9:04           ` Andreas Schwab
2023-03-07  1:52             ` [PATCH v5] " Adam Yi
2023-03-07 12:18               ` Adhemerval Zanella Netto
2023-03-07 12:33                 ` Florian Weimer
2023-03-07 12:33                   ` Adam Yi
2023-03-07 12:30                     ` [PATCH v6] " Adam Yi
2023-03-07 12:55                       ` Adhemerval Zanella Netto
2023-03-07 22:50                         ` Joseph Myers
2023-03-08  8:17                           ` Adam Yi
2023-02-24 18:00 ` [PATCH] " Adam Yi
2023-02-24 20:18   ` Adhemerval Zanella Netto
2023-03-01  2:36     ` Adam Yi

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=96bd4e65-9b53-2392-26f7-aef7dbb984a5@linaro.org \
    --to=adhemerval.zanella@linaro.org \
    --cc=ayi@janestreet.com \
    --cc=i@adamyi.com \
    --cc=libc-alpha@sourceware.org \
    /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 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).