Skip to content

Provide a option for mask local filesystem info from panic messages #40492

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

Closed
wants to merge 1 commit into from
Closed

Provide a option for mask local filesystem info from panic messages #40492

wants to merge 1 commit into from

Conversation

ghost
Copy link

@ghost ghost commented Mar 13, 2017

This is allowed someone who using xargo to compile and mask local system the source file info from many source panic!.

It's only way to terminate that file path include binary from many source panic!.

Original Issue: #40374

Thanks from https://internals.rust-lang.org/t/disabling-panic-handling/1834

By the way, Rust compiled binary is too large in some case if try to use the libstd.

I didn't test this Pull Request at all. I tried to run 'python x.py test src/libstd --stage 1`, then I got something about...

...

Linux to use this system, please send your config file to [email protected] so it can be added to cmake
Your CMakeCache.txt file was copied to CopyOfCMakeCache.txt. Please send that file to [email protected].
CMake Warning at CMakeLists.txt:73 (message):
  Job pooling is only available with Ninja generators.


-- Target triple: x86_64-unknown-linux-gnu
-- Native target architecture is X86
-- Threads enabled.
-- Doxygen disabled.
-- Sphinx disabled.
-- Go bindings enabled.
-- OCaml bindings disabled, need ctypes >=0.4.
CMake Error at cmake/modules/HandleLLVMOptions.cmake:88 (MESSAGE):
  Unable to determine platform
Call Stack (most recent call first):
  CMakeLists.txt:474 (include)


-- Building with -fPIC
-- Constructing LLVMBuild project information
-- Targeting X86
-- Targeting ARM
-- Targeting AArch64
-- Targeting Mips
-- Targeting PowerPC
-- Targeting SystemZ
-- Targeting JSBackend
-- Targeting MSP430
-- Targeting Sparc
-- Targeting NVPTX
-- Configuring incomplete, errors occurred!
See also "/home/kfairmasterz/upstream/rust/build/x86_64-unknown-linux-gnu/llvm/build/CMakeFiles/CMakeOutput.log".
See also "/home/kfairmasterz/upstream/rust/build/x86_64-unknown-linux-gnu/llvm/build/CMakeFiles/CMakeError.log".
thread 'main' panicked at '
command did not execute successfully, got: exit code: 1

build script failed, must exit now', /home/kfairmasterz/.cargo/registry/src/github.com-1ecc6299db9ec823/cmake-0.1.21/src/lib.rs:605
note: Run with `RUST_BACKTRACE=1` for a backtrace.
Build completed unsuccessfully in 0:00:04

@rust-highfive
Copy link
Contributor

Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @sfackler (or someone else) soon.

If any changes to this PR are deemed necessary, please add them as extra commits. This ensures that the reviewer can see what has changed since they last reviewed the code. Due to the way GitHub handles out-of-date commits, this should also make it reasonably obvious what issues have or haven't been addressed. Large or tricky changes may require several passes of review and changes.

Please see the contribution instructions for more information.

@estebank
Copy link
Contributor

Could you squash into a single commit? (This is only a personal preference.)

In order to test you first need to be able to build. Under a Linux/macOS environment, IIRC, the following should be enough:

$ cd $RUST_REPO
$ ./configure
$ ./x.py test src/libstd --stage 1

@ghost
Copy link
Author

ghost commented Mar 13, 2017

@estebank oops, I forget to run './configure'.

Could you squash into a single commit? (This is only a personal preference.)`

How?

In order to test you first need to be able to build. Under a Linux/macOS environment, IIRC, the following should be enough:

After I run that command, I still couldn't build it up, it still something strange LLVM Compile Error.

Let's try first clean it, then run it again.

@estebank
Copy link
Contributor

@kfairmasterz to squash the last 6 commits you can do git rebase -i HEAD~6, which will open a new instance of your $EDITOR (in my case vim) containing:

pick 28e0969 fix typo
pick 81f8658 oops
pick 9ff78fc forgot some code in libcore
pick e73f0e5 fix typo
pick 6863d7a fix typo
pick 1b62496 Mask local filesystem info from panic messages

You'll want to change all but the last line to s (for squash), as follows:

s 28e0969 fix typo
s 81f8658 oops
s 9ff78fc forgot some code in libcore
s e73f0e5 fix typo
s 6863d7a fix typo
pick 1b62496 Mask local filesystem info from panic messages

After saving that, you'll be presented by git to edit the merged commit description. Just leave the description for the first commit. After this you can do git log to see that you only have one commit instead of 6, and with git show HEAD you can see that it contains all the changes of those 6 commits.

@ghost
Copy link
Author

ghost commented Mar 14, 2017

@estebank Ouch, get more troubles now. Well, just let it go :P
Edit 2: (Fixing...)

@ghost
Copy link
Author

ghost commented Mar 14, 2017

Strange build log:

╭─kfairmasterz@Android ~/upstream/rust  ‹fb2d79578c› 
╰─➤  ./x.py test src/libstd --stage 1                           
    Finished dev [unoptimized] target(s) in 0.0 secs
Synchronizing submodule url for 'cargo'
Synchronizing submodule url for 'src/compiler-rt'
Synchronizing submodule url for 'src/doc/nomicon'
Synchronizing submodule url for 'src/doc/reference'
Synchronizing submodule url for 'src/jemalloc'
Synchronizing submodule url for 'src/liblibc'
Synchronizing submodule url for 'src/llvm'
Synchronizing submodule url for 'src/rt/hoedown'
Synchronizing submodule url for 'src/rust-installer'
HEAD is now at 5f3b9c4c Auto merge of #3807 - nerdrew:nerdrew/_cargo, r=alexcrichton
HEAD is now at d30da544 Merge pull request #30 from japaric/msan
HEAD is now at d08fe97 Add Gankro's table to nomicon/src/phantom-data.md
HEAD is now at 2d23ea6 doc: Use "macOS" terminology consistently
HEAD is now at 11bfb0d Merge pull request #16 from glandium/rust
HEAD is now at 64d954c6 Auto merge of #533 - raphlinus:master, r=alexcrichton
HEAD is now at 859fb269364 Merge pull request #64 from pftbest/sret
Removing utils/llvm-build/llvmbuild/__init__.pyc
Removing utils/llvm-build/llvmbuild/componentinfo.pyc
Removing utils/llvm-build/llvmbuild/configutil.pyc
Removing utils/llvm-build/llvmbuild/main.pyc
Removing utils/llvm-build/llvmbuild/util.pyc
HEAD is now at da282f1 Merge pull request #8 from GuillaumeGomez/line_information
HEAD is now at 4f99485 Merge pull request #54 from brson/docdir
Building stage0 std artifacts (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu)
   Compiling core v0.0.0 (file:///home/kfairmasterz/upstream/rust/src/libcore)
   Compiling alloc v0.0.0 (file:///home/kfairmasterz/upstream/rust/src/liballoc)
   Compiling compiler_builtins v0.0.0 (file:///home/kfairmasterz/upstream/rust/src/libcompiler_builtins)
   Compiling std_unicode v0.0.0 (file:///home/kfairmasterz/upstream/rust/src/libstd_unicode)
   Compiling rand v0.0.0 (file:///home/kfairmasterz/upstream/rust/src/librand)
   Compiling libc v0.0.0 (file:///home/kfairmasterz/upstream/rust/src/rustc/libc_shim)
   Compiling collections v0.0.0 (file:///home/kfairmasterz/upstream/rust/src/libcollections)
   Compiling alloc_jemalloc v0.0.0 (file:///home/kfairmasterz/upstream/rust/src/liballoc_jemalloc)
   Compiling unwind v0.0.0 (file:///home/kfairmasterz/upstream/rust/src/libunwind)
   Compiling panic_unwind v0.0.0 (file:///home/kfairmasterz/upstream/rust/src/libpanic_unwind)
   Compiling panic_abort v0.0.0 (file:///home/kfairmasterz/upstream/rust/src/libpanic_abort)
   Compiling alloc_system v0.0.0 (file:///home/kfairmasterz/upstream/rust/src/liballoc_system)
   Compiling rustc_lsan v0.0.0 (file:///home/kfairmasterz/upstream/rust/src/librustc_lsan)
   Compiling rustc_tsan v0.0.0 (file:///home/kfairmasterz/upstream/rust/src/librustc_tsan)
   Compiling rustc_msan v0.0.0 (file:///home/kfairmasterz/upstream/rust/src/librustc_msan)
   Compiling rustc_asan v0.0.0 (file:///home/kfairmasterz/upstream/rust/src/librustc_asan)
   Compiling std v0.0.0 (file:///home/kfairmasterz/upstream/rust/src/libstd)
    Finished release [optimized] target(s) in 39.7 secs
Copying stage0 std from stage0 (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu / x86_64-unknown-linux-gnu)
Building stage0 test artifacts (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu)
   Compiling getopts v0.0.0 (file:///home/kfairmasterz/upstream/rust/src/libgetopts)
   Compiling term v0.0.0 (file:///home/kfairmasterz/upstream/rust/src/libterm)
   Compiling test v0.0.0 (file:///home/kfairmasterz/upstream/rust/src/libtest)
    Finished release [optimized] target(s) in 12.52 secs
Copying stage0 test from stage0 (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu / x86_64-unknown-linux-gnu)
Building LLVM for x86_64-unknown-linux-gnu
running: "cmake" "/home/kfairmasterz/upstream/rust/src/llvm" "-DLLVM_ENABLE_ASSERTIONS=OFF" "-DLLVM_TARGETS_TO_BUILD=X86;ARM;AArch64;Mips;PowerPC;SystemZ;JSBackend;MSP430;Sparc;NVPTX" "-DLLVM_INCLUDE_EXAMPLES=OFF" "-DLLVM_INCLUDE_TESTS=OFF" "-DLLVM_INCLUDE_DOCS=OFF" "-DLLVM_ENABLE_ZLIB=OFF" "-DWITH_POLLY=OFF" "-DLLVM_ENABLE_TERMINFO=OFF" "-DLLVM_ENABLE_LIBEDIT=OFF" "-DLLVM_PARALLEL_COMPILE_JOBS=4" "-DLLVM_TARGET_ARCH=x86_64" "-DLLVM_DEFAULT_TARGET_TRIPLE=x86_64-unknown-linux-gnu" "-DCMAKE_C_COMPILER=cc" "-DCMAKE_CXX_COMPILER=c++" "-DCMAKE_C_FLAGS=-ffunction-sections -fdata-sections -fPIC -m64" "-DCMAKE_CXX_FLAGS=-ffunction-sections -fdata-sections -fPIC -m64" "-DCMAKE_INSTALL_PREFIX=/home/kfairmasterz/upstream/rust/build/x86_64-unknown-linux-gnu/llvm" "-DCMAKE_BUILD_TYPE=Release"
System is unknown to cmake, create:
Platform/[proxychains] DLL init: proxychains-ng 4.12
[proxychains] DLL init: proxychains-ng 4.12
Linux to use this system, please send your config file to [email protected] so it can be added to cmake
Your CMakeCache.txt file was copied to CopyOfCMakeCache.txt. Please send that file to [email protected].
CMake Warning at CMakeLists.txt:73 (message):
  Job pooling is only available with Ninja generators.


-- Target triple: x86_64-unknown-linux-gnu
-- Native target architecture is X86
-- Threads enabled.
-- Doxygen disabled.
-- Sphinx disabled.
-- Go bindings enabled.
-- OCaml bindings disabled, need ctypes >=0.4.
CMake Error at cmake/modules/HandleLLVMOptions.cmake:88 (MESSAGE):
  Unable to determine platform
Call Stack (most recent call first):
  CMakeLists.txt:474 (include)


-- Building with -fPIC
-- Constructing LLVMBuild project information
-- Targeting X86
-- Targeting ARM
-- Targeting AArch64
-- Targeting Mips
-- Targeting PowerPC
-- Targeting SystemZ
-- Targeting JSBackend
-- Targeting MSP430
-- Targeting Sparc
-- Targeting NVPTX
-- Configuring incomplete, errors occurred!
thread 'main' panicked at '
command did not execute successfully, got: exit code: 1

build script failed, must exit now', /home/kfairmasterz/.cargo/registry/src/github.com-1ecc6299db9ec823/cmake-0.1.21/src/lib.rs:605
note: Run with `RUST_BACKTRACE=1` for a backtrace.
Build completed unsuccessfully in 0:01:15

@ghost
Copy link
Author

ghost commented Mar 14, 2017

No... Let's redo again

@estebank
Copy link
Contributor

It seems like the rebase might have gone awry :)

As for the actual error, it is weird. Does it happen with a fresh clone of the repo as well?

@ghost
Copy link
Author

ghost commented Mar 14, 2017

@estebank Just let me make a frash copy and then apply it =(

@ghost
Copy link
Author

ghost commented Mar 14, 2017

@estebank Done. In finally, I have to generate a patch to apply and fixed problem =(

@estebank
Copy link
Contributor

@kfairmasterz no problem, squashing commits can be a pain. Are you still getting the original error?

@ghost ghost changed the title Mask local filesystem info from panic messages Provide a option for mask local filesystem info from panic messages Mar 14, 2017
@ghost
Copy link
Author

ghost commented Mar 14, 2017

Stucking Cloning into '/home/kfairmasterz/upstream/rust-new/src/llvm'....

Edit: LLVM Compiling now.

@@ -16,3 +16,6 @@ path = "../libcoretest/lib.rs"
[[bench]]
name = "corebenches"
path = "../libcore/benches/lib.rs"

[features]
mask_fileinfo_from_panic = []
Copy link
Author

Choose a reason for hiding this comment

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

This should not as defaults.

@@ -39,3 +39,4 @@ debug-jemalloc = ["alloc_jemalloc/debug"]
jemalloc = ["alloc_jemalloc"]
force_alloc_system = []
panic-unwind = ["panic_unwind"]
mask_fileinfo_from_panic = []
Copy link
Author

Choose a reason for hiding this comment

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

This should not as defaults.

@ghost
Copy link
Author

ghost commented Mar 14, 2017

Compile failure log: http://paste.ubuntu.com/24174597/

I am tired for now. Getting some rest. And I have little confused, does [features] means "default" feature?

@ghost
Copy link
Author

ghost commented Mar 14, 2017

r? @steveklabnik
Looks they are busy..

I have no idea who should I assign to.

@aturon
Copy link
Member

aturon commented Mar 14, 2017

Can you spell out the motivation for this PR in more detail?

@ghost
Copy link
Author

ghost commented Mar 15, 2017

@aturon Like what?

There is no reason when you released a rustc compiled binary to internet which contains your source file path strings

No, This is not like a reason.

Well, It is time to say truth. =/

I am try to making a hacking tool which is I don't want compiled binary reveal my system infomations. In this situation, I think the binary contains source file path strings are not acceptable.

@aturon It is enough for the reason to merge this request?

@aturon
Copy link
Member

aturon commented Mar 15, 2017

Thanks for clarifying @kfairmasterz.

While we may eventually want a way to strip out these paths for the sake of bloat, the libs team felt that (1) it's not a high priority at this time and (2) it will take some deeper design.

Thanks for the PR, but we're going to hold off for now.

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.

5 participants