GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — gh-133439: Fix dot commands with trailing spaces are mistaken for multi-line sqlite statements in the sqlite3 command-line interface by tanloong · Pull Request #133440 · python/cpython

Conversation

@tanloong

@tanloong tanloong commented May 5, 2025 •
edited by bedevere-app Bot
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor

Issue: sqlite3 CLI does not recognize dot commands with trailing spaces #133439

  • Issue: sqlite3 CLI does not recognize dot commands with trailing spaces #133439

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@tanloong
tanloong requested review from berkerpeksag and erlend-aasland as code owners May 5, 2025 14:17
@bedevere-app bedevere-app Bot mentioned this pull request May 5, 2025
sqlite3 CLI does not recognize dot commands with trailing spaces #133439
Closed
@bedevere-app bedevere-app Bot added the awaiting review label May 5, 2025
@tanloong
tanloong force-pushed the sqlite3-cli-strip-whitespaces branch from d756211 to 0d89da8 Compare May 6, 2025 13:11
serhiy-storchaka
serhiy-storchaka reviewed May 9, 2025
View reviewed changes

@serhiy-storchaka serhiy-storchaka left a comment

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The sqlite3 CLI supports also space after dot:

sqlite> . version
SQLite 3.45.1 2024-01-30 16:01:20 e876e51a0ed5c5b3126f52e532044363a014bc594cfefa87ffb5b82257ccalt1
zlib version 1.3
gcc-13.3.0 (64-bit)

But not before dot:

sqlite>  .version
   ...> 

To be conforming with it, we should check if the first character is a dot, and if it is, use source[1:].strip() as the command. No stripping is needed for the SQL statement.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
tanloong added 3 commits May 9, 2025 16:18
@tanloong
pythongh-133439: fix dot commands with trailing spaces are not recogn…
080d0c8
…ized in sqlite3 CLI
@tanloong
Add news entry
cd277f3
@tanloong
Only strip trailing whitespaces
e2703b4
@tanloong
tanloong force-pushed the sqlite3-cli-strip-whitespaces branch from 0d89da8 to 3543c33 Compare May 9, 2025 08:19
@tanloong

tanloong commented May 9, 2025

Copy link
Copy Markdown
Contributor Author

Thank you for your review! I have modified the code to use source[1:].strip() as dot command, no stripping for SQL statement.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@tanloong
Support spaces after dot
a4498ab
@tanloong
tanloong force-pushed the sqlite3-cli-strip-whitespaces branch from 3543c33 to a4498ab Compare May 9, 2025 08:24
serhiy-storchaka
serhiy-storchaka reviewed May 9, 2025
View reviewed changes
Comment thread Lib/sqlite3/__main__.py Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread Lib/sqlite3/__main__.py Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread Misc/NEWS.d/next/Library/2025-05-05-22-11-24.gh-issue-133439.LpmyFz.rst Resolved

Uh oh!

There was an error while loading. Please reload this page.

tanloong added 2 commits May 9, 2025 17:28
@tanloong
Handle unknown dot commands
9b3ed39
@tanloong
Add tests for unknown dot commands
4023fb1
@tanloong
tanloong force-pushed the sqlite3-cli-strip-whitespaces branch from cbea2b1 to 487aafc Compare May 9, 2025 09:50
@tanloong
Handle empty string input; Add test; Improve news entry
b473fe9
@tanloong
tanloong force-pushed the sqlite3-cli-strip-whitespaces branch from 487aafc to b473fe9 Compare May 9, 2025 09:52
@tanloong

tanloong commented May 9, 2025

Copy link
Copy Markdown
Contributor Author

Sorry for the overlook, now the empty source and unknown dot commands are handled. I have improved the news entry.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

tanloong added 2 commits May 9, 2025 18:00
@tanloong
Use as-patern to capture the unknow command
bb0c7d9
@tanloong
Ignore empty dot command
5ec7198
serhiy-storchaka
serhiy-storchaka reviewed May 9, 2025
View reviewed changes
Comment thread Lib/sqlite3/__main__.py Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread Lib/sqlite3/__main__.py Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread Lib/sqlite3/__main__.py Resolved

Uh oh!

There was an error while loading. Please reload this page.

@tanloong
Remove "Enter .help" message; Redirect error to stderr
caf47bc
@tanloong
tanloong force-pushed the sqlite3-cli-strip-whitespaces branch from 36b4a16 to caf47bc Compare May 9, 2025 11:07
serhiy-storchaka
serhiy-storchaka approved these changes May 9, 2025
View reviewed changes

@serhiy-storchaka serhiy-storchaka left a comment

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. 👍

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

tanloong reacted with heart emoji
All reactions
  • ❤️ 1 reaction
@bedevere-app bedevere-app Bot added awaiting merge and removed awaiting review labels May 9, 2025
@serhiy-storchaka
serhiy-storchaka enabled auto-merge (squash) May 9, 2025 11:11
@serhiy-storchaka serhiy-storchaka added the needs backport to 3.14 bugs and security fixes label May 9, 2025
@tanloong
Fix test
e1ea159
auto-merge was automatically disabled May 9, 2025 11:13

Head branch was pushed to by a user without write access

@serhiy-storchaka
serhiy-storchaka enabled auto-merge (squash) May 9, 2025 11:15
@serhiy-storchaka
serhiy-storchaka merged commit ebd4881 into python:main May 9, 2025
@miss-islington-app

miss-islington-app Bot commented May 9, 2025

Copy link
Copy Markdown

Thanks @tanloong for the PR, and @serhiy-storchaka for merging it 🌮🎉.. I'm working now to backport this PR to: 3.14.
🐍🍒⛏🤖

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@bedevere-app bedevere-app Bot removed the awaiting merge label May 9, 2025
miss-islington pushed a commit to miss-islington/cpython that referenced this pull request May 9, 2025
@tanloong @miss-islington
pythongh-133439: Fix dot commands with trailing spaces are mistaken f…
42599d5
…or multi-line sqlite statements in the sqlite3 command-line interface (pythonGH-133440)

(cherry picked from commit ebd4881)

Co-authored-by: Tan Long <[email protected]>
@bedevere-app

bedevere-app Bot commented May 9, 2025

Copy link
Copy Markdown

GH-133738 is a backport of this pull request to the 3.14 branch.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@bedevere-app bedevere-app Bot removed the needs backport to 3.14 bugs and security fixes label May 9, 2025
@picnixz

picnixz commented May 9, 2025

Copy link
Copy Markdown
Member

@serhiy-storchaka no 3.13 backports?

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

serhiy-storchaka pushed a commit that referenced this pull request May 9, 2025
@miss-islington @tanloong
[3.14] gh-133439: Fix dot commands with trailing spaces are mistaken …
beb8a50
…for multi-line sqlite statements in the sqlite3 command-line interface (GH-133440) (GH-133738)

(cherry picked from commit ebd4881)

Co-authored-by: Tan Long <[email protected]>
@serhiy-storchaka

serhiy-storchaka commented May 9, 2025

Copy link
Copy Markdown
Member

This is borderline between minor bug fix and minor feature. It improves the quality of life a little, but most people won't notice anything. If anyone wants to backport to 3.13, please do. If not, no problem either.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@tanloong

tanloong commented May 9, 2025

Copy link
Copy Markdown
Contributor Author

I will do that.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@bedevere-app

bedevere-app Bot commented May 9, 2025

Copy link
Copy Markdown

GH-133765 is a backport of this pull request to the 3.13 branch.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@serhiy-storchaka

serhiy-storchaka commented May 9, 2025

Copy link
Copy Markdown
Member

@tanloong, I meant any of the core developers. It's as simple as adding a label. Someone just has to want to do it.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@tanloong

tanloong commented May 9, 2025

Copy link
Copy Markdown
Contributor Author

Ah, sorry, I misunderstood.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

tanloong added a commit to tanloong/cpython that referenced this pull request May 9, 2025
@tanloong
pythongh-133439: Fix dot commands with trailing spaces are mistaken f…
771f617
…or multi-line sqlite statements in the sqlite3 command-line interface (pythonGH-133440)

(cherry picked from commit ebd4881)
erlend-aasland
erlend-aasland reviewed May 10, 2025
View reviewed changes
Comment thread Lib/sqlite3/__main__.py Resolved

Uh oh!

There was an error while loading. Please reload this page.

@erlend-aasland erlend-aasland mentioned this pull request May 10, 2025
gh-133447: Add basic color to sqlite3 CLI #133461
Merged
StanFromIreland
StanFromIreland reviewed May 10, 2025
View reviewed changes
Comment thread Lib/sqlite3/__main__.py
pass
case _ as unknown:
self.write("Error: unknown command or invalid arguments:"
f' "{unknown}".\n')

@StanFromIreland StanFromIreland May 10, 2025

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Error messages do not end with a '.' e.g.:

Python 3.15.0a0 (heads/main:c81fa2b9cd1, May  8 2025, 16:38:25) [GCC 15.1.1 20250425 (Red Hat 15.1.1-1)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> test
Traceback (most recent call last):
  File "<python-input-0>", line 1, in <module>
    test
NameError: name 'test' is not defined

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
serhiy-storchaka pushed a commit that referenced this pull request Jun 13, 2025
@tanloong
[3.13] gh-133439: Fix dot commands with trailing spaces are mistaken …
22cf289
…for multi-line sqlite statements in the sqlite3 command-line interface (GH-133440) (GH-133765)

(cherry picked from commit ebd4881)
Pranjal095 pushed a commit to Pranjal095/cpython that referenced this pull request Jul 12, 2025
@tanloong @Pranjal095
pythongh-133439: Fix dot commands with trailing spaces are mistaken f…
9fde33a
…or multi-line sqlite statements in the sqlite3 command-line interface (pythonGH-133440)
taegyunkim pushed a commit to taegyunkim/cpython that referenced this pull request Aug 4, 2025
@tanloong @taegyunkim
pythongh-133439: Fix dot commands with trailing spaces are mistaken f…
b75cacf
…or multi-line sqlite statements in the sqlite3 command-line interface (pythonGH-133440)
@tanloong
tanloong deleted the sqlite3-cli-strip-whitespaces branch May 1, 2026 06:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@picnixz picnixz picnixz left review comments
@erlend-aasland erlend-aasland erlend-aasland left review comments
@StanFromIreland StanFromIreland StanFromIreland left review comments
@serhiy-storchaka serhiy-storchaka serhiy-storchaka approved these changes
@berkerpeksag berkerpeksag Awaiting requested review from berkerpeksag

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

5 participants

@tanloong @picnixz @serhiy-storchaka @erlend-aasland @StanFromIreland
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.