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

Use devenv.com instead of devenv.exe #28

Merged
merged 1 commit into from Aug 12, 2021
Merged

Conversation

Bobo1239
Copy link
Collaborator

For some reason on some Visual Studio installs* devenv.exe just returns
immediately with an error code and runs the build in the background. It
also doesn't emit any output via stdout/stderr. According to 1
devenv.com is the executable to use for build output via stdout/stderr
and it doesn't misbehave so switch to that.

*In my case it fails with Visual Studio 2022 Preview but works on another (virtual) machine with Visual Studio 2019. But if I install deinstall 2019 and install 2022 in that VM then it also works so I honestly have no idea why the behavior differs. But since it's documented that devenv.com is for stdout/stderr usage I think it makes sense to switch regardless.

@Bobo1239
Copy link
Collaborator Author

Hm, seems like the failure is legit although unrelated to this particular PR. While setting up sanitizers (for #26) it complains about test_filters:

==88165==ERROR: AddressSanitizer: stack-buffer-overflow on address 0x7ffdf9bd40e0 at pc 0x55ccb5f326c0 bp 0x7ffdf9bd2970 sp 0x7ffdf9bd2968
READ of size 8 at 0x7ffdf9bd40e0 thread T0
    #0 0x55ccb5f326bf in test_filters::test_filter_page::_$u7b$$u7b$closure$u7d$$u7d$::hdc21cf66be07f421 /home/bobo1239/Development/Rust/mupdf-rs/tests/test_filters.rs:39
    #1 0x55ccb5f34bda in mupdf::pdf::filter::PdfFilterOptions::set_image_filter::image_filter_callback::_$u7b$$u7b$closure$u7d$$u7d$::hac5f26ab26d4cd43 /home/bobo1239/Development/Rust/mupdf-rs/src/pdf/filter.rs:95:17
    #2 0x55ccb5f2bb01 in std::panicking::try::do_call::h4afea46d07d94b0f /rustc/b70888601af92f6cdc0364abab3446e418b91d36/library/std/src/panicking.rs:401:40
    #3 0x55ccb5f2c0fc in __rust_try (/home/bobo1239/Development/Rust/mupdf-rs/target/x86_64-unknown-linux-gnu/debug/deps/test_filters-a9a7040353012815+0x1000fc)
    #4 0x55ccb5f2b5a9 in std::panicking::try::hd41ae4c0a4676fd9 /rustc/b70888601af92f6cdc0364abab3446e418b91d36/library/std/src/panicking.rs:365:19
    #5 0x55ccb5f2b278 in std::panic::catch_unwind::h2f29e03c166f0b37 /rustc/b70888601af92f6cdc0364abab3446e418b91d36/library/std/src/panic.rs:434:14
    #6 0x55ccb5f34249 in mupdf::pdf::filter::PdfFilterOptions::set_image_filter::image_filter_callback::h14c9c35c45c7b8fa /home/bobo1239/Development/Rust/mupdf-rs/src/pdf/filter.rs:91:23
    #7 0x55ccb61dd438 in pdf_filter_Do_image /home/bobo1239/Development/Rust/mupdf-rs/target/x86_64-unknown-linux-gnu/debug/build/mupdf-sys-050dbdcc1d20cff5/out/build/source/pdf/pdf-op-filter.c:1694:16
    #8 0x55ccb61cbe76 in pdf_process_Do /home/bobo1239/Development/Rust/mupdf-rs/target/x86_64-unknown-linux-gnu/debug/build/mupdf-sys-050dbdcc1d20cff5/out/build/source/pdf/pdf-interpret.c:343:5
    #9 0x55ccb61cea68 in pdf_process_keyword /home/bobo1239/Development/Rust/mupdf-rs/target/x86_64-unknown-linux-gnu/debug/build/mupdf-sys-050dbdcc1d20cff5/out/build/source/pdf/pdf-interpret.c:773:19
    #10 0x55ccb61cf3c3 in pdf_process_stream /home/bobo1239/Development/Rust/mupdf-rs/target/x86_64-unknown-linux-gnu/debug/build/mupdf-sys-050dbdcc1d20cff5/out/build/source/pdf/pdf-interpret.c:948:6
    #11 0x55ccb61cf6dd in pdf_process_contents /home/bobo1239/Development/Rust/mupdf-rs/target/x86_64-unknown-linux-gnu/debug/build/mupdf-sys-050dbdcc1d20cff5/out/build/source/pdf/pdf-interpret.c:1042:3
    #12 0x55ccb61bb64b in pdf_filter_content_stream /home/bobo1239/Development/Rust/mupdf-rs/target/x86_64-unknown-linux-gnu/debug/build/mupdf-sys-050dbdcc1d20cff5/out/build/source/pdf/pdf-clean.c:133:4
    #13 0x55ccb61bc157 in pdf_filter_page_contents /home/bobo1239/Development/Rust/mupdf-rs/target/x86_64-unknown-linux-gnu/debug/build/mupdf-sys-050dbdcc1d20cff5/out/build/source/pdf/pdf-clean.c:364:2
    #14 0x55ccb6186a22 in mupdf_pdf_filter_page_contents /home/bobo1239/Development/Rust/mupdf-rs/mupdf-sys/wrapper.c:2959:9
    #15 0x55ccb5f7230a in mupdf::pdf::page::PdfPage::filter::hb544b398d76b624b /home/bobo1239/Development/Rust/mupdf-rs/src/pdf/page.rs:113:13
    #16 0x55ccb5f2ed53 in test_filters::test_filter_page::h91e2b640fb8dfaa0 /home/bobo1239/Development/Rust/mupdf-rs/tests/test_filters.rs:48:5
    #17 0x55ccb5f32579 in test_filters::test_filter_page::_$u7b$$u7b$closure$u7d$$u7d$::h41c838a71dab1710 /home/bobo1239/Development/Rust/mupdf-rs/tests/test_filters.rs:27:1
    #18 0x55ccb5f32def in core::ops::function::FnOnce::call_once::h5eabbb09d4f2e4c5 /rustc/b70888601af92f6cdc0364abab3446e418b91d36/library/core/src/ops/function.rs:227:5
    #19 0x55ccb5f687a2 in core::ops::function::FnOnce::call_once::h227fa683a5745bd3 /rustc/b70888601af92f6cdc0364abab3446e418b91d36/library/core/src/ops/function.rs:227:5
    #20 0x55ccb5f687a2 in test::__rust_begin_short_backtrace::h3a193bd570ada00a /rustc/b70888601af92f6cdc0364abab3446e418b91d36/library/test/src/lib.rs:578:5
    #21 0x55ccb5f67217 in _$LT$alloc..boxed..Box$LT$F$C$A$GT$$u20$as$u20$core..ops..function..FnOnce$LT$Args$GT$$GT$::call_once::h262d2f411717179a /rustc/b70888601af92f6cdc0364abab3446e418b91d36/library/alloc/src/boxed.rs:1572:9
    #22 0x55ccb5f67217 in _$LT$std..panic..AssertUnwindSafe$LT$F$GT$$u20$as$u20$core..ops..function..FnOnce$LT$$LP$$RP$$GT$$GT$::call_once::hfec00caec3e52a7b /rustc/b70888601af92f6cdc0364abab3446e418b91d36/library/std/src/panic.rs:347:9
    #23 0x55ccb5f67217 in std::panicking::try::do_call::ha5f42e76ffda569d /rustc/b70888601af92f6cdc0364abab3446e418b91d36/library/std/src/panicking.rs:401:40
    #24 0x55ccb5f67217 in std::panicking::try::h53f36df0935b9500 /rustc/b70888601af92f6cdc0364abab3446e418b91d36/library/std/src/panicking.rs:365:19
    #25 0x55ccb5f67217 in std::panic::catch_unwind::h5a497f74b0ce006f /rustc/b70888601af92f6cdc0364abab3446e418b91d36/library/std/src/panic.rs:434:14
    #26 0x55ccb5f67217 in test::run_test_in_process::hab0aead337f48a88 /rustc/b70888601af92f6cdc0364abab3446e418b91d36/library/test/src/lib.rs:601:18
    #27 0x55ccb5f67217 in test::run_test::run_test_inner::_$u7b$$u7b$closure$u7d$$u7d$::h632c383164d4cba2 /rustc/b70888601af92f6cdc0364abab3446e418b91d36/library/test/src/lib.rs:493:39
    #28 0x55ccb5f6664c in test::run_test::run_test_inner::h311959d9ad662fb0 /rustc/b70888601af92f6cdc0364abab3446e418b91d36/library/test/src/lib.rs:531:13
    #29 0x55ccb5f64fdc in test::run_test::h0100370a43da19b5 /rustc/b70888601af92f6cdc0364abab3446e418b91d36/library/test/src/lib.rs:565:28
    #30 0x55ccb5f5fa9b in test::run_tests::ha68944d2a3f5c618 /rustc/b70888601af92f6cdc0364abab3446e418b91d36/library/test/src/lib.rs:306:17
    #31 0x55ccb5f48fa0 in test::console::run_tests_console::ha15fe4f4098b99c5 /rustc/b70888601af92f6cdc0364abab3446e418b91d36/library/test/src/console.rs:290:5
    #32 0x55ccb5f5db74 in test::test_main::hbbe3db04b9ccb726 /rustc/b70888601af92f6cdc0364abab3446e418b91d36/library/test/src/lib.rs:123:15
    #33 0x55ccb5f5ec60 in test::test_main_static::ha7cbc2dc2939d58f /rustc/b70888601af92f6cdc0364abab3446e418b91d36/library/test/src/lib.rs:142:5
    #34 0x55ccb5f2f172 in test_filters::main::h30241eff750d6298 /home/bobo1239/Development/Rust/mupdf-rs/tests/test_filters.rs:1:1
    #35 0x55ccb5f32f8a in core::ops::function::FnOnce::call_once::h88cc2e901f614fa1 /rustc/b70888601af92f6cdc0364abab3446e418b91d36/library/core/src/ops/function.rs:227:5
    #36 0x55ccb5f334a4 in std::sys_common::backtrace::__rust_begin_short_backtrace::h68c5bbd00071befa /rustc/b70888601af92f6cdc0364abab3446e418b91d36/library/std/src/sys_common/backtrace.rs:125:18
    #37 0x55ccb5f333c3 in std::rt::lang_start::_$u7b$$u7b$closure$u7d$$u7d$::h0de507b098a2aaf6 /rustc/b70888601af92f6cdc0364abab3446e418b91d36/library/std/src/rt.rs:63:18
    #38 0x55ccb6422759 in core::ops::function::impls::_$LT$impl$u20$core..ops..function..FnOnce$LT$A$GT$$u20$for$u20$$RF$F$GT$::call_once::h5a0483c8d4e9c15d /rustc/b70888601af92f6cdc0364abab3446e418b91d36/library/core/src/ops/function.rs:259:13
    #39 0x55ccb6422759 in std::panicking::try::do_call::h6ad7918f175f6ddd /rustc/b70888601af92f6cdc0364abab3446e418b91d36/library/std/src/panicking.rs:401:40
    #40 0x55ccb6422759 in std::panicking::try::hcd5af58f52320690 /rustc/b70888601af92f6cdc0364abab3446e418b91d36/library/std/src/panicking.rs:365:19
    #41 0x55ccb6422759 in std::panic::catch_unwind::hf1ae33ba67228f1e /rustc/b70888601af92f6cdc0364abab3446e418b91d36/library/std/src/panic.rs:434:14
    #42 0x55ccb6422759 in std::rt::lang_start_internal::_$u7b$$u7b$closure$u7d$$u7d$::h4a87bc0aa1312dc5 /rustc/b70888601af92f6cdc0364abab3446e418b91d36/library/std/src/rt.rs:45:48
    #43 0x55ccb6422759 in std::panicking::try::do_call::h1ade2a52932fc900 /rustc/b70888601af92f6cdc0364abab3446e418b91d36/library/std/src/panicking.rs:401:40
    #44 0x55ccb6422759 in std::panicking::try::h6f4a87ad169e174b /rustc/b70888601af92f6cdc0364abab3446e418b91d36/library/std/src/panicking.rs:365:19
    #45 0x55ccb6422759 in std::panic::catch_unwind::h043c7f08019f9e2a /rustc/b70888601af92f6cdc0364abab3446e418b91d36/library/std/src/panic.rs:434:14
    #46 0x55ccb6422759 in std::rt::lang_start_internal::h82825699ebfd70bd /rustc/b70888601af92f6cdc0364abab3446e418b91d36/library/std/src/rt.rs:45:20
    #47 0x55ccb5f3332f in std::rt::lang_start::h772c02c59c807516 /rustc/b70888601af92f6cdc0364abab3446e418b91d36/library/std/src/rt.rs:62:5
    #48 0x55ccb5f2f19b in main (/home/bobo1239/Development/Rust/mupdf-rs/target/x86_64-unknown-linux-gnu/debug/deps/test_filters-a9a7040353012815+0x10319b)
    #49 0x7fd4e9f67b24 in __libc_start_main (/usr/lib/libc.so.6+0x27b24)
    #50 0x55ccb5e9cf1d in _start (/home/bobo1239/Development/Rust/mupdf-rs/target/x86_64-unknown-linux-gnu/debug/deps/test_filters-a9a7040353012815+0x70f1d)

Address 0x7ffdf9bd40e0 is located in stack of thread T0 at offset 192 in frame
    #0 0x55ccb5f7219f in mupdf::pdf::page::PdfPage::filter::hb544b398d76b624b /home/bobo1239/Development/Rust/mupdf-rs/src/pdf/page.rs:111

  This frame has 3 object(s):
    [32, 64) '_16' (line 113)
    [96, 136) '_15' (line 113)
    [176, 184) 'err' (line 113) <== Memory access at offset 192 overflows this variable
HINT: this may be a false positive if your program uses some custom stack unwind mechanism, swapcontext or vfork
      (longjmp and C++ exceptions *are* supported)
SUMMARY: AddressSanitizer: stack-buffer-overflow /home/bobo1239/Development/Rust/mupdf-rs/tests/test_filters.rs:39 in test_filters::test_filter_page::_$u7b$$u7b$closure$u7d$$u7d$::hdc21cf66be07f421
Shadow bytes around the buggy address:
  0x10003f3727c0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x10003f3727d0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x10003f3727e0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x10003f3727f0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x10003f372800: 00 00 00 00 f1 f1 f1 f1 f8 f8 f8 f8 f2 f2 f2 f2
=>0x10003f372810: f8 f8 f8 f8 f8 f2 f2 f2 f2 f2 00 f3[f3]f3 f3 f3
  0x10003f372820: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x10003f372830: 00 00 00 00 00 00 00 00 00 00 00 00 f1 f1 f1 f1
  0x10003f372840: f8 f8 f2 f2 f8 f8 f8 f8 f8 f8 f2 f2 f2 f2 f8 f8
  0x10003f372850: f8 f8 f8 f8 f2 f2 f2 f2 f8 f2 f8 f8 f2 f2 00 00
  0x10003f372860: 00 00 00 00 00 f2 f2 f2 f2 f2 00 00 00 00 00 f2
Shadow byte legend (one shadow byte represents 8 application bytes):
  Addressable:           00
  Partially addressable: 01 02 03 04 05 06 07
  Heap left redzone:       fa
  Freed heap region:       fd
  Stack left redzone:      f1
  Stack mid redzone:       f2
  Stack right redzone:     f3
  Stack after return:      f5
  Stack use after scope:   f8
  Global redzone:          f9
  Global init order:       f6
  Poisoned by user:        f7
  Container overflow:      fc
  Array cookie:            ac
  Intra object redzone:    bb
  ASan internal:           fe
  Left alloca redzone:     ca
  Right alloca redzone:    cb
  Shadow gap:              cc
==88165==ABORTING
error: test failed, to rerun pass '--test test_filters'

@messense
Copy link
Owner

messense commented Aug 11, 2021

Looks like it's always reproduced now on CI. Unfortunately I don't have much time to look into it, help appreciated!

(I've sent you an invitation to collaborate on this project.)

@messense
Copy link
Owner

We could disable that test for now to unblock this PR.

@Bobo1239
Copy link
Collaborator Author

Thanks for the invite <3 Think I'll try fixing that bug first. If I shouldn't be able to do that then we can disable the test.

@Bobo1239
Copy link
Collaborator Author

Note: CI in master currently fails due to a just released new version of bitflags which causes breakage: bitflags/bitflags#251

@messense
Copy link
Owner

Note: CI in master currently fails due to a just released new version of bitflags which causes breakage: bitflags/bitflags#251

bitflags 1.3.0 was yanked. Just need a rebase to get this PR ready to merge.

For some reason on some Visual Studio installs devenv.exe just returns
immediately with an error code and runs the build in the background. It
also doesn't emit any output via stdout/stderr. According to [1]
devenv.com is the executable to use for build output via stdout/stderr
and it doesn't misbehave so switch to that.

[1]: https://docs.microsoft.com/en-us/visualstudio/ide/reference/devenv-command-line-switches?view=vs-2019
@messense messense merged commit ce84db7 into messense:master Aug 12, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants