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

No file copying, and no Windows import override needed #163

Merged
merged 2 commits into from
Apr 18, 2023

Conversation

dlenski
Copy link
Contributor

@dlenski dlenski commented Apr 16, 2023

  • Don't create unnecessary copies of sqlite3 files

    This takes up time and disk space unnecessarily.

    SQLite3 is able to open databases in a read-only, lock-free mode (see
    "nolock" in https://www.sqlite.org/c3ref/open.html). Tested on Linux with
    Chrome, Chromium, and Firefox; loading cookies from databases opened in this
    mode appear to work fine.

    Somewhat frustratingly and confusingly, this option seems only to be
    accessible by using 'file:' URIs, and not via any other API (see
    https://www.codejam.info/2021/10/bypass-sqlite-exclusive-lock.html).

    Fortunately, the standard library module pathlib (Python 3.4+) makes it easy
    to convert paths to 'file:' URIs in a cross-platform way.

  • Remove ancient import override for Windows

    The replacement of sqlite3 with pysqlite2 on Windows dates back to the
    initial 2015 commit to the parent repository
    (richardpenman/browsercookie@7828992).

    pysqlite2 is no longer maintained, and there no longer appears to be any bug
    or limitation preventing sqlite3 from opening Chrome/Firefox databases on
    Windows.

This takes up time and disk space unnecessarily.

SQLite3 is able to open databases in a read-only, lock-free mode (see
"nolock" in https://www.sqlite.org/c3ref/open.html).  Tested on Linux with
Chrome, Chromium, and Firefox; loading cookies from databases opened in
these modes appear to work fine as long as we attempt to fallback from
read-only, lock-free to simply read-only.

Somewhat frustratingly and confusingly, these option seems only to be
accessible by using 'file:' URIs, and not via any other API (see
https://www.codejam.info/2021/10/bypass-sqlite-exclusive-lock.html).

Fortunately, the standard library module pathlib (Python 3.4+) makes it easy
to convert paths to 'file:' URIs in a cross-platform way.
The replacement of sqlite3 with pysqlite2 on Windows dates back to the
initial 2015 commit to the parent repository
(richardpenman/browsercookie@7828992).

pysqlite2 is no longer maintained, and there no longer appears to be any bug
or limitation preventing sqlite3 from opening Chrome/Firefox databases on
Windows.
@rafiibrahim8 rafiibrahim8 merged commit 79f0cd6 into borisbabic:master Apr 18, 2023
@rafiibrahim8
Copy link
Collaborator

Version 0.18.0 was released with these updates. Thank you 💛

dlenski pushed a commit to dlenski/browser_cookie3 that referenced this pull request Oct 4, 2023
No file copying, and no Windows import override needed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants