From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-3.2 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_EF,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED autolearn=ham autolearn_force=no version=3.4.4 Received: from zero.zsh.org (zero.zsh.org [IPv6:2a02:898:31:0:48:4558:7a:7368]) by inbox.vuxu.org (Postfix) with ESMTP id 68F892EEBD for ; Sun, 8 Sep 2024 22:13:01 +0200 (CEST) ARC-Seal: i=1; cv=none; a=rsa-sha256; d=zsh.org; s=rsa-20210803; t=1725826381; b=gD+pLUgs70Qi7GszwBcnaU24jIWG0/0F6KoXuRtaq3YO/eZQpBkOULdeUIAKiOgdU86ShP+3Kr doCk6EwOQSgT4hj1P1BG7o3bEzzO+oexJRC/ScE2iy7wBQtUGobdE5vF2KePFFRluCct3/4VPP PKt9lNo1bYRNL5fwuRUqgA6M9N18d/0H8mXNY50aF0L5QXgoNz3Q2HB8FJlrNWV26rq+DbntHi 9Snml/sOzeIGFKVK9s3WFAOQnhwT1AfGcjFE4NtsGmQh3WRwdLpyXCbszvuEXEmLGdM1cM/qC0 yHajBizFEv81VQGBidB9ezLk3LwcHH4xP10roHi13faMrQ==; ARC-Authentication-Results: i=1; zsh.org; iprev=pass (mail-wm1-f41.google.com) smtp.remote-ip=209.85.128.41; dkim=pass header.d=brasslantern-com.20230601.gappssmtp.com header.s=20230601 header.a=rsa-sha256; dmarc=none header.from=brasslantern.com; arc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed; d=zsh.org; s=rsa-20210803; t=1725826381; bh=lQ7R/vwzedobNxRQioIBgynLcYDnGtCbMJ9SVB+UdAs=; h=List-Archive:List-Owner:List-Post:List-Unsubscribe:List-Subscribe:List-Help: List-Id:Sender:Content-Type:To:Subject:Message-ID:Date:From:MIME-Version: DKIM-Signature:DKIM-Signature; b=jPp0/e6lLw/UHE4fmKV54mdtj4gy8UnOPo9L8gdycT2FcM9B2n8rZHSMrRwhPy3EFwNOP2WiNu RNIqU3Kqc8M1xw6tS9N8/f32XKILSIOjLN5HBFA03OBByDTx7uJGJ8JxcGof9fdghm2D78favf 6lTM3tbWklbRejS00TFGEhXxSyjfunQz98kUvnKrNsjBtJvIZJPtLpAF+SBaJkYH15ojkG0ZBs koMUL1Ny594utaZ8zMLZ6fPVNihEnov627yvA2coXMMCXKqp+HrFDlV0KaFqty2z+VQAjWjNFa DXx4ThEjF1QAbf/q8rhTyuYnAY8xPNg3YtkOf+tlEVaPdA==; 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:Content-Type:To:Subject:Message-ID: Date:From:MIME-Version:Reply-To:Cc:Content-Transfer-Encoding:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:In-Reply-To:References; bh=hHj7naGz3SduN0UBubuI87NTqdtL82AEnYvbw7ZYnYg=; b=JStn4agJLwUZi6GOn4fb0GEWt9 nInJu77caXb/MKPMoUUU+61Xo8s9ARjSd8RXPoQ1InGL0ytcaaCO/6FvzwZKJHSKViGOBTgGXm+ZB sGY+Hra0DJj/kxWvUg3FC3qAhYEgI5pOHHBexo2yOvd5QplvGqHm9FiuCKV0TR2r5b/tArvGJkRSN AgFodzUwfk5ODC5yLIT1kSPHrBXjoPDE/XyAPWNN6mpw+CkPgMY4SUsUv8FRlAga4X9pX1361G6/U ep58y+STW03X3Mpitq8kWIK6dkRKvqGdcF9bXQCnwfew5QAYXTh3Y9lQ62Bq5WNg1UySv78z4Xcnw il5cYTHA==; Received: by zero.zsh.org with local id 1snOHL-0000Os-FS; Sun, 08 Sep 2024 20:12:59 +0000 Authentication-Results: zsh.org; iprev=pass (mail-wm1-f41.google.com) smtp.remote-ip=209.85.128.41; dkim=pass header.d=brasslantern-com.20230601.gappssmtp.com header.s=20230601 header.a=rsa-sha256; dmarc=none header.from=brasslantern.com; arc=none Received: from mail-wm1-f41.google.com ([209.85.128.41]:38283) by zero.zsh.org with esmtps (TLS1.3:TLS_AES_128_GCM_SHA256:128) id 1snOH3-00007c-2P; Sun, 08 Sep 2024 20:12:42 +0000 Received: by mail-wm1-f41.google.com with SMTP id 5b1f17b1804b1-42cb0d0311fso1841945e9.1 for ; Sun, 08 Sep 2024 13:12:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=brasslantern-com.20230601.gappssmtp.com; s=20230601; t=1725826360; x=1726431160; darn=zsh.org; h=to:subject:message-id:date:from:mime-version:from:to:cc:subject :date:message-id:reply-to; bh=hHj7naGz3SduN0UBubuI87NTqdtL82AEnYvbw7ZYnYg=; b=s86slXlJDsZk8EeYf+fFL7pjybuiApjEKYvEOo45xA00S2dGEyOO42OgTLhXriRGeJ nbDIGmghGxI62zZl49GzTBo5/nbdScwu6/4qkTh+9LhLZzMNIVaGWZRns2If2bbf+jUo vhT3w2ErnSxIov8vxK5uexAES+xLxL0uf8TL2zp4J5X/zScr7ym1CbKo6yxts6SQrTvV IegxQnt7NwGYh4nPjG4IJ2EHkg7FhzEUMs8pjiQCBoWR+VJMsK1Ak936vYqVZRGwL9GK uJJn1kzFDyUebNaE3FLf17OJ9xnqvWgBsZSktBezpcZCOqYL8MhQtpPlGAzC7shH6aXE ph4w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1725826360; x=1726431160; h=to:subject:message-id:date:from:mime-version:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=hHj7naGz3SduN0UBubuI87NTqdtL82AEnYvbw7ZYnYg=; b=weF29s6b0pkXGqsCVIGk8ex46SHiQdkWETqDi7L/QdIlTej1NYjWGUGDjMThzP3zZD rKAFj8e5K5UouWb3J/A6fSLUE0u1DFKnAO4y6B9pn/p2nhL+JyhqKQljJeFvxRWRnzoc fwJ9oyDGiO+D6sp1LJqudCMf5CwMmIEYaCjme2pI33FKlcMOyPFaE/BfK4BwGsFqceke LrcnNszIK41aR0LYnqTbu704qmRu/OWMLsRKZC1f8s7jv6uwCq2P6M7VYHEFCebdw4cv 8jzrt+VMZJQZT92RUz1Qw51bRXLRe6eWUjY5kBoklnLilOdzyD6KyCOCZsJZYqP8OvNA rtfA== X-Gm-Message-State: AOJu0Yx09JFKOweeFNrsroZcBVKvAYSuUhqEkIxmx5JTIOmfKnKPALXP CTfCPrDFQ83/65uWk9OscURBXUe5Kbg1wxBjNW1jZ2URVGClj1TihL3zcAQYgbsU8i4XT3NXdpQ NTVPI1ctLJSA/CUhZaD15HPCSjc1BWEH8OWJVrtIx8zTat1deMw== X-Google-Smtp-Source: AGHT+IGHjdIYDs1KMsdr1/IWTA048ZrzKR12REQsfdlgSLH+oR9zYvfmsu4U78Jbr4xPKHbNAccKHx3EZcYaw0RygW4= X-Received: by 2002:a05:6000:1acc:b0:378:955f:cc09 with SMTP id ffacd0b85a97d-378955fcc34mr1710269f8f.11.1725826360038; Sun, 08 Sep 2024 13:12:40 -0700 (PDT) MIME-Version: 1.0 From: Bart Schaefer Date: Sun, 8 Sep 2024 13:12:28 -0700 Message-ID: Subject: "time" and "exec" behavior To: Zsh hackers list Content-Type: text/plain; charset="UTF-8" X-Seq: 53075 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: Tangentially to getting time stats for builtins, I've noticed that in bash, if execve() fails, control returns to the surrounding context, which means among other things you can get timings for failed "exec". Conversely in zsh "exec" is final -- if e.g. the command is not found, an error is printed but the shell goes away anyway. This is tricky to change because the parent shell has thrown away a lot of context (including but not limited to whether ZLE is active) before reaching the point of calling zexecve(). It's even a bit more convoluted if "command -p" was used. Thoughts? (The branch with _realexit() off the top of the following non-patch is for commandnotfound() handling.) diff --git a/Src/exec.c b/Src/exec.c index 00278ac50..8aa7466f5 100644 --- a/Src/exec.c +++ b/Src/exec.c @@ -881,6 +881,10 @@ execute(LinkList args, int flags, int defpath) _realexit(); else zerr("command not found: %s", arg0); + /* This is bash behavior, but fails to restore interactive settings etc. + lastval = ((eno == EACCES || eno == ENOEXEC) ? 126 : 127); + return; + */ _exit((eno == EACCES || eno == ENOEXEC) ? 126 : 127); }