Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't silently ignore invalid data in target spec #52330

Merged
merged 1 commit into from
Jul 13, 2018

Conversation

jethrogb
Copy link
Contributor

This is technically a breaking change, but only because invalid data was previously silently being ignored.

@rust-highfive
Copy link
Collaborator

r? @varkor

(rust_highfive has picked a reviewer for you, use r? to override)

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Jul 13, 2018
@rust-highfive
Copy link
Collaborator

The job x86_64-gnu-llvm-5.0 of your PR failed on Travis (raw log). Through arcane magic we have determined that the following fragments from the build log may contain information about the problem.

Click to expand the log.
Check compiletest suite=run-make-fulldeps mode=run-make (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu)
[01:10:52] 
[01:10:52] running 187 tests
[01:11:21] ....................................................................................................
[01:12:15] ........................................................................F.............test [run-make] run-make-fulldeps/long-linker-command-lines has been running for over 60 seconds
[01:13:07] thread 'main' panicked at 'Some tests failed', tools/compiletest/src/main.rs:498:22
[01:13:07] failures:
[01:13:07] 
[01:13:07] ---- [run-make] run-make-fulldeps/target-specs stdout ----
[01:13:07] 
[01:13:07] 
[01:13:07] error: make failed
[01:13:07] status: exit code: 2
[01:13:07] command: "make"
[01:13:07] stdout:
[01:13:07] ------------------------------------------
[01:13:07] make[1]: Entering directory '/checkout/src/test/run-make-fulldeps/target-specs'
[01:13:07] LD_LIBRARY_PATH="/checkout/obj/build/x86_64-unknown-linux-gnu/test/run-make-fulldeps/target-specs/target-specs:/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/lib:/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-bootstrap-tools/x86_64-unknown-linux-gnu/release/deps:/checkout/obj/build/x86_64-unknown-linux-gnu/stage0/lib:" '/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc' --out-dir /checkout/obj/build/x86_64-unknown-linux-gnu/test/run-make-fulldeps/target-specs/target-specs -L /checkout/obj/build/x86_64-unknown-linux-gnu/test/run-make-fulldeps/target-specs/target-specs  foo.rs --target=my-awesome-platform.json --crate-type=lib --emit=asm
[01:13:07] "/checkout/src/etc/cat-and-grep.sh" -v morestack < /checkout/obj/build/x86_64-unknown-linux-gnu/test/run-make-fulldeps/target-specs/target-specs/foo.s
[01:13:07] [[[ begin stdout ]]]
[01:13:07]  .text
[01:13:07]  .file "foo0-8787f43e282added376259c1adb08b80.rs"
[01:13:07]  .section .text._ZN3foo5start17h12186a10b974d6ddE,"ax",@progbits
[01:13:07]  .hidden _ZN3foo5start17h12186a10b974d6ddE
[01:13:07]  .globl _ZN3foo5start17h12186a10b974d6ddE
[01:13:07]  .p2align 4, 0x90
[01:13:07]  .type _ZN3foo5start17h12186a10b974d6ddE,@function
[01:13:07] _ZN3foo5start17h12186a10b974d6ddE:
[01:13:07]  .cfi_startproc
[01:13:07]  xorl %eax, %eax
[01:13:07]  retl
[01:13:07] .Lfunc_end0:
[01:13:07]  .size _ZN3foo5start17h12186a10b974d6ddE, .Lfunc_end0-_ZN3foo5start17h12186a10b974d6ddE
[01:13:07]  .cfi_endproc
[01:13:07] 
[01:13:07] 
[01:13:07]  .section ".note.GNU-stack","",@progbits
[01:13:07] 
[01:13:07] [[[ end stdout ]]]
[01:13:07] LD_LIBRARY_PATH="/checkout/obj/build/x86_64-unknown-linux-gnu/test/run-make-fulldeps/target-specs/target-specs:/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/lib:/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-bootstrap-tools/x86_64-unknown-linux-gnu/release/deps:/checkout/obj/build/x86_64-unknown-linux-gnu/stage0/lib:" '/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc' --out-dir /checkout/obj/build/x86_64-unknown-linux-gnu/test/run-make-fulldeps/target-specs/target-specs -L /checkout/obj/build/x86_64-unknown-linux-gnu/test/run-make-fulldeps/target-specs/target-specs  foo.rs --target=my-invalid-platform.json 2>&1 | "/checkout/src/etc/cat-and-grep.sh" "Error loading target specification"
[01:13:07] [[[ begin stdout ]]]
[01:13:07] error: Error loading target specification: SyntaxError(InvalidSyntax, 1, 1)
[01:13:07]   |
[01:13:07]   = help: Use `--print target-list` for a list of built-in targets
[01:13:07] 
[01:13:07] 
[01:13:07] [[[ end stdout ]]]
[01:13:07] LD_LIBRARY_PATH="/checkout/obj/build/x86_64-unknown-linux-gnu/test/run-make-fulldeps/target-specs/target-specs:/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/lib:/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-bootstrap-tools/x86_64-unknown-linux-gnu/release/deps:/checkout/obj/build/x86_64-unknown-linux-gnu/stage0/lib:" '/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc' --out-dir /checkout/obj/build/x86_64-unknown-linux-gnu/test/run-make-fulldeps/target-specs/target-specs -L /checkout/obj/build/x86_64-unknown-linux-gnu/test/run-make-fulldeps/target-specs/target-specs  foo.rs --target=my-incomplete-platform.json 2>&1 | "/checkout/src/etc/cat-and-grep.sh" 'Field llvm-target'
[01:13:07] [[[ begin stdout ]]]
[01:13:07] error: Error loading target specification: Field llvm-target in target specification is required
[01:13:07]   |
[01:13:07]   = help: Use `--print target-list` for a list of built-in targets
[01:13:07] 
[01:13:07] 
[01:13:07] [[[ end stdout ]]]
[01:13:07] RUST_TARGET_PATH=. LD_LIBRARY_PATH="/checkout/obj/build/x86_64-unknown-linux-gnu/test/run-make-fulldeps/target-specs/target-specs:/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/lib:/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-bootstrap-tools/x86_64-unknown-linux-gnu/release/deps:/checkout/obj/build/x86_64-unknown-linux-gnu/stage0/lib:" '/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc' --out-dir /checkout/obj/build/x86_64-unknown-linux-gnu/test/run-make-fulldeps/target-specs/target-specs -L /checkout/obj/build/x86_64-unknown-linux-gnu/test/run-make-fulldeps/target-specs/target-specs  foo.rs --target=my-awesome-platform --crate-type=lib --emit=asm
[01:13:07] RUST_TARGET_PATH=. LD_LIBRARY_PATH="/checkout/obj/build/x86_64-unknown-linux-gnu/test/run-make-fulldeps/target-specs/target-specs:/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/lib:/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-bootstrap-tools/x86_64-unknown-linux-gnu/release/deps:/checkout/obj/build/x86_64-unknown-linux-gnu/stage0/lib:" '/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc' --out-dir /checkout/obj/build/x86_64-unknown-linux-gnu/test/run-make-fulldeps/target-specs/target-specs -L /checkout/obj/build/x86_64-unknown-linux-gnu/test/run-make-fulldeps/target-specs/target-specs  foo.rs --target=my-x86_64-unknown-linux-gnu-platform --crate-type=lib --emit=asm
[01:13:07] Makefile:3: recipe for target 'all' failed
[01:13:07] make[1]: Leaving directory '/checkout/src/test/run-make-fulldeps/target-specs'
[01:13:07] ------------------------------------------
[01:13:07] stderr:
[01:13:07] ------------------------------------------
[01:13:07] ------------------------------------------
[01:13:07] error: Error loading target specification: pre-link-args: expected a JSON object with fields per linker flavor.
[01:13:07]   |
[01:13:07]   = help: Use `--print target-list` for a list of built-in targets
[01:13:07] 
[01:13:07] make[1]: *** [all] Error 101
[01:13:07] ------------------------------------------
[01:13:07] 
[01:13:07] 
[01:13:07] thread '[run-make] run-make-fulldeps/target-specs' panicked at 'explicit panic', tools/compiletest/src/runtest.rs:3139:9
[01:13:07] 
[01:13:07] 
[01:13:07] failures:
[01:13:07]     [run-make] run-make-fulldeps/target-specs
[01:13:07]     [run-make] run-make-fulldeps/target-specs
[01:13:07] 
[01:13:07] test result: FAILED. 186 passed; 1 failed; 0 ignored; 0 measurr binaryformat bitreader bitwriter bpf bpfasmprinter bpfcodegen bpfdesc bpfdisassembler bpfinfo codegen core coroutines coverage debuginfocodeview debuginfodwarf debuginfomsf debuginfopdb demangle dlltooldriver engine executionengine globalisel hexagon hexagonasmparser hexagoncodegen hexagondesc hexagondisassembler hexagoninfo instcombine instrumentation interpreter ipo irreader lanai lanaiasmparser lanaiasmprinter lanaicodegen lanaidesc lanaidisassembler lanaiinfo libdriver lineeditor linker lto mc mcdisassembler mcjit mcparser mips mipsasmparser mipsasmprinter mipscodegen mipsdesc mipsdisassembler mipsinfo mirparser msp430 msp430asmprinter msp430codegen msp430desc msp430info native nativecodegen nvptx nvptxasmprinter nvptxcodegen nvptxdesc nvptxinfo objcarcopts object objectyaml option orcjit passes powerpc powerpcasmparser powerpcasmprinter powerpccodegen powerpcdesc powerpcdisassembler powerpcinfo profiledata runtimedyld scalaropts selectiondag sparc sparcasmparser sparcasmprinter sparccodegen sparcdesc sparcdisassembler sparcinfo support symbolize systemz systemzasmparser systemzasmprinter systemzcodegen systemzdesc systemzdisassembler systemzinfo tablegen target transformutils vectorize x86 x86asmparser x86asmprinter x86codegen x86desc x86disassembler x86info x86utils xcore xcoreasmprinter xcorecodegen xcoredesc xcoredisassembler xcoreinfo" "--llvm-cxxflags" "-I/usr/lib/llvm-5.0/include -std=c++0x -fuse-ld=gold -Wl,--no-keep-files-mapped -Wl,--no-map-whole-files -fPIC -fvisibility-inlines-hidden -Werror=date-time -std=c++11 -Wall -W -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wno-missing-field-initializers -pedantic -Wno-long-long -Wno-maybe-uninitialized -Wdelete-non-virtual-dtor -Wno-comment -ffunction-sections -fdata-sections -O2 -DNDEBUG -g1  -fno-exceptions -DLLVM_BUILD_GLOBAL_ISEL -D_GNU_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS" "--ar" "ar" "--adb-path" "adb" "--adb-test-dir" "/data/tmp/work" "--android-cross-path" "" "--color" "always"
[01:13:07] 
[01:13:07] 
[01:13:07] failed to run: /checkout/obj/build/bootstrap/debug/bootstrap test
[01:13:07] Build completed unsuccessfully in 0:31:32
[01:13:07] Build completed unsuccessfully in 0:31:32
[01:13:07] make: *** [check] Error 1
[01:13:07] Makefile:58: recipe for target 'check' failed

