From 6c8036e6c0c5d20672f7d11ae97e17b734b4edba Mon Sep 17 00:00:00 2001 From: Nikos Gorogiannis Date: Fri, 28 Feb 2020 07:19:38 -0800 Subject: [PATCH] [buck] fix target quoting regexp Summary: The check for whether a buck target needs quoting is incorrect, since it uses `-` inside a character class to denote a dash, not a character range. The correct way to do this is to put the dash as the first character in the class (or last). Facebook iknowthis_regex Reviewed By: jberdine Differential Revision: D20159112 fbshipit-source-id: be6750ed8 --- infer/src/integration/Buck.ml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/infer/src/integration/Buck.ml b/infer/src/integration/Buck.ml index a34e0c3c2..246196cd6 100644 --- a/infer/src/integration/Buck.ml +++ b/infer/src/integration/Buck.ml @@ -77,7 +77,7 @@ module Query = struct exception NotATarget let quote_if_needed = - let no_quote_needed_regexp = Str.regexp "^[a-zA-Z0-9/:_*][a-zA-Z0-9/:.-_*]*$" in + let no_quote_needed_regexp = Str.regexp "^[a-zA-Z0-9/:_*][-a-zA-Z0-9/:._*]*$" in fun s -> if Str.string_match no_quote_needed_regexp s 0 then s else s |> Escape.escape_double_quotes |> F.sprintf "\"%s\""