From patchwork Wed Sep 23 10:51:26 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Efraim Flashner X-Patchwork-Id: 313426 Delivered-To: patch@linaro.org Received: by 2002:a92:5ad1:0:0:0:0:0 with SMTP id b78csp354447ilg; Wed, 23 Sep 2020 03:52:24 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzq+1Dtz0tYWw+NtFwz+furNggsX1n0GFhsAHsl/iGjhaNBKbfl8XS143ZilYhQ4ibn0daG X-Received: by 2002:a17:906:594c:: with SMTP id g12mr9831190ejr.347.1600858344000; Wed, 23 Sep 2020 03:52:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1600858343; cv=none; d=google.com; s=arc-20160816; b=sR6TDn22D1U/Lx1q7LyRjIDLPq3LgrUpYtbCHPNuDG2lx63B9G9vblvlch1TqTtdNP TGsvfqUnCS9xDdpUf5Wuh/VTfZ9DfmBc94sEpDdgBu7f/s+pibz2tZcoji26mddgMN1X sDxsg//ZAH7LrDMp3bhHA5w1tIo1ti0ggdIUXoiuTni7dhpTdZ9n/u43BeI4+34RCIGd oMny+UJtRdQUGDCDvmf/JmsjFU2aNf35gMhtwmW4dz1eoq7xBXC199yinvfzEzRXerpM Q+XjldASL6ghQ+jExonjoBs+Ch57a8YESCVKEoJ+G6KVPVP6vV//68Vx7+3LJaNUy50C ZRhw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:message-id:date:subject:to:from:dmarc-filter :delivered-to; bh=dpjMvtSnEPUjCMn0EPCYJBdQT7EaGeX6X1DcoON6pL8=; b=dMNaRJMjc4rlaVzYzfYTiHLUcWglc4w3Is7xiZ8FykzW+ni2Ed4yFxysYe9qcDC6tS L7P/jClxyjykmFWLCNRri5ru/zELn32l7Loqb0fRpecRr1p+trTDMKRH6DSfkdGu+LxB 88ebNzQyrLp6ljn9FNZkXRwKcYVt+mOXpWGGNZpRpRYIRCg6FRTtwpovnWh9lcitlX7a NQM3/WMXjvBLMoFzCnyiq860elJ+4zy42DsPXT48NsV9NpkKySfZkyEqiGnGBPU86gNO A4YukMSF6kWxJbJ5zjuSSJskmcb9WmfHZqBXxlf6suQtXbBaPHKP/fADiybXbpdkeBuU 2D8w== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of libc-alpha-bounces@sourceware.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom=libc-alpha-bounces@sourceware.org Return-Path: Received: from sourceware.org (server2.sourceware.org. [2620:52:3:1:0:246e:9693:128c]) by mx.google.com with ESMTPS id p16si13135594ejw.31.2020.09.23.03.52.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 23 Sep 2020 03:52:23 -0700 (PDT) Received-SPF: pass (google.com: domain of libc-alpha-bounces@sourceware.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) client-ip=2620:52:3:1:0:246e:9693:128c; Authentication-Results: mx.google.com; spf=pass (google.com: domain of libc-alpha-bounces@sourceware.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom=libc-alpha-bounces@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id F1BB13949D97; Wed, 23 Sep 2020 10:52:18 +0000 (GMT) X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from flashner.co.il (flashner.co.il [178.62.234.194]) by sourceware.org (Postfix) with ESMTP id CD0F33894C3E for ; Wed, 23 Sep 2020 10:52:16 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org CD0F33894C3E Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=flashner.co.il Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=efraim@flashner.co.il Received: from localhost (unknown [31.210.181.177]) by flashner.co.il (Postfix) with ESMTPSA id 05DBC40049; Wed, 23 Sep 2020 10:52:14 +0000 (UTC) From: Efraim Flashner To: libc-alpha@sourceware.org Subject: [PATCH] posix: Don't automatically fail if _LIBC_REENTRANT isn't defined. Date: Wed, 23 Sep 2020 13:51:26 +0300 Message-Id: <20200923105126.13566-1-efraim@flashner.co.il> X-Mailer: git-send-email 2.28.0 MIME-Version: 1.0 X-Spam-Status: No, score=-2.5 required=5.0 tests=BAYES_00, GIT_PATCH_0, KAM_DMARC_STATUS, KAM_SHORT, RCVD_IN_ABUSEAT, RCVD_IN_BARRACUDACENTRAL, RCVD_IN_SBL_CSS, SPF_HELO_PASS, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Efraim Flashner Errors-To: libc-alpha-bounces@sourceware.org Sender: "Libc-alpha" If status is instantiated as -1 then do_system() will always fail in some circumstances. --- I was working on porting GNU Guix to powerpc-linux and I stumbled across what I'm assuming is a bug. As part of building the bootstrap binaries to build the entire system a static copy of guile is created, using a static copy of glibc. When this copy of guile was used inside a Guix build container the 'system' command from guile would unconditionally error. 'system' uses the default 'sh' (https://www.gnu.org/software/guile/manual/html_node/Processes.html#index-system) which, for the static glibc, we've patched to be 'sh' and not '/bin/sh' so guile can find it in the environment, which intentionally lacks /bin/sh. This has worked for all the other architectures we support. When I was looking through code to see what might've changed I realized that most instances of status were changed to ret, and status was now initialized to -1. By either reverting [BZ #25715] f09542c584b121da0322fde4b55306d512b85d93 or by initializing status to 0 I was able to continue with the porting effort. --- sysdeps/posix/system.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- 2.28.0 diff --git a/sysdeps/posix/system.c b/sysdeps/posix/system.c index a03f478fc7..19d07d2581 100644 --- a/sysdeps/posix/system.c +++ b/sysdeps/posix/system.c @@ -101,7 +101,7 @@ cancel_handler (void *arg) static int do_system (const char *line) { - int status = -1; + int status = 0; int ret; pid_t pid; struct sigaction sa;