From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-3.3 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,T_SCC_BODY_TEXT_LINE, UNPARSEABLE_RELAY autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 13416 invoked from network); 15 Sep 2022 10:19:30 -0000 Received: from zero.zsh.org (2a02:898:31:0:48:4558:7a:7368) by inbox.vuxu.org with ESMTPUTF8; 15 Sep 2022 10:19:30 -0000 ARC-Seal: i=1; cv=none; a=rsa-sha256; d=zsh.org; s=rsa-20210803; t=1663237170; b=p04aa1MWL42XR2NdmP69hYlWgfdPQgjA3S6QiY/zjKXY4lgnV4qRKg0CFiBvwGGFeHqzdYX/SP TzA/jJscvhznVF7VdI0Bm2ChPfR/MEF62ctQ7YWEiryz8+D2dDKZwst6z50ajAPIvLPIT6m98Y kidt8X4279XIAzKDtA4uBwk056MJrg3ag7kqR1j7gfUAp5nfkvDvdijg+j9O73KjmjmpCyIQBH pvMEfOEfiqESO1tR5nrlBz9XYDda6bgj06WJGvrKLdlf1BW4meIyo7/eCbLUyb0icshxgZROvC uitAdDDV7toCOH45pXmmk7e5sbuVlblGngCKYfuvSsVaQA==; ARC-Authentication-Results: i=1; zsh.org; iprev=pass (snd01003-bg.im.kddi.ne.jp) smtp.remote-ip=27.86.113.19; dmarc=none header.from=kba.biglobe.ne.jp; arc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed; d=zsh.org; s=rsa-20210803; t=1663237170; bh=Owr5q+a7bpJLMywIjrQeFclyoQx+mZFRpqbf8x505Bk=; h=List-Archive:List-Owner:List-Post:List-Unsubscribe:List-Subscribe:List-Help: List-Id:Sender:Message-ID:In-Reply-To:To:References:Date:Subject: MIME-Version:Content-Transfer-Encoding:Content-Type:From:DKIM-Signature; b=fLVQAF/BkaR6Vad32jOnItzS//E/UZGWRJUErPtyNTFHPYowB95ciceZtvyXGSfNpuNjCqHRrA izi99CsgB2qaLa8zRMDTbQJTwOL4cHOz3FtVOTQ3RV3rmwWwhEHovsJAVYZFrPI37L+vl1r3iY y5dI0e8Y5X5jFfP/+UiyuDKgmey/Pa1OvUKvFTKn0P0E/2YRrN/WhaXL9KFnQ+wdiZEFXPomkX BJKW+v2AAHi7cW5HUNgOZVOcXElhX04pOsUf5K0n6AJDEB5/d5IbszVreaM9E3Tht0Tb/RLS3D LPOpasjdD0OQeasnCKtyjpLzrqFPDFRB2nm/oBmtHYFhiw==; DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=zsh.org; s=rsa-20210803; h=List-Archive:List-Owner:List-Post:List-Unsubscribe: List-Subscribe:List-Help:List-Id:Sender:Message-Id:In-Reply-To:To:References: Date:Subject:Mime-Version:Content-Transfer-Encoding:Content-Type:From: Reply-To:Cc:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID; bh=xk8V+kQz2oymqsRJEJT1rtsbQJjHV+gnYv7nh4Np8pY=; b=rriwNptgjiEyFKRjhkceJ/QV2E aCZ7x5T/gIteov5c/YAwoUn/qINmnsEHIE+g7H0vpEa6fenrtb7umSXXtFvaqwz4KuDvChwOtRwOd 8RiTkU9Yl4e7XrozQt9t5bj2dQQD/aXfXzW6dfMutqTa5CJ5uf1vUp6IrjIVJ3W6ssIKF4ZdByOIV dq1FrEQqvxfKZraIN7panqFct20l0WZXH2HV7YlyEDUQDisfxjiXwDONT/76NNllbJuArg1s9SgLv ZSA+MffVwF+2faiJzWfpZeMxffoL1/mOfVK9bVf383RHIGs7a/GfAFlv5QG8C1kzwWVFBjyv73UA9 t6mVlViQ==; Received: from authenticated user by zero.zsh.org with local id 1oYlxx-000AYb-Tk; Thu, 15 Sep 2022 10:19:29 +0000 Authentication-Results: zsh.org; iprev=pass (snd01003-bg.im.kddi.ne.jp) smtp.remote-ip=27.86.113.19; dmarc=none header.from=kba.biglobe.ne.jp; arc=none Received: from snd01003-bg.im.kddi.ne.jp ([27.86.113.19]:58529 helo=dfmta1022.biglobe.ne.jp) by zero.zsh.org with esmtps (TLS1.3:TLS_AES_256_GCM_SHA384:256) id 1oYlxc-000ADy-7X; Thu, 15 Sep 2022 10:19:11 +0000 Received: from mail.biglobe.ne.jp by omta1022.biglobe.ne.jp with ESMTP id <20220915101903024.CXNS.129400.mail.biglobe.ne.jp@biglobe.ne.jp> for ; Thu, 15 Sep 2022 19:19:03 +0900 From: Jun T Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable Mime-Version: 1.0 (Mac OS X Mail 12.4 \(3445.104.21\)) Subject: Re: ZSH crashed when reading bytes from a large binary Date: Thu, 15 Sep 2022 19:19:02 +0900 References: <8F410818-257D-470A-B620-2F776E960ABC@kba.biglobe.ne.jp> To: zsh-workers@zsh.org In-Reply-To: Message-Id: <1A4B61B5-447F-45EC-BF07-7B1041814BC6@kba.biglobe.ne.jp> X-Mailer: Apple Mail (2.3445.104.21) X-Biglobe-Sender: takimoto-j@kba.biglobe.ne.jp X-Seq: 50635 Archived-At: X-Loop: zsh-workers@zsh.org Errors-To: zsh-workers-owner@zsh.org Precedence: list Precedence: bulk Sender: zsh-workers-request@zsh.org X-no-archive: yes List-Id: List-Help: List-Subscribe: List-Unsubscribe: List-Post: List-Owner: List-Archive: > 2022/09/15 6:43, Bart Schaefer wrote: >=20 > On Mon, Sep 12, 2022 at 12:37 AM Jun T = wrote: >>=20 >> Can we simply replace them by zrealloc()? >=20 > Replacing them with zrealloc() will still result in immediate exit of > the shell, just with a different error message and no stack trace. On Linux zsh coredumps without any error message if realloc() is used. But getting core would make debug easier... > The specific question here is whether having the "read" builtin return > failure at this point will allow the shell to recover from the > out-of-memory state, or whether it's just delaying the inevitable > death. Consider a script something like: if read x < $file; then # do something else rm $file # it's empty and we can remove it fi Yes, this script is wrong since read returns 1 even if $file is not = empty (if there is no \n). But I fear there may be some (only a few?) users using scripts like this.=