From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: X-Spam-Status: No, score=-3.4 required=3.0 tests=AWL,BAYES_00, FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI,SPF_HELO_NONE,SPF_PASS shortcircuit=no autolearn=ham autolearn_force=no version=3.4.6 Received: from out1.vger.email (out1.vger.email [IPv6:2620:137:e000::1:20]) by dcvr.yhbt.net (Postfix) with ESMTP id 15E151F406 for ; Thu, 17 Aug 2023 09:25:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1349518AbjHQJYu (ORCPT ); Thu, 17 Aug 2023 05:24:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39654 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1349514AbjHQJYb (ORCPT ); Thu, 17 Aug 2023 05:24:31 -0400 Received: from bluemchen.kde.org (bluemchen.kde.org [IPv6:2001:470:142:8::100]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A5C82271B for ; Thu, 17 Aug 2023 02:24:29 -0700 (PDT) Received: from ugly.fritz.box (localhost [127.0.0.1]) by bluemchen.kde.org (Postfix) with ESMTP id 1AFD724309; Thu, 17 Aug 2023 05:24:26 -0400 (EDT) Received: by ugly.fritz.box (masqmail 0.3.6-dev, from userid 1000) id 1qWZEw-LEP-00; Thu, 17 Aug 2023 11:24:26 +0200 Date: Thu, 17 Aug 2023 11:24:26 +0200 From: Oswald Buddenhagen To: Junio C Hamano Cc: git@vger.kernel.org Subject: Re: [Leftoverbits] exit code clean-up? Message-ID: References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org On Wed, Aug 16, 2023 at 10:04:28AM -0700, Junio C Hamano wrote: >"git help git" does not have "EXIT CODES" section, and it is assumed >that the "common sense" of older generation [...] that exiting with 0 >is success and non-zero is failure is shared among its users, which >might not be warranted these days. > well, that's actually a standard (exit(3) has things to say about it), and given how shell scripts treat exit codes, there is no wiggle room here. just about every shell intro tutorial explains it. >We could either > > * Be more prescriptive and add "EXIT CODES" section to each and > every document to describe how we fail in the current code. > >or > > * Describe "In general, 0 is success, non-zero is failure, but some > commands may signal more than that with its non-zero exit codes" > in "git help git", and add "EXIT CODES" section to the manual > page of the commands whose exit codes matter (there are a > handful, like "git diff --exit-code" that explicitly says "1" is > the signal that it found difference as opposed to it failing). > i'd go with the second, with some minor modifications: - 1 is the by far most common non-zero error code (and it matches EXIT_FAILURE on all relevant systems), so it's ok to state that. it may be wise to actually check that commands don't deviate from it needlessly. - the canonical name of the section appears to be "EXIT STATUS" regards