From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-3.3 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,UNPARSEABLE_RELAY autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 22348 invoked from network); 11 May 2021 19:40:36 -0000 Received: from zero.zsh.org (2a02:898:31:0:48:4558:7a:7368) by inbox.vuxu.org with ESMTPUTF8; 11 May 2021 19:40:36 -0000 ARC-Seal: i=1; cv=none; a=rsa-sha256; d=zsh.org; s=rsa-20200801; t=1620762036; b=dsNM42bpFBUPhadDorjJaRJKT4B+8xUtNccDVfuv0PboCLylCnC4pIjIJupwpiPxcz8T15+WTX ZHETvut0Zj3SpjgLF6EotWWnkiegm7beNCR08pc4MS+QsQwFqwVyQ0k+JZBwjQJEZwtVtCq3L9 3ifPvkBQI+/BRXrlWa/oy/NZ0PqjNrddMFDgV+WczF7B05iDduXoz3hfbUi3TiYNj3cvjMll9R bpWEhkobXTP9yZ51AT66CHNPajfj+RyhBM1Orx0KbdVq2ytuCOA77AaX1Ho0t/oTB1jLsGXvNb At735ISA6+xiA+JgVFRUATV/ydZ3E0T0DGCV5a6K/x7JwQ==; ARC-Authentication-Results: i=1; zsh.org; iprev=pass (mail-ot1-f49.google.com) smtp.remote-ip=209.85.210.49; dkim=pass header.d=brasslantern-com.20150623.gappssmtp.com header.s=20150623 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-20200801; t=1620762036; bh=6SitZJkXQZZ7xWxmat4w68c71IDM/HUCsaWVRZr4HYM=; h=List-Archive:List-Owner:List-Post:List-Unsubscribe:List-Subscribe:List-Help: List-Id:Sender:Content-Type:Cc:To:Subject:Message-ID:Date:From:In-Reply-To: References:MIME-Version:DKIM-Signature:DKIM-Signature; b=weD0nUcSXYqr3uVRHiW87gbiLVGrDPe+aiKi2KYWXYaJ3fwNe2snS9OQ1W9a2cOz4BfrfIqdgY iSU1NLgLtsi1InoqzJyeFiRMWBU6R5G8aa2r5/GV29uiWiS4I3x6J5S9IwQJpjsG0TBOeZcXsY Vw2T/PF1ji3KlbnlZafSscIGVOf9oL80Q/s2QoWtmnsUPWN5XZSyQRzIUdREpagqVBNhR+bCn5 RkOWBMow0KSUnYyp391qsdjn+iDP5dsuCfp12BmCZrGkyGloJXV4LPkEZNMDTWve8H8PWPykjE UcesquwpEji6x7B7yqdvz7GF3weyM2AYNsOuxo+v69a02Q==; DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=zsh.org; s=rsa-20200801; h=List-Archive:List-Owner:List-Post:List-Unsubscribe: List-Subscribe:List-Help:List-Id:Sender:Content-Type:Cc:To:Subject:Message-ID :Date:From:In-Reply-To:References:MIME-Version:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID; bh=Pd2FFR7LtKHs0eFJcQjkoKUXnberkvFO7iWwLQxBQa0=; b=pmQtneRZ74N+SN3UKX/v/2pqZd niNk/C42TDvCMr2Ti01TFiZYkosfVNv/10vdvotwbF6pFuPZoLhfTRnt9hnAqjk/xeUGRFyn2lHxG cK+XKybqUvmQVqv4SwFJ+MHYdwD/9Va8wADdy4ePqLX+NPohg/URqb2Ji8tm/k6eJGevZc6/v6XzF 43iM5o+GBLG1DhlweR3MfXLiBmENtpWZY9Ce3xnHUe+EfDWqoPU5vQHoWI3PvEGFf3l4uH5yREbpS FrrfOmF6cyTbbHulQZ4VuHZMj3WYNWZDo8vJtzzxVojJ49hVyhs/JrJzmsPMC7Jv/vxP7iq06vJJH hE/fq6Jw==; Received: from authenticated user by zero.zsh.org with local id 1lgYFA-000Ofe-HU; Tue, 11 May 2021 19:40:36 +0000 Authentication-Results: zsh.org; iprev=pass (mail-ot1-f49.google.com) smtp.remote-ip=209.85.210.49; dkim=pass header.d=brasslantern-com.20150623.gappssmtp.com header.s=20150623 header.a=rsa-sha256; dmarc=none header.from=brasslantern.com; arc=none Received: from mail-ot1-f49.google.com ([209.85.210.49]:45812) by zero.zsh.org with esmtps (TLS1.3:TLS_AES_128_GCM_SHA256:128) id 1lgYEv-000OO3-TG; Tue, 11 May 2021 19:40:23 +0000 Received: by mail-ot1-f49.google.com with SMTP id f75-20020a9d03d10000b0290280def9ab76so18495585otf.12 for ; Tue, 11 May 2021 12:40:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=brasslantern-com.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=Pd2FFR7LtKHs0eFJcQjkoKUXnberkvFO7iWwLQxBQa0=; b=bqo31Zu7nklJAHdnF6Dlcubq88POHa8tCYl8V0Y+2UVEDoi7nzZ3imM85xka+r8K3z O0nv/XjlDsrLr0D0RBd64cxUaUAKa7mhxx9hYh5N/LfXcCWaLsbKnSNCfXdJf6D+L4cm IDEGWneB14euKQnC+ON8p4r/27VYdAP7mvQsfdXYnrOtCtBXUB3SdHZaU8/2BqLqwJCH zF3lcDCW/KkvNxZBLpcOkE2UQpTwztR/4I8pP4QCxpplkuYnhba1jWQH4enU3dI7BSbk dQybzrb9km0HQaKmVrtL3TwEojSYsQxgDdY96P6xv2Rig9xSPu8h8JPnZfPwfxfbKuuq JWpQ== 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=Pd2FFR7LtKHs0eFJcQjkoKUXnberkvFO7iWwLQxBQa0=; b=uX9Ouq02CS7sNljgCNRE1Q4lODcA7b+ZV8N72mFc2ClJ+i2MQ/YM62Yzk7v0hPNngv rE+43zyQeOJA/mUKeUhi4zKOtmYvMDUJvoKVo1HVU9mNZv5vL1TTxG4rXDm6dUsWAI5i OBoJVcFeIYmFEif9XWurIw/PeObBF5d0bZF+xUrzgZNSo76eCcIw0XcKUY87Ijx/bOth OEUcSXwi4GvM/pC0DyJsqnqABc5SEPI9lUgBpFkWfQSrERZrX9Ua6gbsDUuhyu648DrH 8/pTJDZN/z7+feVV9AAf4VNdc8K4/FZhC6unqamsnNw8uzfcbUEyaBYABy5Pn3B7WlMO hKRQ== X-Gm-Message-State: AOAM532/tYCAL/y0WgGp+y2mQZMrl/ssEsTJJe9F3G17mt8LE+tElwK0 25mnSpgVLrtjVxPPvkYv9AfWi0PK40WKLfnl0hhejA== X-Google-Smtp-Source: ABdhPJwBVoa558LFvYalTjbWT5sNcrY65IzYQnrUmUo57lhaEpY20RG6U6nWkmkMUUla4v0T3d57XyTLc2j0OQbmxZ8= X-Received: by 2002:a9d:170b:: with SMTP id i11mr22278256ota.161.1620762020581; Tue, 11 May 2021 12:40:20 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Bart Schaefer Date: Tue, 11 May 2021 12:40:09 -0700 Message-ID: Subject: Re: [BUG] Weird _expand & _complete behavior for $parameters in "double quotes" To: Marlon Richert Cc: Zsh hackers list Content-Type: text/plain; charset="UTF-8" X-Seq: 48822 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: On Tue, May 11, 2021 at 10:32 AM Marlon Richert wrote: > > On Tue, May 11, 2021 at 2:05 PM Bart Schaefer wrote: > > > > I can't reproduce this on either Ubutu or MacOS, nor either with or > > without my completeinword patch from the other day. > > Here's the test as a patch, in case it helps you reproduce it. Ah, I didn't get before that you'd added an entire new test case. There are two things going on here: One, complete-in-word handling of quotes has several problems, which I've unsuccessfully wrestled with once or twice before. Completion wants to remove the quotes, complete what is inside them, and then put back the most appropriate quotes for the end result, which aren't always the same as the original quotes ... and it can get pretty confused along the way. So the first TAB replaces "$ba" with "$ba"" because it recognizes the ambiguous prefix but forgets (so to speak) that there's already a trailing quote. Two, on the next tab when _expand sees the extra quote, it concludes that $ba is the entire variable to be expanded, and replaces it with the empty string. The quotes then all themselves get quoted (see "put back the most appropriate"+"confused"), leaving \"\"\". This may be in some way related to the do_ambiguous() discussion from workers/39123 all the way back in 2016, which never got any further (and the patch from workers/39968 never did get committed, but it doesn't help with this quoting situation).