Add a test case for the fix on this branch.

FossilOrigin-Name: 7834cf6c28c63f6ca0e29a508c0f6e3ec9c5c48715344c2db99a9866e92ef205
This commit is contained in:
dan 2018-03-20 12:12:06 +00:00
parent 2cc8f4831e
commit d30830e42d
4 changed files with 34 additions and 10 deletions

View File

@ -1524,7 +1524,7 @@ static int zipfileUpdate(
u8 *pFree = 0; /* Free this */
char *zFree = 0; /* Also free this */
ZipfileEntry *pOld = 0;
int bUpdate = 0;
int bUpdate = 0; /* True for an update that modifies "name" */
int bIsDir = 0;
u32 iCrc32 = 0;

View File

@ -1,5 +1,5 @@
C For\s'zipfile',\sdetect\sattempts\sto\scause\sa\sduplicate\sentry\svia\sUPDATE.
D 2018-03-17T02:13:13.194
C Add\sa\stest\scase\sfor\sthe\sfix\son\sthis\sbranch.
D 2018-03-20T12:12:06.326
F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
F Makefile.in 7016fc56c6b9bfe5daac4f34be8be38d8c0b5fab79ccbfb764d3b23bf1c6fff3
@ -304,7 +304,7 @@ F ext/misc/vfsstat.c bf10ef0bc51e1ad6756629e1edb142f7a8db1178
F ext/misc/vtablog.c 31d0d8f4406795679dcd3a67917c213d3a2a5fb3ea5de35f6e773491ed7e13c9
F ext/misc/vtshim.c 1976e6dd68dd0d64508c91a6dfab8e75f8aaf6cd
F ext/misc/wholenumber.c 784b12543d60702ebdd47da936e278aa03076212
F ext/misc/zipfile.c 7d0dd1cdd09fd7fa9837523044db65e8af109219675dbd17b7da3fb05a17795f
F ext/misc/zipfile.c e8c31e8be9f7a0216b4838343363e90e38ab9886f1ace1fb3dd85a92b1f2ac8b
F ext/misc/zorder.c b0ff58fa643afa1d846786d51ea8d5c4b6b35aa0254ab5a82617db92f3adda64
F ext/rbu/rbu.c ea7d1b7eb44c123a2a619332e19fe5313500705c4a58aaa1887905c0d83ffc2e
F ext/rbu/rbu1.test 43836fac8c7179a358eaf38a8a1ef3d6e6285842
@ -1612,7 +1612,7 @@ F test/writecrash.test f1da7f7adfe8d7f09ea79b42e5ca6dcc41102f27f8e334ad71539501d
F test/zeroblob.test 3857870fe681b8185654414a9bccfde80b62a0fa
F test/zerodamage.test 9c41628db7e8d9e8a0181e59ea5f189df311a9f6ce99cc376dc461f66db6f8dc
F test/zipfile.test 2a923f6ead6a0f9b61d936881f3ee2aeaabe15fc65c196456f58ea9b4b450f9b
F test/zipfile2.test 63bfa89686d12f87f77f8813cd64e948a71dc006e1d6e4c75f5cd1b371010421
F test/zipfile2.test f611e537dbbc41d1a372fe8b27675d8edce57e1fd4d7c98bd5a636f4e9ad22ca
F test/zipfilefault.test 44d4d7a7f7cca7521d569d7f71026b241d65a6b1757aa409c1a168827edbbc2c
F tool/GetFile.cs a15e08acb5dd7539b75ba23501581d7c2b462cb5
F tool/GetTclKit.bat 8995df40c4209808b31f24de0b58f90930239a234f7591e3675d45bfbb990c5d
@ -1712,7 +1712,7 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93
F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc
F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e
F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0
P 9f604418ca21472d84d754f4c3b7f170e5c2bff05e8cee86640e45b43bc53a49
R 36dc2795c05e1e4419391901e9f5285a
U mistachkin
Z b9c6a70c30965228c26a28ea9d8e3504
P cf78a882799424610209e9ac5e76771db3f5e6704ffa181f9598eb0986d93eb8
R 958eea6484ac8b1f82316e81b3fed621
U dan
Z 23959e9d81ae20f5afbec072c04d2b8a

View File

@ -1 +1 @@
cf78a882799424610209e9ac5e76771db3f5e6704ffa181f9598eb0986d93eb8
7834cf6c28c63f6ca0e29a508c0f6e3ec9c5c48715344c2db99a9866e92ef205

View File

@ -210,6 +210,30 @@ do_test 5.0 {
execsql { SELECT name, data IS NULL FROM zipfile($blob2) }
} {notadi/ 1}
#-------------------------------------------------------------------------
# Test that duplicate entries may not be created using UPDATE
# statements.
#
forcedelete test.zip
do_execsql_test 6.0 {
CREATE VIRTUAL TABLE temp.zip USING zipfile('test.zip');
INSERT INTO temp.zip (name,data) VALUES ('test1','test');
INSERT INTO temp.zip (name,data) VALUES ('test2','test');
}
do_catchsql_test 6.1 {
UPDATE temp.zip SET name='test1' WHERE name='test2'
} {1 {duplicate name: "test1"}}
forcedelete test.zip
do_catchsql_test 6.2 {
DROP TABLE zip;
CREATE VIRTUAL TABLE temp.zip USING zipfile('test.zip');
INSERT INTO temp.zip (name,data) VALUES ('test','test');
UPDATE temp.zip set name=name||'new' where name='test';
INSERT INTO temp.zip (name,data) VALUES ('test','test');
UPDATE temp.zip set name=name||'new' where name='test';
} {1 {duplicate name: "testnew"}}
finish_test