cargo-edit-locally breaks m-c builds due to single quotes

RESOLVED FIXED

Status

()

Core
Build Config
RESOLVED FIXED
8 months ago
8 months ago

People

(Reporter: bholley, Unassigned)

Tracking

Firefox Tracking Flags

(Not tracked)

Details

(Reporter)

Description

8 months ago
I tried following the instructions in bug 1365666 comment 15.

cargo-edit-locally spits out single-quotes in the replace directive like so:

[replace]
'rayon-core:1.0.0' = { path = '/files/mozilla/mc/z/third_party/rust/rayon-core' }

But this breaks pytoml when building in Gecko. Switching to double-quotes fixes the issue.

0:00.31 /usr/bin/make -C /files/mozilla/mc/z/obj-x86_64-apple-darwin16.6.0 -j8 -s backend
 0:00.44 Build configuration changed. Regenerating backend.
 0:00.61 Reticulating splines...
 0:04.88 Traceback (most recent call last):
 0:04.88   File "config.status", line 1005, in <module>
 0:04.88     config_status(**args)
 0:04.88   File "/files/mozilla/mc/z/python/mozbuild/mozbuild/config_status.py", line 147, in config_status
 0:04.88     definitions = list(definitions)
 0:04.88   File "/files/mozilla/mc/z/python/mozbuild/mozbuild/frontend/emitter.py", line 183, in emit
 0:04.88     objs = list(emitfn(out))
 0:04.89   File "/files/mozilla/mc/z/python/mozbuild/mozbuild/frontend/emitter.py", line 1026, in emit_from_context
 0:04.89     for obj in self._handle_linkables(context, passthru, generated_files):
 0:04.89   File "/files/mozilla/mc/z/python/mozbuild/mozbuild/frontend/emitter.py", line 762, in _handle_linkables
 0:04.89     lib = self._rust_library(context, libname, static_args)
 0:04.89   File "/files/mozilla/mc/z/python/mozbuild/mozbuild/frontend/emitter.py", line 420, in _rust_library
 0:04.89     config, cargo_file = self._parse_cargo_file(context)
 0:04.89   File "/files/mozilla/mc/z/python/mozbuild/mozbuild/frontend/emitter.py", line 389, in _parse_cargo_file
 0:04.89     return pytoml.load(f), cargo_file
 0:04.89   File "/files/mozilla/mc/z/python/pytoml/pytoml/parser.py", line 10, in load
 0:04.89     return loads(fin.read(), translate=translate, filename=fin.name)
 0:04.89   File "/files/mozilla/mc/z/python/pytoml/pytoml/parser.py", line 23, in loads
 0:04.89     ast = _p_toml(src)
 0:04.89   File "/files/mozilla/mc/z/python/pytoml/pytoml/parser.py", line 344, in _p_toml
 0:04.89     s.expect_eof()
 0:04.89   File "/files/mozilla/mc/z/python/pytoml/pytoml/parser.py", line 124, in expect_eof
 0:04.89     return self._expect(self.consume_eof())
 0:04.89   File "/files/mozilla/mc/z/python/pytoml/pytoml/parser.py", line 164, in _expect
 0:04.89     raise TomlError('msg', self._pos[0], self._pos[1], self._filename)
 0:04.89 pytoml.core.TomlError: /files/mozilla/mc/z/toolkit/library/rust/Cargo.toml(47, 1): msg
 0:06.63 make: *** [backend.RecursiveMakeBackend] Error 1
Error running mach:

    ['build', 'toolkit/library/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 should consider filing a bug for this issue.

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

The details of the failure are as follows:

Exception: Process executed with non-0 exit code 2: [u'/usr/bin/make', u'-C', u'/files/mozilla/mc/z/obj-x86_64-apple-darwin16.6.0', u'-j8', u'-s', u'backend']

  File "/files/mozilla/mc/z/python/mozbuild/mozbuild/mach_commands.py", line 414, in build
    print_directory=False, keep_going=keep_going)
  File "/files/mozilla/mc/z/python/mozbuild/mozbuild/base.py", line 551, in _run_make
    return fn(**params)
  File "/files/mozilla/mc/z/python/mozbuild/mozbuild/base.py", line 606, in _run_command_in_objdir
    return self.run_process(cwd=self.topobjdir, **args)
  File "/files/mozilla/mc/z/python/mach/mach/mixin/process.py", line 147, in run_process
    raise Exception('Process executed with non-0 exit code %d: %s' % (status, args))
It looks like pytoml isn't a compliant TOML parser here, although I'm not sure if updated versions are. In any case I've updated cargo-edit-locally in https://github.com/alexcrichton/cargo-edit-locally/commit/4ae4a1b6afe663b1f522b7a69e557842f4f3a466 to emit double quotes, which hopefully is parseable by pytoml. I have not verified this.
(Reporter)

Comment 2

8 months ago
(In reply to Alex Crichton [:acrichto] from comment #1)
> It looks like pytoml isn't a compliant TOML parser here, although I'm not
> sure if updated versions are. In any case I've updated cargo-edit-locally in
> https://github.com/alexcrichton/cargo-edit-locally/commit/
> 4ae4a1b6afe663b1f522b7a69e557842f4f3a466 to emit double quotes, which
> hopefully is parseable by pytoml. I have not verified this.

Thanks! I did verify that double quotes fixes the issue, so if your patch does that it should fix the issue.

I'm guessing it's probably more trouble than it's worth to fix pytoml. Let me know when you've done a release, and then we can resolve this bug.
Flags: needinfo?(acrichton)
Sure thing, I just published 0.1.2 which should have this change
Flags: needinfo?(acrichton)
(Reporter)

Comment 4

8 months ago
Thanks Alex!
Status: NEW → RESOLVED
Last Resolved: 8 months ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.