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,T_SCC_BODY_TEXT_LINE, UNPARSEABLE_RELAY autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 30171 invoked from network); 7 Jun 2022 05:32:25 -0000 Received: from zero.zsh.org (2a02:898:31:0:48:4558:7a:7368) by inbox.vuxu.org with ESMTPUTF8; 7 Jun 2022 05:32:25 -0000 ARC-Seal: i=1; cv=none; a=rsa-sha256; d=zsh.org; s=rsa-20210803; t=1654579945; b=KzKt3yERf/luTO268i4dvGQVgJZwZeNOOYOz22sfR2nbAMicLgp5VzbaDNfKTqFc0vbGBT482G CCO3lN2qqgbvjOo+DJi9IZ8z0AVTx8ROoSROne2GAGy27fwTkvD3KsyBNh5XOmFceJyCo9EOhq WHoNNyEJu3zRXvesZLIr+HTZqyOsYBQmd1kXJgj36YjwTrvoLHyxIjx6VpeP9OPd4qNkI9bt9Z DX4XzqALpqVxAlzh9pGA5GrrGi8dTgp7/xkRbU0f8MEQyNOZS2KmdgVQFYVPT2dXjjZLOxzv7U RDNN5sNmIY2Rz+BTjosS2pLS7GN4A4ywDxLpjbU5Riz1bg==; ARC-Authentication-Results: i=1; zsh.org; iprev=pass (mail-ej1-f50.google.com) smtp.remote-ip=209.85.218.50; dkim=pass header.d=brasslantern-com.20210112.gappssmtp.com header.s=20210112 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-20210803; t=1654579945; bh=l9C7EVT2+WOuUcqDjtnXaVY5Oofjri52PBF2JpCqUw4=; h=List-Archive:List-Owner:List-Post:List-Unsubscribe:List-Subscribe:List-Help: List-Id:Sender:Content-Type:To:Subject:Message-ID:Date:From:MIME-Version: DKIM-Signature:DKIM-Signature; b=dn48M5O9orsafQ0epIsj4uP8YxLrgsoCQ9m3Sq1/RtxEqqfkFsQGTUUD+erYDs5IcAlxShUktd hUkhprk367ltBDsxVKrlgyBSdWPeXHKR6HD+0g2/K1o5Gzto6YG0ThG6ZAXpcGlZJJjsOP4ONW IarSBZOQs8b5WbMj7h33fhBEIGN4SDOiEnzZM12ccUOzt8Xyuxdfg63E8f5URkIS2dVHxmit8n 5QDtLE9S6gqbGr1U0yzRXSajtnvCD+YlDVU3PX2S+jWMLvprNImv7pxAIjz5Po5Q2BHS2NvWAz 5PWiqCycxKXz/Gm/s86G+HSUtS3Glc7XmfdHKnDxNi2cew==; DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=zsh.org; s=rsa-20210803; h=List-Archive:List-Owner:List-Post:List-Unsubscribe: List-Subscribe:List-Help:List-Id:Sender:Content-Type:To:Subject:Message-ID: Date:From:MIME-Version:Reply-To:Cc:Content-Transfer-Encoding:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:In-Reply-To:References; bh=BO3V4IXY0Zm8NnuzXZC5ip+GfEHNvDH6/I2aoqeN8Wg=; b=d7Oy2U/XwRVtb6wty4WrCXHMaL YyMHbgwEqBSN2w2EVXeZv4ogm3viXcw9uighn3N6zJSJycwge6/6bjsCea7DHCH7NiMvviM6sJPDO 9oo4+i6ZwhYeXcTgEy2DHFh3AMDuqQLXN77Gi+3z3bGIC31izfi2BAfZP9j2geXU3JpFafe6utelL I4kZDOt1bEurFGX57mDibf96RF6LTcqy+Zmp7ENAcHPtiGWwlnM3WBs7En3zJxeyxDefhroQwVpim O6ym1awUkP5G3XnmjeaqwMvgL0qflwTkWuxOCQgFEP3uSPFdeYXDAMP0p6RfLF38rjQSFea5xqXL8 wRE6G7Ng==; Received: from authenticated user by zero.zsh.org with local id 1nyRpH-000Gqc-Te; Tue, 07 Jun 2022 05:32:23 +0000 Authentication-Results: zsh.org; iprev=pass (mail-ej1-f50.google.com) smtp.remote-ip=209.85.218.50; dkim=pass header.d=brasslantern-com.20210112.gappssmtp.com header.s=20210112 header.a=rsa-sha256; dmarc=none header.from=brasslantern.com; arc=none Received: from mail-ej1-f50.google.com ([209.85.218.50]:40671) by zero.zsh.org with esmtps (TLS1.3:TLS_AES_128_GCM_SHA256:128) id 1nyRp1-000GWn-Bq; Tue, 07 Jun 2022 05:32:08 +0000 Received: by mail-ej1-f50.google.com with SMTP id fu3so31409892ejc.7 for ; Mon, 06 Jun 2022 22:32:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=brasslantern-com.20210112.gappssmtp.com; s=20210112; h=mime-version:from:date:message-id:subject:to; bh=BO3V4IXY0Zm8NnuzXZC5ip+GfEHNvDH6/I2aoqeN8Wg=; b=NE5cToQJOi/C0PkQBcU3E2wH7tTG+1VbQW5GpC5yEKJJu4xtg2yLBG9NlPCtrfB7iD yRJlXwO+/Skko4vrb/7MX7saxJvzbbXx0RGk7bMG2pAOm9wE71F6RK8x2kkP+ZeSHF7y Rew6HY+zzrVmU0yKLc3RPwhrnv7rv6Bcg+SvnWvqDPOzAlvuW2VsC7CaU2DjdLDgpuR8 1IEmjeGf/FL7UlCPtzEWaER/sCeSx0IC66uH3vMjqSj+CuwyyZ9kpCoA1NQfA2hYNgB2 2amymcjsNQ6XyQ4OGlWY8EgyIO2HPYX19+R55p4J56uJhJqGfJqi6qSIpEuTsIJLDN7P SDsA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=BO3V4IXY0Zm8NnuzXZC5ip+GfEHNvDH6/I2aoqeN8Wg=; b=gf3F4COc/kZgapJsPMKqj1YYMR1ev8P3DpS0S83U4NFHmJF7ndbCbITxSyFANHySuw 3i+EYiyeOzYe9dQ3IsrztGeDdtrCzdM4Vw8aVY8oL37jL0ReiCtinMWtrz95/GVbJAQ4 JWBJuqN/dPp7Hu4oDxwHv8AUj8InhwydQMWp53Eiqt1kswpqDje4Xy6P/gaHKeYnlsKV tm2hCvffEMp+glWtusqupcF9BOb0RlKbmzQ6c6W/LSCQINb4pXdLT3y9bKtuilabwQKK WuKaiFrc5hAYX65EwHvdVNLiLXmT/TcG7bVjDC5QyFzZOEWFZd9x/5dD1FLj0RzoEdea 6tGw== X-Gm-Message-State: AOAM530JOZi897EtwOGpAJCMiFZN7YXR1EH/UB/r+5abYttvrU6WgCVp M1VGbyvbkz8Dz8X7N2mrhW0Lyo9gFSsw29sKnyQIWEeRk/mcHw== X-Google-Smtp-Source: ABdhPJxWxwsX3xXgTRRUJpXOLVJl7UUvOMppyeM/YdDmjz4lkiOjhFFXNhXH7fyKoQhidPMu7qEwyN4QRa+J1AwxuSE= X-Received: by 2002:a17:906:6806:b0:703:1f4e:9868 with SMTP id k6-20020a170906680600b007031f4e9868mr24902110ejr.699.1654579926676; Mon, 06 Jun 2022 22:32:06 -0700 (PDT) MIME-Version: 1.0 From: Bart Schaefer Date: Mon, 6 Jun 2022 22:31:55 -0700 Message-ID: Subject: [PATCH?] The here-doc that never ends To: Zsh hackers list Content-Type: text/plain; charset="UTF-8" X-Seq: 50341 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: zsh -f % true << ( > Note the shell is now at a PS2 prompt. The only way to escape the PS2 prompt is to type a closing paren, at which point you're at heredoc> But then gethere() is waiting for a single line consisting of the C string "(\n)" which it is not possible to enter. The only way out is to interrupt. Brute-force patch for this is below, but it seems like we should be able to catch it sooner? This appears to arise only because zsh accepts <<(command) as well as < <(command) (note spacing). Same effect with: % true <<$'\n' but there doesn't seem to be any good way to prevent that, and bash 5.0.17 behaves the same in that case. diff --git a/Src/parse.c b/Src/parse.c index d612b7e17..5054e59d5 100644 --- a/Src/parse.c +++ b/Src/parse.c @@ -2248,6 +2248,9 @@ par_redir(int *rp, char *idstring) struct heredocs **hd; int htype = type; + if (strchr(tokstr, '\n')) + YYERROR(ecused); + /* * Add two here for the string to remember the HERE * terminator in raw and munged form.