Commit Graph

769 Commits

Author SHA1 Message Date
drh
87cb97b0ec Fix harmless compiler warning in flockCheckReservedLock().
FossilOrigin-Name: f369de3d8fa34a403b5c9f6269f7e3fdb16a13784a70460c5032ad4e66615d64
2024-10-15 22:22:53 +00:00
dan
48dd75df73 Fix the xCheckReservedLock() method of the flock VFS to avoid dropping the file-lock.
FossilOrigin-Name: 8ffaf85249ff38ceea037a6e96b3484c912f1c1aa55b8642297d592768661344
2024-10-09 15:40:07 +00:00
stephan
2c77d51dfe Resolve a harmless compiler warning in QNX builds.
FossilOrigin-Name: 2916460179c6089375188c6e4e3cff1fca5bbbbb7280a10c919e09e75d1f11f8
2024-09-26 18:13:10 +00:00
drh
901b671455 Automatically disable directory fsync when compiling for AIX.
FossilOrigin-Name: 8d170e07e20c21a5bb97fdc8c2d01d92178f5fe740e60d203e4621747cfce33e
2024-08-18 09:53:37 +00:00
dan
41caf1cdfa Handle the case where unix-dotfile is used with URI parameter nolock=1.
FossilOrigin-Name: 3925a5b904e159d54455cfc73fe837a9c6ea3a6d60da63afde3242b4d6f67c90
2024-06-11 20:28:56 +00:00
dan
f6ec2b5946 Fix a problem with rolling back hot journals using the unix-dotfile VFS.
FossilOrigin-Name: 4ae3300b79e03381fd7f1033bb7978bb6367369790f17c3bdacac51e205edaf9
2024-06-11 20:03:32 +00:00
stephan
e1b55a5af9 Modify three #if checks in os_unix.c to improve handling of SQLITE_OMIT_WAL on WASI builds. Based on the discussion in/around [forum:57e918431735128a|forum post 57e918431735128a].
FossilOrigin-Name: 296eeb26c816bc734530cf446922f25be970b901c884df1a98083502f0d1e9f5
2024-06-03 07:22:28 +00:00
dan
af64a22762 Have os_unix.c reuse cached file-descriptors in the case when a read-write fd is requested on a read-only file and a read-only fd returned.
FossilOrigin-Name: a678e85402af08c1e387bf30ff2205f84dd7da749755da565d70f831c007a3d9
2024-03-21 11:37:36 +00:00
stephan
e0a9935be1 Extend the strerror_r() result type discrepancy check in os_unix.c to include the Android NDK, as reported in [forum post 3f13857fa4062301|forum:3f13857fa4062301]. The NDK's strerror_r() signature is version-dependent, whereas this change assumes int return (POSIX semantic) across all versions.
FossilOrigin-Name: f18b2524da6bbbcf372b292df52fbe6efa49fd6e1f1f13ef2447279d559f7a08
2024-02-19 12:20:46 +00:00
dan
bcf3df0192 In os_unix.c and os_win.c, do not allow xFetch() to return a pointer to a page buffer that is right at the end of the mapped region - if the database is corrupted in a specific way such a page buffer might be overread by several bytes.
FossilOrigin-Name: 2684feac3bc9c5463604900d72710be861527614f4957224c74a16a3b3c702f5
2024-01-23 16:09:22 +00:00
drh
3e2ffbd476 Minor change to os_unix.c to facilitate 100% MC/DC testing.
FossilOrigin-Name: 0dfa7b4da134db281c3c4eddb4569c53a450f955f0af2f410e13db801aff4ea2
2024-01-08 15:23:45 +00:00
dan
0d7f0e49a4 Fix SQLITE_ENABLE_SETLK_TIMEOUT assert() statements in os_unix.c to avoid reading past the end of the unixShmNode.aMutex[] array.
FossilOrigin-Name: 029a05cd2928d43d81e4549cce5388c432e2c9e75e3fa0b2fe6e91021b2fb9ac
2023-12-20 19:33:41 +00:00
dan
e52854a9e6 In SQLITE_ENABLE_SETLK_TIMEOUT builds, use blocking locks in place of sleep() when opening a read-transaction.
FossilOrigin-Name: a51ef39998e25e86bd0600e71d15011b12e05f4319608018293bdaecb09e8c97
2023-11-27 19:22:50 +00:00
dan
046a7f9493 When ENABLE_SETLK is defined, avoid ever blocking on the lock mutex in os_unix.c when requesting an exclusive lock.
FossilOrigin-Name: eb36d475e91bfdbf4a18b6fd9751fbcecf15d960dcd1c00d2d18b5bf1d7503fe
2023-11-18 17:20:04 +00:00
dan
735e7ee62a When SQLITE_ENABLE_SETLK_TIMEOUT is defined, use a separate mutex in os_unix.c for each shm locking slot.
FossilOrigin-Name: 4098df9652d90f2d22d5591d915d672c5413471f7916223510ba6fd932bfdd36
2023-11-17 17:10:37 +00:00
dan
91c8e65dd4 Changes so that if SQLITE_ENABLE_SETLK_TIMEOUT is defined as 2 instead of 1, all blocking locks are taken for a single millisecond and the default busy-handler invoked as normal.
FossilOrigin-Name: 79e24ec3dd40373bbb93792829b18d9ef40daf19d4606174e36c8e19e61a7529
2023-11-15 19:19:04 +00:00
dan
275234e320 Fix an assert() that could fail within calls to sqlite3_snapshot_open() in SQLITE_ENABLE_SETLK_TIMEOUT builds.
FossilOrigin-Name: 84634bc268e5c80146f3f3b2e13118f239c9a7e4e4e9dfcaccef2b17252ce53b
2023-11-07 20:11:49 +00:00
drh
208f5c65d4 Fix harmless compiler warnings.
FossilOrigin-Name: cc8efe0494b8fe0df18aa67b1675779bf704d1ac53647fe1f7f55d8048041680
2023-10-25 19:06:23 +00:00
drh
9b1334b7d3 Unix builds now assume the presence of nanosleep() in the standard library.
The -DHAVE_NANOSLEEP=0 compile-time option can be used to build on systems
(if any still exist) where this is not the case.

FossilOrigin-Name: 779d5dc8797ea246d0397f7e94b1be716b0baa735e8d9f5a6fc4cffd887a7420
2023-08-03 12:41:30 +00:00
larrybr
bc91738e66 Add a C-source spell-checking facility. make misspell (on Nix)
FossilOrigin-Name: 26c1bb4bd9e9f56613c3aa87407a7f562fd4ebde5bfd6dece02078001d9a45f8
2023-06-07 08:40:31 +00:00
drh
be0023faba Automatically set HAVE_PREAD and HAVE_PWRITE on linux, as has been done in
MacOS for a long time now.

FossilOrigin-Name: 2f7a36d2c374100019bd9d38aea51ea10cfcf9b1f0330ba084a75f0773df8ebf
2023-04-12 19:40:00 +00:00
stephan
f8c73aed67 Merge trunk into wasi-patches branch.
FossilOrigin-Name: 656d36f50f630da68262469087bad1ac71b10325e233a7963103c8cbc232f61a
2023-02-06 22:25:18 +00:00
dan
288409d731 Fix a comment related to PENDING locks in os_unix.c. No code changes.
FossilOrigin-Name: 6b3546c871fe78a4e550e0144b48ac98325787cc8b192a9e7f5f2a2ffa57f76d
2023-02-01 14:17:25 +00:00
dan
ca3aabdf53 Fix a race condition during hot-journal rollback that could theoretically cause spurious corruption errors.
FossilOrigin-Name: 20ea53ddf590a9dd19501fabd2bfdb9c10b5eb265cd2995bdb335769c936c763
2023-01-31 20:21:06 +00:00
stephan
87ce1ff7f7 Merge trunk into wasi-patches branch.
FossilOrigin-Name: 2ce89f5efcdb8b4c58eb2d30833a76d79ae0134c31d5ab8564be9e1cf5a1f4f0
2023-01-27 05:37:24 +00:00
stephan
a7c498599f Merge trunk into wasi-patches branch and add missing yes/no result to the configure script's output for the --with-wasi-sdk=PATH test.
FossilOrigin-Name: adc0ede0a43241b85563408d0de8e640a75ec4f7bdfe5e48acc5cdd6b182b88c
2023-01-11 22:45:20 +00:00
dan
2e77734b98 Fix handling of unix paths that contain ".." components such that "/" is considered its own parent directory.
FossilOrigin-Name: 3c6cadb396de3981bd950eddd532daa8134bd4bf22c578620e323835c96a8500
2023-01-10 14:31:56 +00:00
stephan
9be7a363cc Merge trunk into wasi-patches branch.
FossilOrigin-Name: 13dade955d46020ab408734123261e9fadb8bccbaf67003b111112af4789d8c0
2022-12-10 05:00:16 +00:00
drh
b1026aeda9 In the unix backend, when implementing the defenses against small file
descriptors, delete a file just created if it was opened with
O_EXCL|O_CREAT so that it can be created again the next time through the
loop.  Fix for the problem described by
[forum:/forumpost/699af709ab3a8ccf|forum post 699af709ab3a8ccf].

FossilOrigin-Name: c0cfe0582add87981826d124a0763482f51fae4b105b5a970dd56919f1d04d60
2022-12-06 13:12:33 +00:00
drh
a42281a312 Always use nanosleep() (instead of usleep() or sleep) if the
_POSIX_C_SOURCE macro says it should be available.

FossilOrigin-Name: 6620c57b9d3eae7226a412318b43393196df069b5b90aae0cf1743fdd2d102dd
2022-11-30 13:44:31 +00:00
stephan
9a92d53cf5 Account for lack of mmap(), getpid(), and shared memory APIs in wasi.
FossilOrigin-Name: 80ff026fb4b2203eea53d4930c1e9bb138db951fb408739c7d5c776fb397b665
2022-11-19 07:39:31 +00:00
stephan
8cfd2c3eeb Preliminary patches to get sqlite3.c building as-is in WASI environments.
FossilOrigin-Name: 19c04d71bf0f2f44d5a03288cbea3f63cf4eae2fa018ac6be4ae49a321e2b2f3
2022-11-19 07:17:12 +00:00
drh
20a9ed1dc6 Include the kv-vfs as an optional VFS on unix builds if the
SQLITE_OS_KV_OPTIONAL compile-time option is present.

FossilOrigin-Name: 852812d1e2ec3c53ad7c6c64662b37d861fefcf1baeee3d58eba88bcb3f6d8df
2022-09-17 18:29:49 +00:00
drh
b126ec18b6 Fix the <sys/time.h> include in os_kv.c.
FossilOrigin-Name: 878cc93e779c3857adc711f212520f007256274fcd3f6f3d72c754a937fcd198
2022-09-12 19:33:20 +00:00
drh
6b013afb88 Fix the amalgamation so that it builds with the standard unix backend again.
FossilOrigin-Name: 0adf158f4e5791339988185cc29347c75056b062e0db65b5999fdfa1f433c1ed
2022-09-12 12:41:07 +00:00
drh
18a3a48db1 Experimental changes to put sqlite3_temp_directory behind a mutex.
FossilOrigin-Name: 5ee3515fbb88bf1ae5f8b507844f82dcc429380b6ebeab9b09b52b25ee60a60d
2022-09-02 00:36:16 +00:00
drh
087f143f87 Add the (undocumented) SQLITE_DEFAULT_UNIX_VFS compile-time option.
FossilOrigin-Name: 49828bdec5f926cd18a069d39a5db0b1e1f3528a2affcfbaa1cf7b98aca51b3b
2022-08-12 18:46:01 +00:00
drh
b8b2d9c5e1 Fix harmless compiler warnings in the new unixFullPathname implementation.
FossilOrigin-Name: f7e1ceb5b59a876cfd04a8aac0ee2b322c970555b9c361b4953d711ef6596e37
2022-05-17 15:11:57 +00:00
drh
b302c065d8 Use osReadlink() in os_unix.c, not readlink() directly.
FossilOrigin-Name: c3da4c1611cebd9f9d695892a3ffddc47d5f0db1a1ea8bd2b4f83ef7673b68de
2022-05-11 17:45:50 +00:00
drh
e8346d0a88 For the unix VFS, rewrite the xFullPathname method so that it automatically
resolves all symbolic links, rendering a canonical pathname that contains
no symlinks.

FossilOrigin-Name: 40c9273d0e0e74e1df22e996a5d486e838f4320defd2121e2d95eeed8aea6235
2022-05-11 16:46:27 +00:00
drh
56d88aad29 Harden the xShmLock method of both the unix and Windows VFSes so that they
are robust against being invoked when the SHM file is not open.

FossilOrigin-Name: 67d8b434f628d44c4a90ce8ff5ab2e381f500bb42bdbfab9a17d21925a2ec6cd
2022-03-22 19:41:55 +00:00
drh
577f0a1e45 Improve the defenses against bad pathnames input into the findCreateFileMode()
function of os_unix.c in order to quiet static-analyzer warnings.  There
are no demonstrated problems in the prior code, but this change makes the code
easier to prove correct and more robust against future changes.

FossilOrigin-Name: a9cda38997a692e25d2fe994a9a3fb9472c00ba04323c82e706fdb1112d4244e
2022-03-09 12:20:40 +00:00
dan
d9137e3be0 Fix a benign data race in os_unix.c that might trouble tsan and similar tools.
FossilOrigin-Name: 95806ac1dabe4598170061d903ae30f09bafac149ff6696963a7e056ac846cdb
2021-11-19 14:02:43 +00:00
dan
a12a40c3f0 Add #ifdef logic to os_unix.c so that it builds with SQLITE_OMIT_WAL defined.
FossilOrigin-Name: 948c2cb2a2f44ba069cfbf5e9a57e56964f3a40db57459bb439bea9c3bd9f211
2021-11-02 11:09:24 +00:00
drh
f81b40a52d Provide an assert() to fire for applications that should never open or create
a disk-based database file.

FossilOrigin-Name: 5218ac788ca35fdd7f98117758f0bef9d55fe7517098e7bf62fda3fed2af3d51
2021-10-23 22:11:18 +00:00
drh
f6d07c83fc Back out the SQLITE_OPEN_EXCLUSIVE changes because it does not work on
Windows and it does not work always on unix.

FossilOrigin-Name: d008ad793dfb11c287f366377cbc561acedef6c9d08b1557f463484eda41a84e
2021-10-13 14:45:35 +00:00
drh
dff34ab96f Allow the SQLITE_OPEN_EXCLUSIVE flag in sqlite3_open(). Return the
SQLITE_CANTOPEN_EXISTS extended code to indicate that the open failed because
the database already exists.

FossilOrigin-Name: d091150ff80709a1e50e0431aa33021f036979e4a88e9769eeec431dfad6d5f5
2021-06-24 18:23:54 +00:00
drh
f54e79405e Fix some minor #ifdef issues so that all of the supported compile-time
options continue to build.

FossilOrigin-Name: d8cf407046f20b0398f19acd0dab6acb6c742911e21e1003cb5b194dd668d98e
2021-06-15 18:46:06 +00:00
drh
04f4b6836b Fix a formatting error on the comment.
FossilOrigin-Name: 6f2fb60e499fc758bea6ffec030fef8ab5f97d08d31450f0b3ffafc20e652891
2021-05-19 19:27:42 +00:00
drh
187e2e48a8 Add a table of shared-memory lock offsets in a comment in the os_unix.c code.
Include some assert()s to help verify the numbers.

FossilOrigin-Name: b480aacb3430a789d98ffd81a1886bbbc3cda5b0e736ec9a3e2b463db2a3b3ad
2021-05-19 16:55:28 +00:00