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

Panic when formatting simple html file #26560

Closed
andrewbrey opened this issue Oct 26, 2024 · 1 comment · Fixed by #27164
Closed

Panic when formatting simple html file #26560

andrewbrey opened this issue Oct 26, 2024 · 1 comment · Fixed by #27164
Labels
bug Something isn't working correctly deno fmt Related to the "deno fmt" subcommand or dprint upstream Changes in upstream are required to solve these issues

Comments

@andrewbrey
Copy link

andrewbrey commented Oct 26, 2024

I downloaded the contents of a webpage and attempted to format it with deno fmt and produced a panic. I then attempted to format the file with prettier which had no issues. I whittled the contents of the page down to see which part was causing the panic, and found that I can reliably reproduce with the following very simple html file contents:

As Code

<html>
	<body>
		<script>
			/* some multi-line comment
			with function below it */
			someFunc();
		</script>
	</body>
</html>

As Screenshot

image

Notably, if I do any of the following:

  • Remove the someFunc(); line
  • Remove the multi-line comment
  • Put the contents of the comment all onto one line

then no panic is produced.


Version: Deno 2.0.3

Output of RUST_BACKTRACE=1 deno fmt page.html

============================================================
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: 2.0.3
Args: ["deno", "fmt", "page.html"]

thread 'tokio-runtime-worker' panicked at cli/tools/fmt.rs:792:11:
Formatting not stable. Bailed after 5 tries. This indicates a bug in the formatter where it formats the file (<redacted>/page.html) differently each time. As a temporary workaround you can ignore this file.
stack backtrace:
   0: rust_begin_unwind
   1: core::panicking::panic_fmt
   2: tokio::runtime::task::raw::poll
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
@bartlomieju
Copy link
Member

Traced back to dprint/dprint-plugin-typescript#678

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 deno fmt Related to the "deno fmt" subcommand or dprint upstream Changes in upstream are required to solve these issues
Projects
None yet
2 participants