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

thread '<unnamed>' panicked at 'byte index 1116 is out of bounds of ` #1689

Closed
Folyd opened this issue Dec 9, 2021 · 18 comments
Closed

thread '<unnamed>' panicked at 'byte index 1116 is out of bounds of ` #1689

Folyd opened this issue Dec 9, 2021 · 18 comments
Labels

Comments

@Folyd
Copy link
Contributor

Folyd commented Dec 9, 2021

Bug Report

Environment

Zola version: zola (edge) 0.15.0

Panic backtrace

thread '<unnamed>' panicked at 'byte index 1116 is out of bounds of `, ||ZOLA_SC_PLACEHOLDER||, ||ZOLA_SC_PLACEHOLDER||.`', components/rendering/src/markdown.rs:217:45
stack backtrace:
   0:     0x56477cfc6d5a - std::backtrace_rs::backtrace::libunwind::trace::hf6a6dfd7da937cb0
                               at /rustc/f1edd0429582dd29cccacaf50fd134b05593bd9c/library/std/src/../../backtrace/src/backtrace/libunwind.rs:90:5
   1:     0x56477cfc6d5a - std::backtrace_rs::backtrace::trace_unsynchronized::hc596a19e4891f7f3
                               at /rustc/f1edd0429582dd29cccacaf50fd134b05593bd9c/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   2:     0x56477cfc6d5a - std::sys_common::backtrace::_print_fmt::hb16700db31584325
                               at /rustc/f1edd0429582dd29cccacaf50fd134b05593bd9c/library/std/src/sys_common/backtrace.rs:67:5
   3:     0x56477cfc6d5a - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h231c4190cfa75162
                               at /rustc/f1edd0429582dd29cccacaf50fd134b05593bd9c/library/std/src/sys_common/backtrace.rs:46:22
   4:     0x56477cac77fc - core::fmt::write::h2a1462b5f8eea807
                               at /rustc/f1edd0429582dd29cccacaf50fd134b05593bd9c/library/core/src/fmt/mod.rs:1163:17
   5:     0x56477cfc5c54 - std::io::Write::write_fmt::h71ddfebc68685972
                               at /rustc/f1edd0429582dd29cccacaf50fd134b05593bd9c/library/std/src/io/mod.rs:1696:15
   6:     0x56477cfc6330 - std::sys_common::backtrace::_print::hcc197d4bebf2b369
                               at /rustc/f1edd0429582dd29cccacaf50fd134b05593bd9c/library/std/src/sys_common/backtrace.rs:49:5
   7:     0x56477cfc6330 - std::sys_common::backtrace::print::h335a66af06738c7c
                               at /rustc/f1edd0429582dd29cccacaf50fd134b05593bd9c/library/std/src/sys_common/backtrace.rs:36:9
   8:     0x56477cfc6330 - std::panicking::default_hook::{{closure}}::h6fac9ac9c8b79e52
                               at /rustc/f1edd0429582dd29cccacaf50fd134b05593bd9c/library/std/src/panicking.rs:210:50
   9:     0x56477cfc572a - std::panicking::default_hook::h341c1030c6a1161b
                               at /rustc/f1edd0429582dd29cccacaf50fd134b05593bd9c/library/std/src/panicking.rs:227:9
  10:     0x56477cfc572a - std::panicking::rust_panic_with_hook::h50680ff4b44510c6
                               at /rustc/f1edd0429582dd29cccacaf50fd134b05593bd9c/library/std/src/panicking.rs:624:17
  11:     0x56477cfe5a38 - std::panicking::begin_panic_handler::{{closure}}::h9371c0fbb1e8465a
                               at /rustc/f1edd0429582dd29cccacaf50fd134b05593bd9c/library/std/src/panicking.rs:521:13
  12:     0x56477cfe59b6 - std::sys_common::backtrace::__rust_end_short_backtrace::h9b3efa22a5768c0f
                               at /rustc/f1edd0429582dd29cccacaf50fd134b05593bd9c/library/std/src/sys_common/backtrace.rs:139:18
  13:     0x56477cfe5972 - rust_begin_unwind
                               at /rustc/f1edd0429582dd29cccacaf50fd134b05593bd9c/library/std/src/panicking.rs:517:5
  14:     0x56477c8dc530 - core::panicking::panic_fmt::h23b9203e89cc61cf
                               at /rustc/f1edd0429582dd29cccacaf50fd134b05593bd9c/library/core/src/panicking.rs:100:14
  15:     0x56477c8dca3c - core::str::slice_error_fail::h454fcfb281cf9cd8
  16:     0x56477cdfc694 - rendering::markdown::markdown_to_html::haaa6a41d81ec48c2
  17:     0x56477cde4d4f - rendering::render_content::h0cb32b7fc0cf7787
  18:     0x56477cc8ae55 - library::content::page::Page::render_markdown::h51574c648a8367df
  19:     0x56477cfc232b - rayon::iter::plumbing::bridge_producer_consumer::helper::hb673658c74c0ae2a
  20:     0x56477cfc357b - rayon_core::join::join_context::{{closure}}::hf1094e7d91406d6d
  21:     0x56477cfc2769 - rayon::iter::plumbing::bridge_producer_consumer::helper::hb673658c74c0ae2a
  22:     0x56477cfc3461 - rayon_core::join::join_context::{{closure}}::hf1094e7d91406d6d
  23:     0x56477cfc391d - <rayon_core::job::StackJob<L,F,R> as rayon_core::job::Job>::execute::he0fad10ea131fc93
  24:     0x56477c8f91de - rayon_core::registry::WorkerThread::wait_until_cold::h2c9310f951cc592f
  25:     0x56477cd6e832 - std::sys_common::backtrace::__rust_begin_short_backtrace::he712ca47253d433c
  26:     0x56477cd6e37e - core::ops::function::FnOnce::call_once{{vtable.shim}}::h676489c359b9d93f
  27:     0x56477cff7dd5 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h7bd677a5dc988be6
                               at /rustc/f1edd0429582dd29cccacaf50fd134b05593bd9c/library/alloc/src/boxed.rs:1691:9
  28:     0x56477cff7dd5 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h7b1c1ba11c4db785
                               at /rustc/f1edd0429582dd29cccacaf50fd134b05593bd9c/library/alloc/src/boxed.rs:1691:9
  29:     0x56477cff7dd5 - std::sys::unix::thread::Thread::new::thread_start::h9c58c0d12d84e854
                               at /rustc/f1edd0429582dd29cccacaf50fd134b05593bd9c/library/std/src/sys/unix/thread.rs:106:17
  30:     0x7f2f0e5ca6db - start_thread
  31:     0x7f2f0dd5171f - __clone
  32:                0x0 - <unknown>
