1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-07-27 20:41:58 +03:00

Fix handling of unix paths that contain ".." components such that "/" is considered its own parent directory.

FossilOrigin-Name: 3c6cadb396de3981bd950eddd532daa8134bd4bf22c578620e323835c96a8500
This commit is contained in:
dan
2023-01-10 14:31:56 +00:00
parent bf395ec58e
commit 2e77734b98
4 changed files with 43 additions and 14 deletions

View File

@ -207,4 +207,32 @@ do_test 4.4.2 {
list [file exists x/test.db-wal] [file exists w/test.db-wal]
} {1 0}
#-------------------------------------------------------------------------
# Check that extra ".." in a path are ignored.
reset_db
do_execsql_test 5.0 {
CREATE TABLE xyz(x, y, z);
INSERT INTO xyz VALUES(1, 2, 3);
}
set path [pwd]
set nLink [llength [split $path /]]
set path "[string repeat ../ [expr $nLink*2]]..${path}/test.db"
sqlite3 db2 $path
do_execsql_test -db db2 5.1 {
SELECT * FROM xyz;
} {1 2 3}
db close
forcedelete test.db2
file link test.db2 $path
sqlite3 db2 test.db2
do_execsql_test -db db2 5.2 {
SELECT * FROM xyz;
} {1 2 3}
forcedelete test.db2
finish_test