Skip to content

rustc reads directory incorrectly on BSD #12460

Closed
@brson

Description

@brson

From the BSD bot, this test makes rustc try to open a directory as a module. On most platforms this results in an 'illegal operation on a directory error' (from libuv), but on BSD rustc succeeds at opening the directory and reads ... something that isn't UTF8.

---- [compile-fail] compile-fail/issue-5806.rs stdout ----

    error: unexpected compiler error or warning: '/home/rustbuild/src/rust-buildbot/slave/auto-bsd-64-opt/build/src/test/compile-fail/issue-5806.rs:22:5: 22:8 error: /home/rustbuild/src/rust-buildbot/slave/auto-bsd-64-opt/build/src/test/compile-fail is not UTF-8 encoded'
    command: x86_64-unknown-freebsd/stage2/bin/rustc /home/rustbuild/src/rust-buildbot/slave/auto-bsd-64-opt/build/src/test/compile-fail/issue-5806.rs -L x86_64-unknown-freebsd/test/compile-fail --target=x86_64-unknown-freebsd -L x86_64-unknown-freebsd/test/compile-fail/issue-5806.stage2-x86_64-unknown-freebsd.libaux -C prefer-dynamic -o x86_64-unknown-freebsd/test/compile-fail/issue-5806.stage2-x86_64-unknown-freebsd --cfg rtopt --cfg debug -O -L x86_64-unknown-freebsd/rt
    stdout:
    ------------------------------------------

    ------------------------------------------
    stderr:
    ------------------------------------------
    /home/rustbuild/src/rust-buildbot/slave/auto-bsd-64-opt/build/src/test/compile-fail/issue-5806.rs:22:5: 22:8 error: /home/rustbuild/src/rust-buildbot/slave/auto-bsd-64-opt/build/src/test/compile-fail is not UTF-8 encoded
    /home/rustbuild/src/rust-buildbot/slave/auto-bsd-64-opt/build/src/test/compile-fail/issue-5806.rs:22 mod foo; //~ ERROR: illegal operation on a directory
                                                                                                             ^~~

    ------------------------------------------

    task '[compile-fail] compile-fail/issue-5806.rs' failed at 'explicit failure', /home/rustbuild/src/rust-buildbot/slave/auto-bsd-64-opt/build/src/compiletest/runtest.rs:950

I think there are two issues here:

  1. rustc shouldn't be deciding to open a directory. What logic lead to that?
  2. libuv does not behave the same on BSD as on other platforms

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-parserArea: The lexing & parsing of Rust source code to an AST

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions