I believe (from bisection) that this was introduced in the transition to C at 3604242f080. I've attached a repro (against master). At the time the bug was introduced, the output in question went to stdout instead of stderr, so the attached test case will not quite work on the older version. But if you run under -v, you'll be able to see the bad ("foo/foo/sub" instead of "foo/sub" or just "sub") output.