D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 6634 - std.path.globMatch throws wrong assertion
Summary: std.path.globMatch throws wrong assertion
Status: RESOLVED FIXED
Alias: None
Product: D
Classification: Unclassified
Component: phobos (show other issues)
Version: D2
Hardware: Other Windows
: P2 regression
Assignee: No Owner
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-09-09 03:28 UTC by Rainer Schuetze
Modified: 2011-10-08 14:57 UTC (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description Rainer Schuetze 2011-09-09 03:28:35 UTC
import std.path;

void main()
{
	globMatch("a.di", "*.d");
}

asserts with

core.exception.AssertError@std.path(2239): Assertion failure

The same happens when using fnmatch instead of globMatch. The problem is a wrong assert at the end of both functions:
    assert(ni >= path.length);

The wrong assert has been there before, but was actually never executed because it was built into the runtime library in release mode only. Now that the functions are templates, code generation moved to the user project, so the asserts can actually trigger.
Comment 1 Brad Roberts 2011-09-17 17:16:28 UTC
Care to turn this into a pull request with a unittest?