Return-Path: Delivered-To: apmail-jakarta-oro-dev-archive@www.apache.org Received: (qmail 19821 invoked from network); 22 Jul 2008 17:50:54 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 22 Jul 2008 17:50:54 -0000 Received: (qmail 4106 invoked by uid 500); 22 Jul 2008 17:50:54 -0000 Delivered-To: apmail-jakarta-oro-dev-archive@jakarta.apache.org Received: (qmail 4080 invoked by uid 500); 22 Jul 2008 17:50:54 -0000 Mailing-List: contact oro-dev-help@jakarta.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Help: List-Post: List-Id: "ORO Developers List" Reply-To: "ORO Developers List" Delivered-To: mailing list oro-dev@jakarta.apache.org Received: (qmail 4064 invoked by uid 99); 22 Jul 2008 17:50:53 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 22 Jul 2008 10:50:53 -0700 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.140] (HELO brutus.apache.org) (140.211.11.140) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 22 Jul 2008 17:50:08 +0000 Received: by brutus.apache.org (Postfix, from userid 33) id 33A43234C172; Tue, 22 Jul 2008 10:50:32 -0700 (PDT) From: bugzilla@apache.org To: oro-dev@jakarta.apache.org Subject: DO NOT REPLY [Bug 45461] New: GlobCompiler: * should not match the path separator '/' X-Bugzilla-Reason: AssignedTo X-Bugzilla-Type: newchanged X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: ORO X-Bugzilla-Component: Main X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: eric.sirianni@gmail.com X-Bugzilla-Status: NEW X-Bugzilla-Priority: P2 X-Bugzilla-Assigned-To: oro-dev@jakarta.apache.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Changed-Fields: Message-ID: Content-Type: text/plain; charset="UTF-8" MIME-Version: 1.0 Date: Tue, 22 Jul 2008 10:50:32 -0700 (PDT) X-Virus-Checked: Checked by ClamAV on apache.org https://issues.apache.org/bugzilla/show_bug.cgi?id=45461 Summary: GlobCompiler: * should not match the path separator '/' Product: ORO Version: 2.0.8 Platform: PC OS/Version: Linux Status: NEW Severity: normal Priority: P2 Component: Main AssignedTo: oro-dev@jakarta.apache.org ReportedBy: eric.sirianni@gmail.com import org.apache.oro.text.GlobCompiler; import org.apache.oro.text.regex.MalformedPatternException; import org.apache.oro.text.regex.Pattern; import org.apache.oro.text.regex.Perl5Matcher; public class Main { public static void main(String[] args) throws MalformedPatternException { GlobCompiler globCompiler = new GlobCompiler(); Pattern pattern = globCompiler.compile("*.c"); Perl5Matcher perl5Matcher = new Perl5Matcher(); System.out.println(perl5Matcher.matches("foo.c", pattern)); System.out.println(perl5Matcher.matches("subdir/bar.c", pattern)); } } $ java -cp ... Main true true Expected behavior is: true false The glob man page states: Pathnames Globbing is applied on each of the components of a pathname separately. A '/' in a pathname cannot be matched by a '?' or '*' wildcard, or by a range like '[.-0]'. A range cannot contain an explicit '/' character; this would lead to a syntax error. If a filename starts with a '.', this character must be matched explicitly. (Thus, 'rm *' will not remove .profile, and 'tar c *' will not archive all your files; 'tar c .' is better.) Writing a simple C program that uses glob confirms this: $ cat testglob.c #include main(int argc, char *argv[]) { glob_t globbuf; globbuf.gl_offs = 2; glob("*.c", GLOB_DOOFFS, 0, &globbuf); globbuf.gl_pathv[0] = "ls"; globbuf.gl_pathv[1] = "-l"; execvp("ls", &globbuf.gl_pathv[0]); } $ find . ./subdir ./subdir/bar.c ./testglob.c ./a.out $ ./a.out -rw-rw-r-- 1 sirianni engr 236 2008-07-22 13:36 testglob.c -- Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are the assignee for the bug. --------------------------------------------------------------------- To unsubscribe, e-mail: oro-dev-unsubscribe@jakarta.apache.org For additional commands, e-mail: oro-dev-help@jakarta.apache.org