From patchwork Mon Jan 28 15:58:24 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Olivier Duclos X-Patchwork-Id: 10784151 X-Patchwork-Delegate: herbert@gondor.apana.org.au Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 875F7922 for ; Mon, 28 Jan 2019 17:31:14 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7184D2BD87 for ; Mon, 28 Jan 2019 17:31:14 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 6FB072BDFD; Mon, 28 Jan 2019 17:31:14 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id ECE642BD87 for ; Mon, 28 Jan 2019 17:31:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730105AbfA1P61 (ORCPT ); Mon, 28 Jan 2019 10:58:27 -0500 Received: from wout2-smtp.messagingengine.com ([64.147.123.25]:60823 "EHLO wout2-smtp.messagingengine.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729855AbfA1P60 (ORCPT ); Mon, 28 Jan 2019 10:58:26 -0500 Received: from compute2.internal (compute2.nyi.internal [10.202.2.42]) by mailout.west.internal (Postfix) with ESMTP id 8023B1878 for ; Mon, 28 Jan 2019 10:58:25 -0500 (EST) Received: from web2 ([10.202.2.212]) by compute2.internal (MEProxy); Mon, 28 Jan 2019 10:58:25 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=fastmail.com; h= message-id:from:to:mime-version:content-transfer-encoding :content-type:subject:date; s=fm2; bh=/+LV7+ZosjBwOk9igxvr3pB3Ag Z1lhTuJsgggU5bYeo=; b=vjrF0UQBAWuqhcl/k4ioGhiiOZMiJLYeUav2q7SC++ NnduuNtomq81+aaQJvIwL9mY8U+C46/mmZ+L/5YtXZek0aCF+LddZ+Nn8+HE5fIo 1rREbxkb9pC6rRkeLGDgdjfLWPhsVaArNbBloH59XlV+WPvHnFFwx6d9kov0bp5T B6SWM75zQ4CN8VHd5AXwP3jNjK1YRzNbbSFOvy5H99kryk1v/QOWX9QA/UPqDlo3 D+owa5xLxuoKPnsnBQrB0L742DuOlln3zKikCixCCRvNkEx6nfo119K3Nl8te4Qf UtvittiAHb/bIoFiH3sYflzyds6Rb6GnyxKfeWswtWZA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=content-transfer-encoding:content-type :date:from:message-id:mime-version:subject:to:x-me-proxy :x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm1; bh=/+LV7+ ZosjBwOk9igxvr3pB3AgZ1lhTuJsgggU5bYeo=; b=qvQtEaoYYJvGQBdSpDoeb6 CkweYPdxbdxpfJq8IUyRGFOfhhL9uUla48JbcNTajFbWX27Gn4YObV3HwnAEde0A c0cGW2tMBSE/pdtfFZ/CoGd5lCaNaPNg1qUUi0sQXRqwimDWZuizRX4tN6K0JAyS Py8RnzXFwiWaqupPRJrEVUDOnciWSBeybQWJzLOnqIJUxrsRPm2HbDkk/55UORfR CDiMzibM4Wib/tIYnjMCzRJG6PL8yD3oBtez4+oFbd2uwMMG4ZoeGKcizYlkb2wV evnUp0IN9EdbJXdT414WzLcoWY4uuP0hM3zk0UgKKLxC8SeXbhKUVw8U6l2KwcgQ == X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedtledrjedtgdekjecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfhuthenuceurghilhhouhhtmecufedt tdenucgoteefjeefqddtgeculdehtddmnecujfgurhepkffhvfgggfgtoffuffesthejre dtredtjeenucfhrhhomhepqfhlihhvihgvrhcuffhutghlohhsuceoohgutgesfhgrshht mhgrihhlrdgtohhmqeenucffohhmrghinhepthgvshhtrdhshhenucfrrghrrghmpehmrg hilhhfrhhomhepohgutgesfhgrshhtmhgrihhlrdgtohhmnecuvehluhhsthgvrhfuihii vgeptd X-ME-Proxy: Received: by mailuser.nyi.internal (Postfix, from userid 99) id D7E3862304; Mon, 28 Jan 2019 10:58:24 -0500 (EST) Message-Id: <1548691104.3758682.1645313288.2864B6B8@webmail.messagingengine.com> From: Olivier Duclos To: dash@vger.kernel.org MIME-Version: 1.0 X-Mailer: MessagingEngine.com Webmail Interface - ajax-36e4bfd3 Subject: [PATCH] Cleaner error messages Date: Mon, 28 Jan 2019 16:58:24 +0100 Sender: dash-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: dash@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Hi, This is a small cosmetic patch which fixes something that annoyed me for a long time: the repetition of the script name in error messages. Example: $ cat test.sh #!/bin/sh echo ${x:?} $ dash test.sh /home/odc/test.sh: 2: /home/odc/test.sh: x: parameter not set or null With the patch: $ dash test.sh /home/odc/test.sh: 2: x: parameter not set or null This is the same behavior as bash. diff --git a/src/error.c b/src/error.c index 728ff88..ed35256 100644 --- a/src/error.c +++ b/src/error.c @@ -46,6 +46,7 @@ #include "jobs.h" #include "shell.h" #include "main.h" +#include "mystring.h" #include "options.h" #include "output.h" #include "error.h" @@ -124,7 +125,7 @@ exvwarning2(const char *msg, va_list ap) errs = out2; name = arg0 ? arg0 : "sh"; - if (!commandname) + if (!commandname || equal(commandname, name)) fmt = "%s: %d: "; else fmt = "%s: %d: %s: ";