Error: Process completed with exit code 101.

Step to reproduce

https://github.com/huhu/rust-search-extension/runs/4466121292?check_suite_focus=true

@Folyd Folyd changed the title thread '<unnamed>' panicked at 'byte index 1116 is out of bounds of , ||ZOLA_SC_PLACEHOLDER||, ||ZOLA_SC_PLACEHOLDER||.', components/rendering/src/markdown.rs:217:45 thread '<unnamed>' panicked at 'byte index 1116 is out of bounds of ` Dec 9, 2021
@Keats Keats added the bug label Dec 9, 2021
@Keats
Copy link
Collaborator

Keats commented Dec 9, 2021

Damn and here I thought we had enough tests to cover the new shortcodes ;(
I guess there is going to be a 0.15.2

@ralfbiedert
Copy link

I think I just ran into the same issue, pushing my site to CI, using Zola 0.15.1 (this one exactly)

thread 'main' panicked at 'byte index 8699 is out of bounds of ` ||ZOLA_SC_PLACEHOLDER|| ||ZOLA_SC_PLACEHOLDER||`', components/rendering/src/markdown.rs:217:45

Repo that reproduces: ralfbiedert/cheats.rs@5dd6e75

@Keats
Copy link
Collaborator

Keats commented Dec 9, 2021

If anyone wants to have a look, it's probably an issue with Shortcode::update_range not being updated in some cases. Otherwise I will fix it tonight/tomorrow.

@Keats
Copy link
Collaborator

Keats commented Dec 9, 2021

Ok I've reduced it to {{ book(page="") }} {{ ex(page="") }} {{ std(page="std") }} making it panic, i'll write a testcase and see what's up

@ralfbiedert
Copy link

Semi-related question: Do you think this bug is also the reason why cargo run -- --root ..\..\cheats.rs build could give errors like Found usage of a shortcode named book but we do not know about. Make sure it's not a typo and that a field name book.{html,md} exists in the templates/shortcodes directory? I ran into that when trying to use a debugger. If it's probably related I can hold back filing a report.

@Keats
Copy link
Collaborator

Keats commented Dec 9, 2021

It's not related.

@Keats
Copy link
Collaborator

Keats commented Dec 9, 2021

Ok the next branch should fix it, at least cheat.rs seems to work

@ralfbiedert
Copy link

Yes, can confirm next fixed the issue for me.

@Keats Keats closed this as completed in 3155662 Dec 10, 2021
@Folyd
Copy link
Contributor Author

Folyd commented Dec 12, 2021

Thanks, @Keats. However, this issue occurred again for 0.15.2. https://github.com/huhu/rust-search-extension/runs/4493374795

Starting building...
zola (edge) 0.15.2 from Vincent Prouillet (keats) installed
Building site...
thread '<unnamed>' panicked at 'byte index 1116 is out of bounds of `, ||ZOLA_SC_PLACEHOLDER||, ||ZOLA_SC_PLACEHOLDER||.`', components/rendering/src/markdown.rs:217:45

@Keats
Copy link
Collaborator

Keats commented Dec 12, 2021

@Folyd that's not 0.15.2 if you see ||ZOLA_SC_PLACEHOLDER||, it has been replaced by @@ZOLA_SC_PLACEHOLDER@@

@Folyd
Copy link
Contributor Author

Folyd commented Dec 16, 2021

That's weird. I install zola via snap install --edge zola in Github Action, and it prints zola (edge) 0.15.2. It still panics, however. 🤔

@Keats
Copy link
Collaborator

Keats commented Dec 16, 2021

Looks like i messed up the snap https://github.com/getzola/zola/blob/master/snapcraft.yaml#L24 and forgot to update it one spot. Do they not have automatic builds based on git tags instead of me having to replace those values manually?

@Folyd
Copy link
Contributor Author

Folyd commented Dec 22, 2021

Looks like i messed up the snap https://github.com/getzola/zola/blob/master/snapcraft.yaml#L24 and forgot to update it one spot. Do they not have automatic builds based on git tags instead of me having to replace those values manually?

I guess we need to update the source-tag manually. I just filed a PR: #1703

@Folyd
Copy link
Contributor Author

Folyd commented Dec 24, 2021

Looks like i messed up the snap https://github.com/getzola/zola/blob/master/snapcraft.yaml#L24 and forgot to update it one spot. Do they not have automatic builds based on git tags instead of me having to replace those values manually?

Hi, @Keats. How can I get the correct 0.15.2 from snap? My Github Action repeatedly panics although it prints zola (edge) 0.15.2. https://github.com/huhu/rust-search-extension/runs/4624073294
Thanks. <3

@Keats
Copy link
Collaborator

Keats commented Dec 24, 2021

I've triggered a new build manually, maybe it will work?

@ralfbiedert
Copy link

Merry Christmas @Keats, thanks for Zola :)

@Folyd
Copy link
Contributor Author

Folyd commented Dec 25, 2021

I've triggered a new build manually, maybe it will work?

Yes, it works. Merry Christmas @Keats.

@Keats
Copy link
Collaborator

Keats commented Dec 25, 2021

Perfect, merry christmas to you both!

thomasantony pushed a commit to thomasantony/zola that referenced this issue Sep 17, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants