Commit graph

129 commits

Author SHA1 Message Date
CismonX
348f13df02
backend_firefox: improve length(url) performace
The SQLite builtin function `length()` calculates the number of
Unicode code points of the given argument, while `octet_length()`
calculates the number of bytes.

The two functions should produce the same result for a URL since it's
always ASCII-only, however, with `octet_length()` the length can be
directly fetched from metadata without actually reading the URL text,
thereby improving performance.
2025-02-27 14:26:24 +08:00
CismonX
0307140980
ci: add history build urls 2025-02-27 11:06:00 +08:00
CismonX
1e1460af0d
ci: add build.sr.ht configuration
Automate the building and testing process of BookmarkFS using the
builds.sr.ht service, to see whether it still works on:

- Debian, Arch Linux
  * Typical GNU/Linux distros, either stable or cutting-edge.
- Alpine Linux
  * Minimal non-GNU setup, notably BusyBox, TinyCC, musl and pdpmake.
- FreeBSD
  * FreeBSD kernel and userland, including Clang and others.
2025-02-27 10:08:26 +08:00
CismonX
b7b8cc88d2
doc: misc update 2025-02-26 22:53:38 +08:00
CismonX
fc8bda14f3
doc: update doc for the Firefox backend
Following commit 349877f9a3, explain in the user manual about
readonly database files.
2025-02-26 15:14:07 +08:00
CismonX
f737aa9868
chore: remove bad copy-pasted comment lines 2025-02-26 14:58:42 +08:00
CismonX
b33f2ced0b
fsck: limit history list length
Add a hard limit to prevent the history command list from growing
unnecessarily large, especially when interactive fsck is automated
with scripting.
2025-02-26 14:46:29 +08:00
CismonX
0fd2cbbc9d
backend_firefox: no db_check() in sandbox mode
Following commit 35d4a93a41, now only perform `PRAGMA quick_check`
in non-sandbox mode before querying data on the database.

Although in practice SQLite does well in terms of memory safety,
most likely way better than BookmarkFS itself, we consider
sandboxing a stronger security guarantee than `PRAGMA quick_check`.
2025-02-26 14:06:18 +08:00
CismonX
d01554400c
backend: rename ATTR_KEY_* -> BM_XATTR_* 2025-02-26 13:56:18 +08:00
CismonX
55c0726c7f
all: minor refactor 2025-02-26 00:23:27 +08:00
CismonX
7816e955b7
fsck: remove unnecessary isatty() checks
There are legitimate use cases for interactive fsck.bookmarkfs
without a terminal, and Readline works fine without one.
2025-02-25 08:35:15 +08:00
CismonX
3e5c800de8
backend_chromium: improve sandboxing
- Always lazy-init watcher when possible.
- Add a check in `backend_create()` that fails when the bookmark
  storage does not exist, so that function behavior is more
  consistent on different platforms with and without sandboxing.
- Only check Landlock flags on Linux.
2025-02-24 17:45:52 +08:00
CismonX
8a0070833a
doc: misc update 2025-02-23 10:53:23 +08:00
CismonX
9494bf72af
doc: update backend API
- Add subsection for general information.
2025-02-22 19:19:55 +08:00
CismonX
6d99a3574c
doc: update backend API
- Add doc for the `bookmark_check` function.
- Other misc changes.
2025-02-21 18:44:58 +08:00
CismonX
e7743f0285
doc: fix syntax problems 2025-02-20 14:13:20 +08:00
CismonX
5affe9ee02
test: misc updates
- Export feature variables for conditional testing.
- Add helper macros.
- Move helper shell functions from atlocal.in to testsuite.at.
  The atlocal file should only contain feature variables.
- Update existing tests.
2025-02-20 11:11:10 +08:00
CismonX
bd90602d4a
xattr: misc refactor
- Check for XATTR_CREATE in setxattr.
- Rename bookmark_attrs -> xattr_names.
- Other misc changes.
2025-02-19 11:34:03 +08:00
CismonX
63c491bc02
doc: update backend API
Add doc for the `bookmark_permute` function.
2025-02-18 12:29:12 +08:00
CismonX
d7724e9a8f
db: disable SQL printing in debug mode by default 2025-02-18 10:31:55 +08:00
CismonX
e97adeaa7b
doc: update backend API
- Add doc for the `bookmark_delete` function.
- Other misc changes.
2025-02-17 19:26:13 +08:00
CismonX
fef7b4d3a8
backend: remove BOOKMARKFS_BOOKMARK_DELETE_DIR
It's up to the backend to check whether it's deleting a directory.
2025-02-17 17:52:50 +08:00
CismonX
557cc17449
doc: misc updates 2025-02-16 08:59:22 +08:00
CismonX
dd4e6401e8
doc: update backend API
- Add doc for the `bookmark_rename` function.
- Other misc changes.
2025-02-16 08:08:11 +08:00
CismonX
c90c5f6fc7
all: fix build with musl libc
- Should not assume whether O_xxx macros are defined by checking
  feature test macros.
- Workaround conflicting getdents() declaration.
2025-02-16 00:19:51 +08:00
CismonX
1db61bc878
all: debug_puts() should accept arbitrary string 2025-02-15 19:38:15 +08:00
CismonX
bf9e0e7f92
sandbox: workaround legacy landlock
So that they can build with kernel headers older than 6.2,
and still work as expected on newer kernels.
2025-02-15 19:08:08 +08:00
CismonX
5c244c4ef5
doc: update backend API
- Add doc for the `bookmark_create` function.
- Other misc updates.
2025-02-14 19:24:44 +08:00
CismonX
9afdfc45d7
backend: rename bookmark_check args
- Rename `id` -> `parent_id`, since the function works on
  the parent directory.
2025-02-13 17:48:07 +08:00
CismonX
52b3707d2b
backend: rename bookmark_fsck -> bookmark_check
Some relevant names are also renamed.
2025-02-12 20:47:10 +08:00
CismonX
3375674973
backend: ignore val_len when updating timestamps 2025-02-12 12:36:30 +08:00
CismonX
a7575dc074
doc: update backend API
Add doc for the `bookmark_set` function.
2025-02-12 12:34:10 +08:00
CismonX
87931bc1f7
doc: update doc for the Firefox backend 2025-02-11 18:45:49 +08:00
CismonX
31067eff42
build: misc update 2025-02-11 18:28:30 +08:00
CismonX
e199a1203a
backend: fix includes
Fix a regression in commit d1dac54b72 where sys/stat.h is no longer
included in backend_firefox.c and backend_chromium.c.

It has to be explicitly included for the UTIME_xxx macros.
2025-02-10 19:55:43 +08:00
CismonX
916102484f
all: only log line numbers in debug mode 2025-02-10 18:43:15 +08:00
CismonX
cd3d6a6232
backend_firefox: improve mkfs
Switch to schema version 74, so that it is compatible with
browsers (e.g., GNU IceCat) which are still based on
Firefox 115 ESR (now end-of-life), as well as saving us
a bit more space since there are fewer tables to be created.
2025-02-10 18:40:00 +08:00
CismonX
4f8b15fd80
backend_firefox: improve bookmark storage init
- Check schema version when initializing database.
- Minor refactor for db_check().
2025-02-09 23:49:21 +08:00
CismonX
df29392008
all: fix conditional build
There were bad code changes that cause the compiler to complain or
panic, but went unnoticed since they are only built if toggled with
`--enable-xxx` or `--disable-xxx` during build configuration.

Fix them altogether.
2025-02-08 19:47:20 +08:00
CismonX
d1dac54b72
chore: tidy up includes 2025-02-08 18:56:45 +08:00
CismonX
08f0655721
test: init tests; add tests for util lib
- Init Autotest.
  Not using DejaGNU since there won't be many interactive testing.
- Add basic test cases for the utility library (hash and prng).
2025-02-08 01:48:07 +08:00
CismonX
b195e7821a
hash: add hash_digestcb() function
May be useful for calculating hash of a stream of input data.
2025-02-06 16:09:58 +08:00
CismonX
767e25e867
xstd: update xabort_() output format 2025-02-05 18:28:22 +08:00
CismonX
d99ef6d681
chore: update links
- Specify the full homepage URL.
- Follow GNU's naming convention for mailing lists.
2025-02-05 18:11:37 +08:00
CismonX
fbed71ce3e
all: add line number to log output 2025-02-04 20:55:49 +08:00
CismonX
852caab209
doc: misc update 2025-02-04 20:55:29 +08:00
CismonX
8b848825f2
doc: update backend API
Add doc for the `cookie_free` and `bookmark_sync` functions.
2025-02-04 16:51:31 +08:00
CismonX
d0aa74b212
backend: rename object_free -> cookie_free 2025-02-03 18:15:52 +08:00
CismonX
f92054bdf5
doc: update backend API
- Add doc for the `bookmark_get` function.
- Update doc for the `bookmark_list` function.
2025-02-03 18:02:59 +08:00
CismonX
1d1ff58aa4
ioctl: move type definitions to common.h 2025-02-02 21:35:12 +08:00