Closed Bug 1581248 Opened 4 months ago Closed 4 months ago

mach vendor rust fails on Windows "Cannot mix UNC and non-UNC paths" since 1.37.0

Categories

(Firefox Build System :: General, defect)

defect
Not set

Tracking

(firefox-esr60 unaffected, firefox-esr68 unaffected, firefox69 unaffected, firefox70 wontfix, firefox71 fixed)

RESOLVED FIXED
mozilla71
Tracking Status
firefox-esr60 --- unaffected
firefox-esr68 --- unaffected
firefox69 --- unaffected
firefox70 --- wontfix
firefox71 --- fixed

People

(Reporter: agashlin, Assigned: mshal)

References

(Regression)

Details

(Keywords: in-triage, regression)

Attachments

(1 file)

Using the builtin cargo vendor in 1.37.0 causes this error on Windows:

$ ./mach vendor rust
    Updating crates.io index
    Updating git repository `https://github.com/alexcrichton/mio-named-pipes`
    Updating git repository `https://github.com/NikVolf/tokio-named-pipes`
Error running mach:
 
    ['vendor', 'rust']

The error occurred in code that was called by the mach command. This is either
a bug in the called code itself or in the way that mach is calling it.
You can invoke |./mach busted| to check if this issue is already on file. If it
isn't, please use |./mach busted file| to report it. If |./mach busted| is
misbehaving, you can also inspect the dependencies of bug 1543241.

If filing a bug, please include the full output of mach, including this error
message.

The details of the failure are as follows:

ValueError: Cannot mix UNC and non-UNC paths (//?/c:/mozilla-source/mozilla-central/third_party/rust and c:/mozilla-source/mozilla-central)

  File "c:\mozilla-source\mozilla-central\python/mozbuild/mozbuild/mach_commands.py", line 1089, in vendor_rust
    vendor_command.vendor(**kwargs)
  File "c:\mozilla-source\mozilla-central\python/mozbuild\mozbuild\vendor_rust.py", line 386, in vendor
    mozpath.normsep(os.path.normcase(self.topsrcdir)),
  File "c:\mozilla-source\mozilla-central\python/mozbuild\mozpack\path.py", line 41, in relpath
    rel = normsep(os.path.relpath(path, start))
  File "c:\mozilla-build\python\lib\ntpath.py", line 522, in relpath
    % (path, start))

I think this might be down to a Python relpath() bug, or missing feature; I believe it should be possible to work with those paths. Python 3 gives a different error but is still confused (ValueError: path is on mount 'C:', start on mount '\\\\?\\C:').

It shows up now because cargo-vendor 0.1.23 used to output:

directory = "c:\\mozilla-source\\mozilla-central\\third_party/rust/"

while cargo 1.37.0's vendor subcommand now does:

directory = "\\\\?\\C:\\mozilla-source\\mozilla-central\\third_party\\rust"

Probably because something is calling std::fs::canonicalize, which gives the full NT path (see this issue).

Summary: mach vendor rust fails on Windows "Cannot mix UNC non-UNC paths" since 1.37.0 → mach vendor rust fails on Windows "Cannot mix UNC and non-UNC paths" since 1.37.0

It looks like this was an issue in cargo-vendor here but fixed before merging, that must have gotten re-introduced somehow when it became a Cargo subcommand.

The path doesn't get transformed if the directory to vendor into doesn't exist, which makes sense as std::fs::canonicalize requires the file to exist so it can open the file and call GetFinalPathNameByHandleW. So a temporary workaround would be to delete third_party/rust, except there's at least one crate (coreaudio-sys) that pulls directly from there. Probably not worth the gymnastics.

:agashlin, are you interested in us adding a workaround in the build system for these paths? Or are you confident it will be fixed upstream?

Flags: needinfo?(agashlin)

I don't know, it hasn't been acknowledged as a problem upstream, but there hasn't yet been a response to my post (yesterday) on the issue.

This isn't something I currently need to get work done, and :bytesized worked around it by running the vendoring step on Linux. It would be nice if mozpath.relpath() could handle these on Windows, though.

Flags: needinfo?(agashlin)
Attachment #9093654 - Attachment description: Bug 1581248 - Strip UNC prefixes in mozpath.relpath(); r?#firefox-build-system-reviewers → Bug 1581248 - Strip //?/ prefixes in mozpath.relpath(); r?#firefox-build-system-reviewers
Pushed by mshal@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/caa26030e1f2
Strip //?/ prefixes in mozpath.relpath(); r=firefox-build-system-reviewers,chmanchester
Status: NEW → RESOLVED
Closed: 4 months ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla71

Should we uplift this to Beta?

(In reply to Ryan VanderMeulen [:RyanVM] from comment #7)

Should we uplift this to Beta?

I don't think it'd be particularly useful - or is it normal to run 'mach vendor rust' on beta? There shouldn't be a downside to uplifting if someone wants to do vendor directly to beta, though.

Flags: needinfo?(mshal)
You need to log in before you can comment on or make changes to this bug.