From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-1.0 required=5.0 tests=MAILING_LIST_MULTI, RCVD_IN_DNSWL_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.2 Received: (qmail 6721 invoked from network); 8 May 2020 20:55:12 -0000 Received-SPF: pass (primenet.com.au: domain of zsh.org designates 203.24.36.2 as permitted sender) receiver=inbox.vuxu.org; client-ip=203.24.36.2 envelope-from= Received: from ns1.primenet.com.au (HELO primenet.com.au) (203.24.36.2) by inbox.vuxu.org with ESMTPUTF8; 8 May 2020 20:55:12 -0000 Received: (qmail 23936 invoked by alias); 8 May 2020 20:55:06 -0000 Mailing-List: contact zsh-workers-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Workers List List-Post: List-Help: List-Unsubscribe: X-Seq: 45795 Received: (qmail 6631 invoked by uid 1010); 8 May 2020 20:55:06 -0000 X-Qmail-Scanner-Diagnostics: from mail-oi1-f194.google.com by f.primenet.com.au (envelope-from , uid 7791) with qmail-scanner-2.11 (clamdscan: 0.102.2/25801. spamassassin: 3.4.4. Clear:RC:0(209.85.167.194):SA:0(-1.9/5.0):. Processed in 2.478879 secs); 08 May 2020 20:55:06 -0000 X-Envelope-From: schaefer@brasslantern.com X-Qmail-Scanner-Mime-Attachments: | X-Qmail-Scanner-Zip-Files: | Received-SPF: pass (ns1.primenet.com.au: SPF record at _netblocks.google.com designates 209.85.167.194 as permitted sender) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=F8Ud2QDwWMX/SGjrep19m9D6dzEHSapZ3k+C76pjrCs=; b=rHTtNYU4l8nWLR62tSRtGS+BuRM7lnkFUU/fe3Mh1RRPFDsyzxmTG7iyRC56aNEIoW YNmrDc+5txcX0h8GP6zdviAzRTvRxRW5Of+PJZFeQIZBZsPhJM9ECpitjvInGRNUYA7I CZHc6h1WlmHrbmKAFu5qfuKGHAWDJTLXoKlaf4FuOp5JP4BS5C0G9n+bTKpAtMmYR0Co IB7yq0nbmLB64WVgSAZvPX2HNYOK6Rm4JjwmKEdcxbktrtCnZMFuF48q9i1Go96pO0qm OheJbcBIF4rJ2PElk8PKbcZ+hhs3UYj9W1KqWiWeU04AkRpk4ghIQd7y0tosJlgCa4sz wCmQ== X-Gm-Message-State: AGi0PuZoVmI/G/0OSfVcl9wTC1aApWtvkO/nP+FfxfIgXUcaKP5bx0yk U1e03Snqt+uTQTWwxeyoSHszA73hkhC/6Q/Xn4DOyBert4E= X-Google-Smtp-Source: APiQypLOg2m8wTODUqMqxjLqpN8dzj0kTzycES4nxLXuTz+lsqG/5vfLR7VI1yPyhQ1Nimy1oVcDd04LjPGuvLjSwOA= X-Received: by 2002:aca:c546:: with SMTP id v67mr11335245oif.84.1588971269965; Fri, 08 May 2020 13:54:29 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Bart Schaefer Date: Fri, 8 May 2020 13:54:18 -0700 Message-ID: Subject: Re: [PATCH] return status 126 for execution failures other than 'not found' To: Martijn Dekker Cc: Zsh hackers list Content-Type: text/plain; charset="UTF-8" On Fri, May 8, 2020 at 1:37 PM Martijn Dekker wrote: > > Currently, the execute() function in Src/exec.c only returns status 126 > if the error code is EACCES (permission denied) or ENOEXEC (exec format > error). In all other cases, 127 is returned. > > That logic is not right, because 127 is the specific case: it is only to > be used if the command was not found. Any failure to execute after the > command is found should yield status 126. Aside from the "zsh is not POSIX unless invoked as sh" standpoint ... > The attached patch changes that logic to return status 127 if there is > no error number (which happens if a PATH search does not find a command) > or if the error number is ENOENT (no such file or directory). In all > other cases it now returns 126. ... shouldn't EPERM also be in that list? A file that's not executable or otherwise not reachable seems to fall into the "not found" category.