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

Cannot load status db when filesystem is readonly #10812

Open
linquize opened this issue Apr 13, 2020 · 3 comments · Fixed by microsoft/vcpkg-tool#1531 · May be fixed by microsoft/vcpkg-tool#1514
Open

Cannot load status db when filesystem is readonly #10812

linquize opened this issue Apr 13, 2020 · 3 comments · Fixed by microsoft/vcpkg-tool#1531 · May be fixed by microsoft/vcpkg-tool#1514
Assignees
Labels
category:question This issue is a question requires:tool-release An issue that has been fixed in the microsoft/vcpkg-tool repo and is waiting for a release thereof

Comments

@linquize
Copy link

linquize commented Apr 13, 2020

Describe the bug

Cannot load status db when filesystem is readonly

vcpkg list
error writing file: C:\vcpkg\installed\vcpkg\status-new: The data is invalid.

Environment

  • OS: Windows 10 x64
  • Compiler: MSVC 2019

To Reproduce
Steps to reproduce the behavior:

  1. Perform vcpkg operation in a writable filesystem
  2. vcpkg install zlib
  3. Make filesystem readonly (you may also deny NTFS write permission)
  4. vcpkg list
  5. Error occur

Expected behavior
No error.
zlib:x64-windows 1.2.11-6 A compression library

Additional context
If C:\vcpkg\installed\vcpkg\status is written immediately before vcpkg install exits, instead of lazy write on subsequent load, it won't fail on a readonly filesystem.

vcpkg update and vcpkg upgrade also fail.

If you run vcpkg list once then make readonly, subsequent vcpkg list will succeed.

@JackBoosY
Copy link
Contributor

@ras0219-msft @dan-shaw
Since this scene is too harsh, do we need to consider fixing this issue?

@JackBoosY JackBoosY added category:vcpkg-bug The issue is with the vcpkg system (including helper scripts in `scripts/cmake/`) requires:discussion labels Sep 30, 2020
@strega-nil
Copy link
Contributor

This is a vcpkg bug, but we'll need to fix other issues.

@ras0219
Copy link
Contributor

ras0219 commented Jan 19, 2021

This is by design but could use improvement. Vcpkg probably should compact the database on exit in addition to on startup.

A workaround could be to issue a list command before making the filesystem read only. This will cause vcpkg to consolidate the DB, which should remove the need for future writes.

See #13097 (comment).

@JackBoosY JackBoosY added category:question This issue is a question category:vcpkg-feature The issue is a new capability of the tool that doesn’t already exist and we haven’t committed and removed category:vcpkg-bug The issue is with the vcpkg system (including helper scripts in `scripts/cmake/`) labels Jan 20, 2021
@JackBoosY JackBoosY removed the category:question This issue is a question label Mar 24, 2021
@JackBoosY JackBoosY added category:question This issue is a question and removed category:vcpkg-feature The issue is a new capability of the tool that doesn’t already exist and we haven’t committed labels May 11, 2021
@BillyONeal BillyONeal reopened this Sep 6, 2024
BillyONeal added a commit to BillyONeal/vcpkg-tool that referenced this issue Sep 7, 2024
BillyONeal added a commit to BillyONeal/vcpkg-tool that referenced this issue Sep 28, 2024
BillyONeal added a commit to BillyONeal/vcpkg-tool that referenced this issue Oct 1, 2024
BillyONeal added a commit to BillyONeal/vcpkg-tool that referenced this issue Oct 9, 2024
BillyONeal added a commit to BillyONeal/vcpkg-tool that referenced this issue Oct 11, 2024
BillyONeal added a commit to BillyONeal/vcpkg-tool that referenced this issue Oct 17, 2024
BillyONeal added a commit to BillyONeal/vcpkg-tool that referenced this issue Oct 24, 2024
Resolves microsoft/vcpkg#10812

Depends on microsoft#1529
Extracted from  microsoft#1514

Splits database_load_check into database_load, which merely loads the current database, and database_load_collapse, which additionally smashes any outstanding update files.
Splits get_installed_files into get_installed_files and get_installed_files_and_upgrade. The former avoids the format conversion and thus does not need to write.

Reading commands database_load / get_installed_files:
* export
* list
* owns
* package_info
* update

Writing commands which use database_load_collapse / get_installed_files_and_upgrade. Also intend to call database_load_collapse at the end after successful completion so that the status file has all update records merged in where possible.
* build
* ci
* install
* remove
* set-installed
* upgrade
@BillyONeal BillyONeal reopened this Dec 17, 2024
@BillyONeal BillyONeal added the requires:tool-release An issue that has been fixed in the microsoft/vcpkg-tool repo and is waiting for a release thereof label Dec 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
category:question This issue is a question requires:tool-release An issue that has been fixed in the microsoft/vcpkg-tool repo and is waiting for a release thereof
Projects
None yet
5 participants