[prev in list] [next in list] [prev in thread] [next in thread] 

List:       openjdk-serviceability-dev
Subject:    Integrated: 8261692:  Bugs in clhsdb history support
From:       Chris Plummer <cjplummer () openjdk ! java ! net>
Date:       2021-02-20 23:22:42
Message-ID: 1ERdEcSaFvTKI-_iqTeP2lCd5K2k8JfWajME2r8paSc=.1865663c-9ed7-4a20-8dd8-97b307374909 () github ! com
[Download RAW message or body]

On Sun, 14 Feb 2021 08:45:26 GMT, Chris Plummer <cjplummer@openjdk.org> wrote:

> See the CR for a description of the 3 issues fixed. There's also a new test added. \
> I'll explain the fix related to quoting the '!' here since it's not that obvious \
> how it works. 
> There's a complex pattern called `historyPattern` that is used to find various uses \
> of ! to do expansion of commands and arguments in the history 
> static Pattern historyPattern = \
> Pattern.compile("([\\\]?)((!\*)|(!\$)|(!!-?)|(!-?[0-9][0-9]*)|(![a-zA-Z][^ ]*))"); 
> I added the `([\\\]?)` part to handle allowing a '!' to be quoted with a backslash \
> so it will just be treated as a '!' instead of being used for history expansion. \
> This part of the pattern basically says match 1 backslash if present. Yes, you need \
> 4 backslashes to do this. javac will reduce it to two, and then the pattern \
> compilation reduces it down to just one backslash (not to be used for quoting). 
> The above pattern for searching for the backslash before a '!' is in the first \
> pattern grouping, and the part that matches on the '!' and what follows is in the \
> 2nd pattern grouping. Thus the code I added checks if the first pattern grouping \
> matches something (and at most it will match just one backslash), and if so then we \
> eat it and don't treat the '!' that follows as a history expansion: 
> if (m.group(1).length() != 0) {
> // This means we matched a `` before the '!'. Don't do any history
> // expansion in this case. Just capture what matched after the ``.
> result.append(m.group(2));
> continue;
> }

This pull request has now been integrated.

Changeset: 18188c2a
Author:    Chris Plummer <cjplummer@openjdk.org>
URL:       https://git.openjdk.java.net/jdk/commit/18188c2a
Stats:     117 lines in 2 files changed: 114 ins; 0 del; 3 mod

8261692: Bugs in clhsdb history support

Reviewed-by: amenkov, sspitsyn

-------------

PR: https://git.openjdk.java.net/jdk/pull/2565


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic