GuillaumeGomez / rustdoc-stripper

rustdoc-stripper is a tool used to edit/remove rustdoc comments from your code

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Infinite loop in `find_one_of`

nt8r opened this issue · comments

This manifests in the build script for cairo-rs running forever after doing a cargo update.

(gdb) bt
#0  0x0000559cd81e1690 in <core::str::pattern::CharSearcher as core::str::pattern::Searcher>::next_match ()
#1  0x0000559cd81e7b27 in core::str::<impl str>::find ()
#2  0x0000559cd81c365a in stripper_lib::strip::find_one_of ()
#3  0x0000559cd81c45ff in stripper_lib::strip::clean_input ()
#4  0x0000559cd81c8f11 in stripper_lib::strip::build_event_list ()
#5  0x0000559cd81bb248 in stripper_lib::strip::strip_comments ()
#6  0x0000559cd81be1c7 in lgpl_docs::purge::{{closure}} ()
#7  0x0000559cd81f2707 in stripper_lib::utils::check_path_type ()
#8  0x0000559cd81f1ab2 in stripper_lib::utils::do_loop_over_files ()
#9  0x0000559cd81f1473 in stripper_lib::utils::loop_over_files ()
#10 0x0000559cd81be160 in lgpl_docs::purge ()
#11 0x0000559cd81bd6a3 in build_script_build::manage_docs ()
#12 0x0000559cd81bd676 in build_script_build::main ()
#13 0x0000559cd81bd873 in core::ops::function::FnOnce::call_once ()
#14 0x0000559cd81bd779 in std::sys_common::backtrace::__rust_begin_short_backtrace ()
#15 0x0000559cd81bd759 in std::rt::lang_start::{{closure}} ()
#16 0x0000559cd8218a91 in core::ops::function::impls::<impl core::ops::function::FnOnce<A> for &F>::call_once () at /rustc/0e2c1281e909ca38479b97962fc9248f75d66412/library/core/src/ops/function.rs:259
#17 std::panicking::try::do_call () at library/std/src/panicking.rs:381
#18 std::panicking::try () at library/std/src/panicking.rs:345
#19 std::panic::catch_unwind () at library/std/src/panic.rs:382
#20 std::rt::lang_start_internal () at library/std/src/rt.rs:51
#21 0x0000559cd81bd738 in std::rt::lang_start ()
#22 0x0000559cd81bd6fb in main ()

This works around the bug for me, for now:

cargo update -p rustdoc-stripper --precise 0.1.14

cargo update doesn't run the build. Also, rustdoc-stripper is only run when embed-lgpl-docs or purge-lgpl-docs features are used, which shouldn't be the case by default. Anyway, I'll try to check what's going on with rustdoc-stripper.

I published the fix, so after a cargo update, everything should be back to normal.