Skip to content

Crashes on files that use carriage returns. #385

Open
@KhalidAlansary

Description

@KhalidAlansary

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.

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions