From reading `glob()`, if the filesystem root contains any non-utf8 paths, `glob()` will fail with `not_utf8` before it ever returns. But if the non-utf8 filename exists somewhere later in the path, `glob()` won't fail until you actually cycle the iterator.

However, the more serious problem is test is quite broken. `p.display().to_str()` is *completely* inappropriate. What you've actually done here is the equivalent of `glob("/tmp/tmpdir.XXX/\uFFFD")`. The entire point of `.display()` is to convert invalid utf-8 into something that can be shown to the user. Using it in this fashion will not work *at all*.

Instead you need something like

```rust
let pat = p.with_filename("*").as_str().expect("tmpdir is not utf-8");
glob(pat).skip(10000).next();
```

This should construct the pattern `"/tmp/tmpdir.XXX/*"` and pass that to `glob()`, then when the iterator cycles it will match the non-utf8 filename and attempt to yield it.

Of course, at this point, you're not actually testing to make sure glob returns the right path. From reading the code again, assuming `fs::readdir()` even behaves correctly itself in the presence of non-utf8, the glob is going to end up just skipping the non-utf8 path.

This test really does need to be enhanced to ensure it matches the correct path. So that last line should probably look like

```rust
assert_eq!(glob(pat).collect::<~[Path]>(), ~[p])
```