From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 77488 invoked by alias); 14 Sep 2016 19:59:32 -0000 Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-alpha-owner@sourceware.org Received: (qmail 77479 invoked by uid 89); 14 Sep 2016 19:59:32 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.4 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_NONE,RCVD_IN_SORBS_SPAM,SPF_PASS autolearn=no version=3.3.2 spammy=Hx-languages-length:2053, suffice X-HELO: mail-yw0-f177.google.com X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:subject:to:references:cc:from:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding; bh=X88JO0ZheRBp1MNB5hGw0xN2A9k0GpiqRPpEj4Bg4Jw=; b=BBboebT5QlyHiAAlBl+5Vr9UNSXOAs4J/F6d6NX9fZeXi7orilfF3KO55eoSqGvt5K zKAKg04hV1JRvi04QtzbBRh5lKWcYAHsHak+baR71ss+QGZWCY2/l4NWTKpwMkYpJtAK BBSeylLGB/lSdyPXHmVkXQrPJrm7vQFVI9RiisNeD35T0CyUAW7sj81x2Q2swy6VfZra aR2Zw6ZAH660yzNAaNAMfyqj+TfDypk99W013nwr6IiYAcFgX8x3OCUo9egVH4YnflgL L0Uqz/gVuwZCjbvve5ex1xJliSAd806TL3MtNb3Abhw+qFjQPUKVPCiqrhUkWoTmshSd W4aQ== X-Gm-Message-State: AE9vXwM4jzM+Lf9kYahD65OwhUuNzoUXk/7WUmh0N4Cb4OULKxjNvDPOKITk1z0ut/N1C1wV X-Received: by 10.129.94.130 with SMTP id s124mr4915460ywb.172.1473883160169; Wed, 14 Sep 2016 12:59:20 -0700 (PDT) Subject: Re: [PATCH v2 3/3] posix: New Linux posix_spawn{p} implementation To: Rasmus Villemoes References: <1454343665-1706-1-git-send-email-adhemerval.zanella@linaro.org> <1454343665-1706-4-git-send-email-adhemerval.zanella@linaro.org> <87mvjsprqb.fsf@rasmusvillemoes.dk> <874m5iz4ts.fsf@rasmusvillemoes.dk> Cc: Joseph Myers , libc-alpha@sourceware.org From: Adhemerval Zanella Message-ID: Date: Wed, 14 Sep 2016 19:59:00 -0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.2.0 MIME-Version: 1.0 In-Reply-To: <874m5iz4ts.fsf@rasmusvillemoes.dk> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 8bit X-SW-Source: 2016-09/txt/msg00254.txt.bz2 On 14/09/2016 15:58, Rasmus Villemoes wrote: > On Wed, Sep 14 2016, Adhemerval Zanella wrote: > >> I think patch is ok and fixes the issues you noted about using the pipe2 >> call to signal the execv issue. It just have one remark about it below. >> >> >>> @@ -280,14 +267,12 @@ __spawni_child (void *arguments) >>> (2.15). */ >>> maybe_script_execute (args); >>> >>> - ret = -errno; >>> - >>> fail: >>> - /* Since sizeof errno < PIPE_BUF, the write is atomic. */ >>> - ret = -ret; >>> - if (ret) >>> - while (write_not_cancel (p, &ret, sizeof ret) < 0) >>> - continue; >>> + /* errno should have an appropriate non-zero value, but make sure >>> + that's the case so that our parent knows we failed to >>> + exec. There's no EUNKNOWN or EINTERNALBUG, so we use a value >>> + which is clearly bogus. */ >>> + args->err = errno ? : EHOSTDOWN; >>> _exit (SPAWN_ERROR); >>> } >> >> I would prefer an assert call here to ensure errno is non zero for >> failure case instead of reporting a bogus errno to program. Since >> this unexpected issue is either something wrong being reported from >> kernel or an underlying bug it would be better to fail at once than >> instead to document on manuals that this is potentially an unknown >> issue. > > But asserting/aborting in the child doesn't really solve the problem; we > still need to write some non-zero value for the parent to pick up once > we're gone. We could of course write -1 to indicate this really > exceptional situation, but that still leaves deciding how to handle that > in the parent. IMO an assert/abort is a little too harsh, but then the > parent has to return _some_ error code to its caller. My idea is to in fact not return to parent, but rather terminate program execution in face of an unknown issue. However, I do not have a strong opinion if it should be really the desirable behaviour and thinking twice it does seems that aborting program is too harsh. I think -1 would be suffice.