The command "stamp sh -x -c "$RUN_SCRIPT"" exited with 2.
travis_time:start:12ce5eb4
$ date && (curl -fs --head https://google.com | grep ^Date: | sed 's/Date: //g' || true)

I'm a bot! I can only do what humans tell me to, so if this was not helpful or you have suggestions for improvements, please ping or otherwise contact @TimNN. (Feature Requests)

if let Some(obj) = obj.find(&name[..]).and_then(|o| o.as_object()) {
if let Some(val) = obj.find(&name[..]) {
let obj = val.as_object().ok_or_else(|| format!("{}: expected a \
JSON object with fields per linker flavor.", name))?;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Typo: linker-flavor.

@varkor
Copy link
Member

varkor commented Jul 13, 2018

Looks good to me after the small correction!

@jethrogb
Copy link
Contributor Author

Fixed

@Mark-Simulacrum Mark-Simulacrum added the relnotes Marks issues that should be documented in the release notes of the next release. label Jul 13, 2018
@varkor
Copy link
Member

varkor commented Jul 13, 2018

Thanks!

@bors r+ rollup

@bors
Copy link
Contributor

bors commented Jul 13, 2018

📌 Commit 488472d has been approved by varkor

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Jul 13, 2018
@bors
Copy link
Contributor

bors commented Jul 13, 2018

💡 This pull request was already approved, no need to approve it again.

@bors
Copy link
Contributor

bors commented Jul 13, 2018

📌 Commit 488472d has been approved by varkor

kennytm added a commit to kennytm/rust that referenced this pull request Jul 13, 2018
Don't silently ignore invalid data in target spec

This is technically a breaking change, but only because invalid data was previously silently being ignored.
bors added a commit that referenced this pull request Jul 13, 2018
Rollup of 17 pull requests

Successful merges:

 - #51962 (Provide llvm-strip in llvm-tools component)
 - #52003 (Implement `Option::replace` in the core library)
 - #52156 (Update std::ascii::ASCIIExt deprecation notes)
 - #52280 (llvm-tools-preview: fix build-manifest)
 - #52290 (Deny bare trait objects in src/librustc_save_analysis)
 - #52293 (Deny bare trait objects in librustc_typeck)
 - #52299 (Deny bare trait objects in src/libserialize)
 - #52300 (Deny bare trait objects in librustc_target and libtest)
 - #52302 (Deny bare trait objects in the rest of rust)
 - #52310 (Backport 1.27.1 release notes to master)
 - #52315 (Resolve FIXME(#27942))
 - #52316 (task: remove wrong comments about non-existent LocalWake trait)
 - #52322 (Update llvm-rebuild-trigger in light of LLVM 7 upgrade)
 - #52330 (Don't silently ignore invalid data in target spec)
 - #52333 (CI: Enable core dump on Linux, and print their stack trace on segfault. )
 - #52346 (Fix typo in improper_ctypes suggestion)
 - #52350 (Bump bootstrap compiler to 1.28.0-beta.10)

Failed merges:

r? @ghost
@bors bors merged commit 488472d into rust-lang:master Jul 13, 2018
netbsd-srcmastr pushed a commit to NetBSD/pkgsrc that referenced this pull request Sep 14, 2018
Version 1.29.0 (2018-09-13)
==========================

Compiler
--------
- [Bumped minimum LLVM version to 5.0.][51899]
- [Added `powerpc64le-unknown-linux-musl` target.][51619]
- [Added `aarch64-unknown-hermit` and `x86_64-unknown-hermit` targets.][52861]

Libraries
---------
- [`Once::call_once` now no longer requires `Once` to be `'static`.][52239]
- [`BuildHasherDefault` now implements `PartialEq` and `Eq`.][52402]
- [`Box<CStr>`, `Box<OsStr>`, and `Box<Path>` now implement `Clone`.][51912]
- [Implemented `PartialEq<&str>` for `OsString` and `PartialEq<OsString>`
  for `&str`.][51178]
- [`Cell<T>` now allows `T` to be unsized.][50494]
- [`SocketAddr` is now stable on Redox.][52656]

Stabilized APIs
---------------
- [`Arc::downcast`]
- [`Iterator::flatten`]
- [`Rc::downcast`]

Cargo
-----
- [Cargo can silently fix some bad lockfiles ][cargo/5831] You can use
  `--locked` to disable this behaviour.
- [`cargo-install` will now allow you to cross compile an install
  using `--target`][cargo/5614]
- [Added the `cargo-fix` subcommand to automatically move project code from
  2015 edition to 2018.][cargo/5723]

Misc
----
- [`rustdoc` now has the `--cap-lints` option which demotes all lints above
  the specified level to that level.][52354] For example `--cap-lints warn`
  will demote `deny` and `forbid` lints to `warn`.
- [`rustc` and `rustdoc` will now have the exit code of `1` if compilation
  fails, and `101` if there is a panic.][52197]
- [A preview of clippy has been made available through rustup.][51122]
  You can install the preview with `rustup component add clippy-preview`

Compatibility Notes
-------------------
- [`str::{slice_unchecked, slice_unchecked_mut}` are now deprecated.][51807]
  Use `str::get_unchecked(begin..end)` instead.
- [`std::env::home_dir` is now deprecated for its unintuitive behaviour.][51656]
  Consider using the `home_dir` function from
  https://crates.io/crates/dirs instead.
- [`rustc` will no longer silently ignore invalid data in target spec.][52330]

[52861]: rust-lang/rust#52861
[52656]: rust-lang/rust#52656
[52239]: rust-lang/rust#52239
[52330]: rust-lang/rust#52330
[52354]: rust-lang/rust#52354
[52402]: rust-lang/rust#52402
[52103]: rust-lang/rust#52103
[52197]: rust-lang/rust#52197
[51807]: rust-lang/rust#51807
[51899]: rust-lang/rust#51899
[51912]: rust-lang/rust#51912
[51511]: rust-lang/rust#51511
[51619]: rust-lang/rust#51619
[51656]: rust-lang/rust#51656
[51178]: rust-lang/rust#51178
[51122]: rust-lang/rust#51122
[50494]: rust-lang/rust#50494
[cargo/5614]: rust-lang/cargo#5614
[cargo/5723]: rust-lang/cargo#5723
[cargo/5831]: rust-lang/cargo#5831
[`Arc::downcast`]: https://doc.rust-lang.org/std/sync/struct.Arc.html#method.downcast
[`Iterator::flatten`]: https://doc.rust-lang.org/std/iter/trait.Iterator.html#method.flatten
[`Rc::downcast`]: https://doc.rust-lang.org/std/rc/struct.Rc.html#method.downcast
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
relnotes Marks issues that should be documented in the release notes of the next release. S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants