Bug report #16076

Opening a Vector Geopackage in QGIS alters its file even when no changes are done by user

Added by Johannes Kroeger over 7 years ago. Updated about 5 years ago.

Status:Open
Priority:Normal
Assignee:-
Category:Unknown
Affected QGIS version:3.6.0 Regression?:No
Operating System: Easy fix?:No
Pull Request or Patch supplied:No Resolution:
Crashes QGIS or corrupts data:No Copied to github as #:23991

Description

Opening a Vector Geopackage in QGIS alters its file. Simply loading the file is enough, you do not even need to load any actual data (visibly to the user).

$ wget http://www.geopackage.org/data/geonames_belgium.gpkg
2017-01-13 17:58:54 (1.28 MB/s) - ‘geonames_belgium.gpkg’ saved [11594752/11594752]

$ cp geonames_belgium.gpkg geonames_belgium.gpkg_original

$ md5sum geonames_belgium.gpkg*

4dacf68ae3a5f2c2fb55a35d062dc580  geonames_belgium.gpkg
4dacf68ae3a5f2c2fb55a35d062dc580  geonames_belgium.gpkg_original

$ ogrinfo -so geonames_belgium.gpkg
INFO: Open of `geonames_belgium.gpkg'
      using driver `GPKG' successful.
1: administrative (3D Measured Point)
2: hydrography (3D Measured Point)
3: leisure (3D Measured Point)
4: places (3D Measured Point)
5: roads (3D Measured Point)
6: spots (3D Measured Point)
7: terrain (3D Measured Point)
8: undersea (3D Measured Point)
9: vegetation (3D Measured Point)

$ md5sum geonames_belgium.gpkg*
4dacf68ae3a5f2c2fb55a35d062dc580  geonames_belgium.gpkg
4dacf68ae3a5f2c2fb55a35d062dc580  geonames_belgium.gpkg_original

hannes@hilmar:/mnt/earx/geodata$ qgis geonames_belgium.gpkg
Warning: loading of qgis translation failed [/usr/share/qgis/i18n//qgis_en_US]
Warning: loading of qt translation failed [/usr/share/qt/translations/qt_en_US]
Warning: QCss::Parser - Failed to load file  "/style.qss" 

Here the layer chooser dialog appeared on which I clicked Cancel and quit QGIS.

$ md5sum geonames_belgium.gpkg*
99fad69efe058b1d308088b96d60e915  geonames_belgium.gpkg
4dacf68ae3a5f2c2fb55a35d062dc580  geonames_belgium.gpkg_original

QGIS changes only some stuff in the header:

$ hexdump -C geonames_belgium.gpkg > geonames_belgium.gpkg.hex
$ hexdump -C geonames_belgium.gpkg_original > geonames_belgium.gpkg_original.hex
$ diff geonames_belgium.gpkg*.hex
2c2
< 00000010  04 00 01 01 00 40 20 20  00 00 00 56 00 00 2c 3b  |.....@  ...V..,;|
---
> 00000010  04 00 01 01 00 40 20 20  00 00 00 54 00 00 2c 3b  |.....@  ...T..,;|
6,7c6,7
< 00000050  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 56  |...............V|
< 00000060  00 2e 05 42 05 00 00 00  26 03 42 00 00 00 2c 3b  |...B....&.B...,;|
---
> 00000050  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 54  |...............T|
> 00000060  00 2d e6 06 05 00 00 00  26 03 42 00 00 00 2c 3b  |.-......&.B...,;|

I could not reproduce this bug with the Raster GPKG https://portal.opengeospatial.org/files/63156 but with any other Vector GPKG I tried.

Please ensure that merely opening a file does never alter it.

History

#1 Updated by Even Rouault over 7 years ago

What you observe is by design to avoid dead lock issues in concurrent reading/writing scenarios. See https://lists.osgeo.org/pipermail/qgis-user/2017-January/038830.html

#2 Updated by Giovanni Manghi almost 7 years ago

  • Easy fix? set to No
  • Regression? set to No

#3 Updated by Jürgen Fischer over 6 years ago

  • Category set to Unknown

#4 Updated by Giovanni Manghi about 5 years ago

  • Status changed from Open to Feedback

Please check if this issue is still valid on QGIS 3.4.5 or 3.6.

#5 Updated by Johannes Kroeger about 5 years ago

  • Description updated (diff)
  • Status changed from Feedback to Open

Still happening in 3.6.0-Noosa. And still a reason for me to "chmod -w" my geopackages before touching them with QGIS :(

#6 Updated by Giovanni Manghi about 5 years ago

  • Affected QGIS version changed from master to 3.6.0

Also available in: Atom PDF