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

deno lint panicks after the 1.44.1 upgrade on file saved as UTF-8 w/ BOM #24122

Closed
punarinta opened this issue Jun 6, 2024 · 4 comments · Fixed by #24136
Closed

deno lint panicks after the 1.44.1 upgrade on file saved as UTF-8 w/ BOM #24122

punarinta opened this issue Jun 6, 2024 · 4 comments · Fixed by #24136
Labels
bug Something isn't working correctly

Comments

@punarinta
Copy link

Version: Deno 1.44.1
The bug was not present in 1.44.0

When running deno lint I now get the following:

============================================================
Deno has panicked. This is a bug in Deno. Please report this
at https://github.com/denoland/deno/issues/new.
If you can reliably reproduce this panic, include the
reproduction steps and re-run with the RUST_BACKTRACE=1 env
var set and include the backtrace in your report.

Platform: linux x86_64
Version: 1.44.1
Args: ["deno", "lint"]

thread 'tokio-runtime-worker' panicked at /home/runner/.cargo/registry/src/index.crates.io-6f17d22bba15001f/dprint-swc-ext-0.16.0/src/common/pos.rs:348:3:
byte index 228602 is out of bounds of `import { jsPDF } from 'jspdf'

const font = 'AAEAAAASAQAABAAgR0RFRrRCsIIAAidIAAACYkdQT1P/GhLXAAIprAAAXcxHU1VC64LkWQACh3gAABWQT1MvMpeCsagAAglsAAAAYGNtYXABd1geAAIO5AAAEkZjdnQgK6gHnQACJDQAAABUZnBnbXf4YKsAAiEsAAABvGdhc3AACAATAAInPAAAAAxnbHlmJroL9AAAASwAAelsaGR`[...]
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

Not sure what extra information you might need for debugging, but feel free to mention me, I'll try to help.

@dsherret
Copy link
Member

dsherret commented Jun 6, 2024

Can you provided that file so we can try to reproduce it? (the one with const font = 'A)

@dsherret dsherret added bug Something isn't working correctly needs info needs further information to be properly triaged labels Jun 6, 2024
@punarinta
Copy link
Author

punarinta commented Jun 7, 2024

Thank you for looking into this!

Here's the file (rename it to .js, GitHub doesn't allow attaching JS files).
Roboto-normal.js.txt

I'm still trying to get a minimal reproducible example, the file alone does not cause a crash, neither does a setup with its parent file included. 🤔

The file can be simplified down to this, and it would still cause a linter crash:

console.log('Hello')

@punarinta
Copy link
Author

punarinta commented Jun 7, 2024

Well, I'm out of clues. Here's a run with RUST_BACKTRACE=full, and I really hope it will help. 😓

============================================================
Deno has panicked. This is a bug in Deno. Please report this
at https://github.com/denoland/deno/issues/new.
If you can reliably reproduce this panic, include the
reproduction steps and re-run with the RUST_BACKTRACE=1 env
var set and include the backtrace in your report.

Platform: linux x86_64
Version: 1.44.1
Args: ["deno", "lint"]

thread 'tokio-runtime-worker' panicked at /home/runner/.cargo/registry/src/index.crates.io-6f17d22bba15001f/dprint-swc-ext-0.16.0/src/common/pos.rs:348:3:
byte index 22 is out of bounds of `console.log('Hello')
`
stack backtrace:
   0:     0x5b8221b1b956 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h410d4c66be4e37f9
   1:     0x5b8221b503f0 - core::fmt::write::he40921d4802ce2ac
   2:     0x5b8221b14f0f - std::io::Write::write_fmt::h5de5a4e7037c9b20
   3:     0x5b8221b1b734 - std::sys_common::backtrace::print::h11c067a88e3bdb22
   4:     0x5b8221b1d4a7 - std::panicking::default_hook::{{closure}}::h8c832ecb03fde8ea
   5:     0x5b8221b1d209 - std::panicking::default_hook::h1633e272b4150cf3
   6:     0x5b8222080cdb - deno::setup_panic_hook::{{closure}}::hb87cb8d0a0de7d22
   7:     0x5b8221b1db36 - std::panicking::rust_panic_with_hook::hb164d19c0c1e71d4
   8:     0x5b8221b1d882 - std::panicking::begin_panic_handler::{{closure}}::h0369088c533c20e9
   9:     0x5b8221b1be56 - std::sys_common::backtrace::__rust_end_short_backtrace::hc11d910daf35ac2e
  10:     0x5b8221b1d5d4 - rust_begin_unwind
  11:     0x5b8221b4d485 - core::panicking::panic_fmt::ha6effc2775a0749c
  12:     0x5b8221b542a1 - core::str::slice_error_fail_rt::hae2b0a3e014351e1
  13:     0x5b8221b54087 - core::str::slice_error_fail::he2ff12236fb0c056
  14:     0x5b822242f8f1 - core::str::traits::<impl core::ops::index::Index<I> for str>::index::h18de035b74d078fc
  15:     0x5b822246776b - <deno_lint::rules::no_irregular_whitespace::NoIrregularWhitespace as deno_lint::rules::LintRule>::lint_program_with_ast_view::{{closure}}::h3ceb7ce647f3b09e
  16:     0x5b82224676fd - <deno_lint::rules::no_irregular_whitespace::NoIrregularWhitespace as deno_lint::rules::LintRule>::lint_program_with_ast_view::h5c6821462f44342f
  17:     0x5b822245337f - deno_lint::linter::Linter::lint_inner::{{closure}}::hc81626a0fdc25254
  18:     0x5b8222403868 - dprint_swc_ext::view::generated::with_ast_view::h5c74fecdefc5c926
  19:     0x5b822243f483 - deno_ast::parsed_source::ParsedSource::with_view::h91ae2d9cd20057c2
  20:     0x5b8222452349 - deno_lint::linter::Linter::lint_inner::h909fca0dbe10943a
  21:     0x5b822245211e - deno_lint::linter::Linter::lint_file::habd37c4f2355f8c8
  22:     0x5b8221cc214b - tokio::runtime::task::raw::poll::h0eed1f92085203d2
  23:     0x5b8223c791b0 - std::sys_common::backtrace::__rust_begin_short_backtrace::h8f8c32a0a9ac8984
  24:     0x5b8223c7a726 - core::ops::function::FnOnce::call_once{{vtable.shim}}::h46e9db3577820a3b
  25:     0x5b8221b242d5 - std::sys::pal::unix::thread::Thread::new::thread_start::h3631815ad38387d6
  26:     0x7ff84f894ac3 - start_thread
                               at ./nptl/pthread_create.c:442:8
  27:     0x7ff84f926850 - __GI___clone3
                               at ./misc/../sysdeps/unix/sysv/linux/x86_64/clone3.S:81
  28:                0x0 - <unknown>

@dsherret
Copy link
Member

dsherret commented Jun 7, 2024

Thanks, I was able to reproduce it by saving that file as UTF8 w/ BOM.

@dsherret dsherret removed the needs info needs further information to be properly triaged label Jun 7, 2024
@dsherret dsherret changed the title deno lint panicks after the 1.44.1 upgrade deno lint panicks after the 1.44.1 upgrade on file saved as UTF-8 w/ BOM Jun 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working correctly
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants