Can't createCollation
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 45/100
Research direction
Start with Sources/SQLite/Core/Connection.swift at the createCollation implementation around line 659, then reproduce the crash with the minimal Swift example from the issue. Check the documented collation syntax against the current API usage. Done means the example creates a collation without crashing and the supported ordering syntax is clarified or covered by a test.
Written by the indexing model from the issue text.
Description
Hello, I'm doing my first steps with Swift so I hope that I'm not doing things wrong but rather reporting an actual bug.
platform: Linux
I'm trying to create a collation and get a crash with this minimal example:
import SQLite
let db = try Connection(.inMemory);
try db.createCollation("NOTHING_SPECIAL") { lhs, rhs in
return lhs.compare(rhs)
}
Crash log:
💣 Program crashed: Bad pointer dereference at 0x0000000000000040
Thread 0 "test" crashed:
0 0x00007f828e0de8d7 swift_initEnumMetadataSinglePayload + 23 in libswiftCore.so
1 0x00007f828df57c0c type metadata completion function for ClosedRange<>.Index + 59 in libswiftCore.so
2 0x00007f828e1038bf swift::MetadataCacheEntryBase<(anonymous namespace)::GenericCacheEntry, void const*>::doInitialization(swift::MetadataWaitQueue::Worker&, swift::MetadataRequest) + 270 in libswiftCore.so
3 0x00007f828e0f4144 _swift_getGenericMetadata(swift::MetadataRequest, void const* const*, swift::TargetTypeContextDescriptor<swift::InProcess> const*) + 2755 in libswiftCore.so
4 0x00007f828df692b3 __swift_instantiateCanonicalPrespecializedGenericMetadata + 34 in libswiftCore.so
5 0x00007f828dfa75fe Dictionary.subscript.setter + 45 in libswiftCore.so
6 Connection.createCollation(_:_:) + 851 in test at ..../.build/checkouts/SQLite.swift/Sources/SQLite/Core/Connection.swift:659:31
657│ }
658│ }, nil /* xDestroy */))
659│ collations[collation] = box
│ ▲
660│ }
661│ fileprivate typealias Collation = @convention(block) (UnsafeRawPointer, UnsafeRawPointer) -> Int32
7 test_main + 140 in test at .../Test/test.swift:4:8
2│
3│ let db = try Connection(.inMemory);
4│ try db.createCollation("NOTHING_SPECIAL") { lhs, rhs in
│ ▲
5│ return lhs.compare(rhs)
6│ }
8 0x00007f828c95c6b5 <unknown> in libc.so.6
9 0x00007f828c95c769 <unknown> in libc.so.6
By the way, I've found the syntax .order(collate(.custom("NODIACRITIC"), name)) in the docs but couldn't get it to work. Isn't it .order(name.collate(.custom("NODIACRITIC"))) now ?
- Dominant language
- Swift
- Stars
- 10.2k
- Forks
- 1.6k
- Avg merge
- 6d 2h
- Merged PRs (30d)
- 2
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from stephencelis/SQLite.swift
-
Difficulty 1/5 Under an hour Newbie friendliness 95/100
stephencelis/SQLite.swift#1375 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 62/100
stephencelis/SQLite.swift#1293 ·
-
Difficulty 3/5 1-2 days Newbie friendliness 38/100
stephencelis/SQLite.swift#1347 · 7 comments ·
-
Difficulty 4/5 3-5 days Newbie friendliness 25/100
stephencelis/SQLite.swift#1338 · 1 comment ·
-
Difficulty 5/5 Over a week Newbie friendliness 20/100
stephencelis/SQLite.swift#1337 · 3 comments ·
All issues in stephencelis/SQLite.swift
Similar issues
-
tvOS
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
skiptools/skip-fuse-ui#147 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 90/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
OneBusAway/onebusaway-ios#1438 · 1 reaction ·