From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from localhost (localhost [127.0.0.1]) by arlo.cworth.org (Postfix) with ESMTP id D440C6DE11C7 for ; Sun, 20 Aug 2017 05:33:15 -0700 (PDT) X-Virus-Scanned: Debian amavisd-new at cworth.org X-Spam-Flag: NO X-Spam-Score: 0.046 X-Spam-Level: X-Spam-Status: No, score=0.046 tagged_above=-999 required=5 tests=[AWL=0.066, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01] autolearn=disabled Received: from arlo.cworth.org ([127.0.0.1]) by localhost (arlo.cworth.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id T_taZrhHAiY9 for ; Sun, 20 Aug 2017 05:33:13 -0700 (PDT) Received: from mail-lf0-f67.google.com (mail-lf0-f67.google.com [209.85.215.67]) by arlo.cworth.org (Postfix) with ESMTPS id 163AD6DE11C2 for ; Sun, 20 Aug 2017 05:33:13 -0700 (PDT) Received: by mail-lf0-f67.google.com with SMTP id f7so3959531lfg.0 for ; Sun, 20 Aug 2017 05:33:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nikula-org.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:in-reply-to:references:date:message-id :mime-version; bh=2K50peW5YJV2TK0Wfajz8PlOLpqreHia3GogGMcJ9FI=; b=Qa5Jdf5RyGdwXMQcB91xzC9gPYF/d52A1Sp4KWybiVGjc52AkGgj3a7VM5PAzmpNma G+dHCSBqexSTrYbn8s7xe9RJJeeuHFO6/y2BkKDCw6dwvODN5WQiaOae2yjocoGzqYC2 PxX+j6PKh6YRu3wTdffwUCu6zSqbCTR+APqYUMdaOr31Xg8lxl9THvMKX4sbeYXaKGD3 PTi6SwfqHzzbIP8sizca19N0sSxQa8lvgCxVZXOh6auHT0ZWxHTGPYT4tLJYfqqFu1R3 u++RU+Q+YSzKEE9HaREdxK3QZWOXiem2uoWby+E9omzmTDhK+vnybhlh0M3Np0k9Tj6h dGkg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:in-reply-to:references:date :message-id:mime-version; bh=2K50peW5YJV2TK0Wfajz8PlOLpqreHia3GogGMcJ9FI=; b=EQfArphQnMLw+mHPzrXttmY9CIKcuyrnP7msZ0cuAWSTns5/hB0vUPs9v6cXuBPLHj GUo9urv44YAxjHbtWJ59xu4Rf+j9T8wunPCMX/auh/aV6BKSP7GRSUvjIDGTzq4j+zJJ X/7M40DOgJVN0OQUri69YgQZJiNcaKWRt7GKUXjd5y6dAEKRQSr0CLLHTH824SiVPbCr 29Gi9Py4KzUhI3bcSX2giqN+m3Q7uSAs7UuXUvfkkkC89HekAt52/DbUmspPtoCZBzUM bpOPZ3kPD3AyZiTLF526s5tnL7G1xUpui8mPnNBPIBmPP8zQqCzUD+2uiRLU/YQz/PJk +zeA== X-Gm-Message-State: AHYfb5gGFsCMgSODGuS3HTCL5h97eTRe0ro5JXaE7J3X8fXwIQDv4F6e NSsg/zrcoJ0YjouO X-Received: by 10.46.77.133 with SMTP id c5mr4457785ljd.28.1503232390936; Sun, 20 Aug 2017 05:33:10 -0700 (PDT) Received: from localhost (mobile-access-5d6aa6-119.dhcp.inet.fi. [93.106.166.119]) by smtp.gmail.com with ESMTPSA id q192sm2181462lfe.85.2017.08.20.05.33.09 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sun, 20 Aug 2017 05:33:10 -0700 (PDT) From: Jani Nikula To: Joseph Mingrone , Tomi Ollila Cc: notmuch@freelists.org, notmuch@notmuchmail.org Subject: Re: proposed patches to notmuch-emacs-mua In-Reply-To: <861so7i9xy.fsf@phe.ftfl.ca> References: <86lgngplvt.fsf@phe.ftfl.ca> <861so7i9xy.fsf@phe.ftfl.ca> Date: Sun, 20 Aug 2017 15:33:09 +0300 Message-ID: <87fucml8qi.fsf@nikula.org> MIME-Version: 1.0 Content-Type: text/plain X-BeenThere: notmuch@notmuchmail.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "Use and development of the notmuch mail system." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 20 Aug 2017 12:33:15 -0000 On Sat, 19 Aug 2017, Joseph Mingrone wrote: > Hello Tomi, > > Tomi Ollila writes: >> I'd like to know why bash is to be replaced; (e.g. since it is not in base >> system, but so not is e.g. emacs...) > >> if this couple of order of magnitude heavier solution is used, then it >> could be first checked whether to do so; e.g using case $3 in *['"\']*) and >> and then do escaping on the need basis (an option to use posix shell >> constructs to do such a thing looks probably too complicated... (*)) > > Indeed, bash could be pulled in as a dependency to notmuch, but I'm > shell shocked to hear you say the POSIX sh solution is an order of > magnitude heavier than the bash solution. Building on your suggestion, > maybe this function is a reasonable alternative that doesn't call an > external command. > > escape () > { > r=$3 p= > while case $r in *\\*) true ;; *) false ;; esac; do > p=$p${r%%\\*}\\\\ r=${r#*\\} > done > r="$p$r" p= > > while case $r in *\"*) true ;; *) false ;; esac; do > p=$p${r%%\"*}\\\" r=${r#*\"} > done > > eval "$2=\$p\$r" > } > > It's no big deal either way. I just followed a convention when updating > the FreeBSD notmuch package. If the script is close to POSIX > compliance, then patch out the bashisms, otherwise pull in bash. Why > not attempt to comply to a standard and not pull in an external > dependency (for some systems) when the script is already so close? I > thought I would upstream those changes in case they were useful. IMHO don't fix it if it isn't broken. The proposed solutions to "fix" the bashism are more complicated than the original, and might introduce bugs. And sticking to sh here blocks future use of useful bashisms. BR, Jani.