dash.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Harald van Dijk <harald@gigawatt.nl>
To: Herbert Xu <herbert@gondor.apana.org.au>, Ron Yorston <rmy@frippery.org>
Cc: contact@emersion.fr, dash@vger.kernel.org
Subject: Re: [v2 PATCH] parser: Catch errors in expandstr
Date: Sun, 17 May 2020 13:19:28 +0100	[thread overview]
Message-ID: <15d522d8-e0f5-be2a-f2a2-8b17290fce31@gigawatt.nl> (raw)
In-Reply-To: <20200428061758.GA1771@gondor.apana.org.au>

On 28/04/2020 07:17, Herbert Xu wrote:
> ---8<---
> On Fri, Dec 13, 2019 at 02:51:34PM +0000, Simon Ser wrote:
>> Just noticed another dash bug: when setting invalid PS1 values dash
>> enters an infinite loop.
>>
>> For instance, setting PS1='$(' makes dash print many of these:
>>
>>     dash: 1: Syntax error: end of file unexpected (expecting ")")
>>
>> It would be nice to fallback to the default PS1 value on error.
> 
> This patch fixes it by using the literal value of PS1 should an
> error occur during expansion.
> 
> On Wed, Feb 26, 2020 at 09:12:04PM +0000, Ron Yorston wrote:
>>
>> There's another case that should be handled.  PS1='`xxx(`' causes the
>> shell to exit because the old-style backquote leaves an additional file
>> on the stack.
> 
> Ron's change has been folded into this patch.

This still does not restore the state completely. It does not clean up 
any pending heredocs. I see:

   $ PS1='$(<<EOF "'
   src/dash: 1: Syntax error: Unterminated quoted string
   $(<<EOF ":
   >

That is, after entering the ':' command, the shell is still trying to 
read the heredoc from the prompt.

I have not looked in detail to see if anything else is not getting 
cleaned up that should be.

Cheers,
Harald van Dijk

  reply	other threads:[~2020-05-17 12:20 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <SJhI_AW9YJmphaap5RzzVqYTGsA529iV7GOEBafT9ilDPGFpMRRJlNt3TrMBwh0uqKQltSvsH2P8x_2in6enHT5DzygjAtrRSvWl5xHofeY=@emersion.fr>
2020-01-21  6:39 ` [PATCH] parser: Catch errors in expandstr Herbert Xu
2020-01-21 17:06   ` Simon Ser
2020-02-26 21:12   ` Ron Yorston
2020-02-28  0:40     ` Herbert Xu
2020-04-28  6:17       ` [v2 PATCH] " Herbert Xu
2020-05-17 12:19         ` Harald van Dijk [this message]
2020-05-17 13:36           ` [PATCH] parser: Save and restore heredoclist " Herbert Xu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=15d522d8-e0f5-be2a-f2a2-8b17290fce31@gigawatt.nl \
    --to=harald@gigawatt.nl \
    --cc=contact@emersion.fr \
    --cc=dash@vger.kernel.org \
    --cc=herbert@gondor.apana.org.au \
    --cc=rmy@frippery.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).