You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@geode.apache.org by sa...@apache.org on 2020/10/08 23:26:17 UTC

[geode] branch develop updated: GEODE-8587: Redis glob pattern does not match carriage return, line feed, and tab (#5608)

This is an automated email from the ASF dual-hosted git repository.

sabbey37 pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/geode.git


The following commit(s) were added to refs/heads/develop by this push:
     new c9ba7fa  GEODE-8587: Redis glob pattern does not match carriage return, line feed, and tab (#5608)
c9ba7fa is described below

commit c9ba7fa3566d0f32a5c009539130b7f60bb3b275
Author: Sarah <41...@users.noreply.github.com>
AuthorDate: Thu Oct 8 19:25:19 2020 -0400

    GEODE-8587: Redis glob pattern does not match carriage return, line feed, and tab (#5608)
---
 .../internal/executor/key/AbstractKeysIntegrationTest.java     | 10 ++++++++++
 .../org/apache/geode/redis/internal/executor/GlobPattern.java  |  2 +-
 2 files changed, 11 insertions(+), 1 deletion(-)

diff --git a/geode-redis/src/integrationTest/java/org/apache/geode/redis/internal/executor/key/AbstractKeysIntegrationTest.java b/geode-redis/src/integrationTest/java/org/apache/geode/redis/internal/executor/key/AbstractKeysIntegrationTest.java
index 22dc73f..6dce3ba 100644
--- a/geode-redis/src/integrationTest/java/org/apache/geode/redis/internal/executor/key/AbstractKeysIntegrationTest.java
+++ b/geode-redis/src/integrationTest/java/org/apache/geode/redis/internal/executor/key/AbstractKeysIntegrationTest.java
@@ -85,6 +85,16 @@ public abstract class AbstractKeysIntegrationTest implements RedisPortSupplier {
   }
 
   @Test
+  public void givenSplat_withCarriageReturnLineFeedAndTab_returnsExpectedMatches() {
+    jedis.set(" foo bar ", "123");
+    jedis.set(" foo\r\nbar\r\n ", "456");
+    jedis.set(" \r\n\t\\x07\\x13 ", "789");
+
+    assertThat(jedis.keys("*")).containsExactlyInAnyOrder(" \r\n\t\\x07\\x13 ", " foo\r\nbar\r\n ",
+        " foo bar ");
+  }
+
+  @Test
   public void givenMalformedGlobPattern_returnsEmptySet() {
     assertThat(jedis.keys("[][]")).isEmpty();
   }
diff --git a/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/GlobPattern.java b/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/GlobPattern.java
index 71ecaac..d492698 100644
--- a/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/GlobPattern.java
+++ b/geode-redis/src/main/java/org/apache/geode/redis/internal/executor/GlobPattern.java
@@ -137,7 +137,7 @@ public class GlobPattern {
       regex.append(']');
     }
 
-    return Pattern.compile(regex.toString());
+    return Pattern.compile(regex.toString(), Pattern.DOTALL | Pattern.MULTILINE);
   }
 
   @Override