Skip to content

Crashes on files that use carriage returns. #385

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

Open
KhalidAlansary opened this issue May 4, 2025 · 0 comments · May be fixed by #386
Open

Crashes on files that use carriage returns. #385

KhalidAlansary opened this issue May 4, 2025 · 0 comments · May be fixed by #386
Assignees
Labels
bug Something isn't working

Comments

@KhalidAlansary
Copy link

Bug report

bad.txt

Describe the bug

Crashes when given a file that uses Windows's carriage returns.
Spits out the following error:

Encountered an unexpected error

This is a bug in Postgres Tools, not an error in your code, and we would appreciate it if you could report it along with the following information to help us fixing the issue:

Source Location: crates/pgt_lexer/src/lib.rs:181:9
Thread Name: pgt::worker_0
Message: No token found at position 20: 'Some("\r")'

bad.sql internalError/panic  INTERNAL  ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

  ✖ processing panicked: No token found at position 20: 'Some("\r")'
  
  ⚠ This diagnostic was derived from an internal error. Potential bug, please report it if necessary.
  

Checked 0 files in 1588µs. No fixes applied.
internalError/io ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

  ✖ No files were processed in the specified paths.

To Reproduce

Steps to reproduce the behavior, please provide code snippets or a repository:

  1. Download the attached bad.txt
  2. Rename to bad.sql
  3. run postgrestools check bad.sql

bad.txt

Expected behavior

Should work similar to files written on a UNIX system.

Screenshots

Image

System information

  • OS: Arch Linux

Additional context

I received the file from a friend who uses Windows. Whan I ran the command, it failed. When I wrote the code myself in a new file, it worked fine.

@KhalidAlansary KhalidAlansary added the bug Something isn't working label May 4, 2025
@psteinroe psteinroe linked a pull request May 5, 2025 that will close this issue
@psteinroe psteinroe self-assigned this May 5, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants