Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
61 changes: 61 additions & 0 deletions srcpkgs/fsearch/INSTALL.msg
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
NOTICE: fsearch 0.3.x configuration format changed.

The old configuration (0.2.x) used fsearch.conf in INI format.
This format is no longer valid. fsearch does NOT
automatically migrate your settings.
You must migrate your settings to the new JSON format BEFORE
launching the new version.

Before launching the new version:

1. Backup your old config (recommended)
mv ~/.config/fsearch/fsearch.conf \
~/.config/fsearch/fsearch.conf.bak 2>/dev/null

2. Remove legacy database index
rm -f ~/.local/share/fsearch/fsearch.db

3. Migrate your settings to the new JSON format.
See the mapping below for common settings.

Configuration migration (0.2.x -> 0.3.x):

Old format (fsearch.conf - INI):

[Database]
folders=/home/void;/media/storage;
exclude_paths=/home/void/.cache;/tmp;
exclude_patterns=*.tmp;*.bak;

[Interface]
dark_theme=true
show_hidden_files=false

New format (fsearch.conf - JSON):

{
"database": {
"indexed_locations": [
"/home/void",
"/media/storage"
],
"excluded_locations": [
"/home/void/.cache",
"/tmp"
],
"excluded_wildcards": [
"*.tmp",
"*.bak"
]
},
"ui": {
"show_hidden_files": false
}
}

Once the new configuration is in place:

1. Open FSearch.
2. Go to Database -> Update Database (or press Ctrl+R).
3. Ensure mounted partitions or secondary drives are listed
under Preferences -> Database -> Included Locations.
54 changes: 54 additions & 0 deletions srcpkgs/fsearch/patches/fsearch-cross-compile.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
--- a/meson.build
+++ b/meson.build
@@ -16,7 +16,7 @@
cc = meson.get_compiler('c')

# Check if the build platform supports using malloc_trim
-malloc_trim_support_result = cc.run(
+if cc.compiles(
'''
#include <malloc.h>

@@ -27,15 +27,13 @@
''',
name : 'malloc_trim is supported on the build platform',
)
-
-if malloc_trim_support_result.compiled() and malloc_trim_support_result.returncode() == 0
have_malloc_trim = true
else
have_malloc_trim = false
endif

# Check if the build platform supports using fanotify without the CAP_SYS_ADMIN capability
-fanotify_support_result = cc.run(
+if cc.compiles(
'''
#include <sys/fanotify.h>
#include <fcntl.h>
@@ -47,15 +45,13 @@
''',
name : 'fanotify is supported by the build platform and works without CAP_SYS_ADMIN capabilities',
)
-
-if fanotify_support_result.compiled() and fanotify_support_result.returncode() == 0
have_fanotify = true
else
have_fanotify = false
endif

# Check if the build platform supports inotify
-inotify_support_result = cc.run(
+if cc.compiles(
'''
#include <sys/inotify.h>
#include <fcntl.h>
@@ -67,8 +63,6 @@
''',
name : 'inotify is supported by the build platform',
)
-
-if inotify_support_result.compiled() and inotify_support_result.returncode() == 0
have_inotify = true
else
have_inotify = false
10 changes: 10 additions & 0 deletions srcpkgs/fsearch/patches/fsearch-fanotify-musl.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
--- a/src/fsearch_folder_monitor_fanotify.c
+++ b/src/fsearch_folder_monitor_fanotify.c
@@ -8,7 +8,6 @@
#include <fcntl.h>
#include <glib-unix.h>
#include <glib.h>
-#include <linux/fanotify.h>
#include <stddef.h>
#include <stdint.h>
#include <stdlib.h>
20 changes: 20 additions & 0 deletions srcpkgs/fsearch/patches/fsearch-off64-musl.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
--- a/src/fsearch_database_file.c
+++ b/src/fsearch_database_file.c
@@ -1073,7 +1073,7 @@
// now that we know the size of the file/folder block we've written, store it in the file header
// Make also sure to set the cursor checksum again, so folder and file block size are hashed as well
cursor.checksum = checksum;
- if (fseeko(fp, (off64_t)folder_block_size_offset, SEEK_SET) != 0) {
+ if (fseeko(fp, (off_t)folder_block_size_offset, SEEK_SET) != 0) {
goto save_fail;
}
g_debug("[db_save] updating file and folder block size: %" PRIu64 ", %" PRIu64, folder_block_size, file_block_size);
@@ -1081,7 +1081,7 @@
cursor_write(&cursor, &file_block_size, sizeof(file_block_size));

// after writing the folder and file block size, we can
- if (fseeko(fp, (off64_t)checksum_offset, SEEK_SET) != 0) {
+ if (fseeko(fp, (off_t)checksum_offset, SEEK_SET) != 0) {
goto save_fail;
}
gsize checksum_buffer_len = DATABASE_CHECKSUM_SIZE;
20 changes: 20 additions & 0 deletions srcpkgs/fsearch/patches/fsearch-off64.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
--- a/src/fsearch_database_file.c
+++ b/src/fsearch_database_file.c
@@ -1073,7 +1073,7 @@
// now that we know the size of the file/folder block we've written, store it in the file header
// Make also sure to set the cursor checksum again, so folder and file block size are hashed as well
cursor.checksum = checksum;
- if (fseeko(fp, (off64_t)folder_block_size_offset, SEEK_SET) != 0) {
+ if (fseeko64(fp, (off64_t)folder_block_size_offset, SEEK_SET) != 0) {
goto save_fail;
}
g_debug("[db_save] updating file and folder block size: %" PRIu64 ", %" PRIu64, folder_block_size, file_block_size);
@@ -1081,7 +1081,7 @@
cursor_write(&cursor, &file_block_size, sizeof(file_block_size));

// after writing the folder and file block size, we can
- if (fseeko(fp, (off64_t)checksum_offset, SEEK_SET) != 0) {
+ if (fseeko64(fp, (off64_t)checksum_offset, SEEK_SET) != 0) {
goto save_fail;
}
gsize checksum_buffer_len = DATABASE_CHECKSUM_SIZE;
218 changes: 218 additions & 0 deletions srcpkgs/fsearch/patches/fsearch-time64.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,218 @@
diff --git fsearch-0.3.1/src/fsearch_database_entry.c fsearch-0.3.1-patched/src/fsearch_database_entry.c
index 882f8da..a42553f 100644
--- fsearch-0.3.1/src/fsearch_database_entry.c
+++ fsearch-0.3.1-patched/src/fsearch_database_entry.c
@@ -171,9 +171,9 @@ db_entry_append_full_path(FsearchDatabaseEntry *entry, GString *str) {
g_string_append(str, name[0] == '\0' ? G_DIR_SEPARATOR_S : name);
}

-time_t
+int64_t
db_entry_get_mtime(FsearchDatabaseEntry *entry) {
- time_t mtime = 0;
+ int64_t mtime = 0;
db_entry_get_attribute(entry, DATABASE_INDEX_PROPERTY_MODIFICATION_TIME, &mtime, sizeof(mtime));
return mtime;
}
@@ -433,8 +433,8 @@ db_entry_compare_entries_by_chain(FsearchDatabaseEntry **a, FsearchDatabaseEntry

int
db_entry_compare_entries_by_modification_time(FsearchDatabaseEntry **a, FsearchDatabaseEntry **b) {
- const time_t time_a = db_entry_get_mtime(*a);
- const time_t time_b = db_entry_get_mtime(*b);
+ const int64_t time_a = db_entry_get_mtime(*a);
+ const int64_t time_b = db_entry_get_mtime(*b);
if (time_a > time_b) {
return 1;
}
@@ -599,7 +599,7 @@ db_entry_compare_entries_by_name(FsearchDatabaseEntry **a, FsearchDatabaseEntry
}

void
-db_entry_set_mtime(FsearchDatabaseEntry *entry, time_t mtime) {
+db_entry_set_mtime(FsearchDatabaseEntry *entry, int64_t mtime) {
db_entry_set_attribute(entry, DATABASE_INDEX_PROPERTY_MODIFICATION_TIME, &mtime, sizeof(mtime));
}

diff --git fsearch-0.3.1/src/fsearch_database_entry.h fsearch-0.3.1-patched/src/fsearch_database_entry.h
index d2159aa..b47de51 100644
--- fsearch-0.3.1/src/fsearch_database_entry.h
+++ fsearch-0.3.1-patched/src/fsearch_database_entry.h
@@ -53,7 +53,7 @@ uint32_t
db_entry_folder_get_num_folders(FsearchDatabaseEntry *entry);

void
-db_entry_set_mtime(FsearchDatabaseEntry *entry, time_t mtime);
+db_entry_set_mtime(FsearchDatabaseEntry *entry, int64_t mtime);

void
db_entry_set_size(FsearchDatabaseEntry *entry, off_t size);
@@ -103,7 +103,7 @@ db_entry_append_path(FsearchDatabaseEntry *entry, GString *str);
void
db_entry_append_full_path(FsearchDatabaseEntry *entry, GString *str);

-time_t
+int64_t
db_entry_get_mtime(FsearchDatabaseEntry *entry);

off_t
diff --git fsearch-0.3.1/src/fsearch_database_entry_info.c fsearch-0.3.1-patched/src/fsearch_database_entry_info.c
index 3e799f0..37dd1e2 100644
--- fsearch-0.3.1/src/fsearch_database_entry_info.c
+++ fsearch-0.3.1-patched/src/fsearch_database_entry_info.c
@@ -37,7 +37,7 @@ typedef struct {
GHashTable *highlights;
GString *str;
off_t size;
- time_t time;
+ int64_t time;
uint32_t uint;
bool selected;
};
@@ -286,7 +286,7 @@ fsearch_database_entry_info_get_path_full(FsearchDatabaseEntryInfo *info) {
return val->str;
}

-time_t
+int64_t
fsearch_database_entry_info_get_mtime(FsearchDatabaseEntryInfo *info) {
g_return_val_if_fail(info, 0);
g_return_val_if_fail(info->flags & FSEARCH_DATABASE_ENTRY_INFO_FLAG_MODIFICATION_TIME, 0);
diff --git fsearch-0.3.1/src/fsearch_database_entry_info.h fsearch-0.3.1-patched/src/fsearch_database_entry_info.h
index f998253..aed8d16 100644
--- fsearch-0.3.1/src/fsearch_database_entry_info.h
+++ fsearch-0.3.1-patched/src/fsearch_database_entry_info.h
@@ -61,7 +61,7 @@ fsearch_database_entry_info_get_extension(FsearchDatabaseEntryInfo *info);
GString *
fsearch_database_entry_info_get_path_full(FsearchDatabaseEntryInfo *info);

-time_t
+int64_t
fsearch_database_entry_info_get_mtime(FsearchDatabaseEntryInfo *info);

off_t
diff --git fsearch-0.3.1/src/fsearch_database_file.c fsearch-0.3.1-patched/src/fsearch_database_file.c
index 337fe99..be7472d 100644
--- fsearch-0.3.1/src/fsearch_database_file.c
+++ fsearch-0.3.1-patched/src/fsearch_database_file.c
@@ -207,7 +207,7 @@ database_file_load_entry(DatabaseFileReadCursor *cursor,
int64_t mtime = 0;
cursor_read(cursor, &mtime, sizeof(mtime));

- db_entry_set_mtime(*entry_out, (time_t)mtime);
+ db_entry_set_mtime(*entry_out, (int64_t)mtime);
}
}

diff --git fsearch-0.3.1/src/fsearch_database_index.c fsearch-0.3.1-patched/src/fsearch_database_index.c
index 7cf5306..2405382 100644
--- fsearch-0.3.1/src/fsearch_database_index.c
+++ fsearch-0.3.1-patched/src/fsearch_database_index.c
@@ -577,7 +577,7 @@ process_create_event(FsearchDatabaseIndex *self, FsearchFolderMonitorEvent *even
DATABASE_INDEX_PROPERTY_SIZE,
size,
DATABASE_INDEX_PROPERTY_MODIFICATION_TIME,
- mtime,
+ (int64_t)mtime,
DATABASE_INDEX_PROPERTY_NONE);
fsearch_database_chunked_array_insert(self->file_chunks, entry);

@@ -642,14 +642,14 @@ process_attrib_event(FsearchDatabaseIndex *self, FsearchFolderMonitorEvent *even
}

const off_t old_size = db_entry_get_size(entry);
- const time_t old_mtime = db_entry_get_mtime(entry);
+ const int64_t old_mtime = db_entry_get_mtime(entry);

- if (old_size == size && old_mtime == mtime) {
+ if (old_size == size && old_mtime == (int64_t)mtime) {
return;
}

FsearchDatabaseIndexPropertyFlags affected_sort_orders = DATABASE_INDEX_PROPERTY_FLAG_NONE;
- if (old_mtime != mtime) {
+ if (old_mtime != (int64_t)mtime) {
affected_sort_orders |= DATABASE_INDEX_PROPERTY_FLAG_MODIFICATION_TIME;
}

@@ -674,7 +674,7 @@ process_attrib_event(FsearchDatabaseIndex *self, FsearchFolderMonitorEvent *even
}

propagate_event(self, FSEARCH_DATABASE_INDEX_EVENT_ENTRY_DELETED, folders, files, affected_sort_orders, false);
- db_entry_set_mtime(entry, mtime);
+ db_entry_set_mtime(entry, (int64_t)mtime);
db_entry_set_size(entry, size);
propagate_event(self, FSEARCH_DATABASE_INDEX_EVENT_ENTRY_CREATED, folders, files, affected_sort_orders, false);
num_attrib_changes++;
diff --git fsearch-0.3.1/src/fsearch_database_scan.c fsearch-0.3.1-patched/src/fsearch_database_scan.c
index 5f1628e..33cd199 100644
--- fsearch-0.3.1/src/fsearch_database_scan.c
+++ fsearch-0.3.1-patched/src/fsearch_database_scan.c
@@ -75,7 +75,7 @@ add_folder(DatabaseWalkContext *walk_context, const char *name, const char *path
parent,
DATABASE_ENTRY_TYPE_FOLDER,
DATABASE_INDEX_PROPERTY_MODIFICATION_TIME,
- mtime,
+ (int64_t)mtime,
DATABASE_INDEX_PROPERTY_NONE);
if (!folder_entry) {
return NULL;
@@ -84,9 +84,9 @@ add_folder(DatabaseWalkContext *walk_context, const char *name, const char *path
if (db_entry_get_attribute_name(folder_entry, &n)) {
g_assert_cmpstr(name, ==, n);
}
- time_t t = 0;
- if (db_entry_get_attribute(folder_entry, DATABASE_INDEX_PROPERTY_MODIFICATION_TIME, (void *)&t, sizeof(time_t))) {
- g_assert(t == mtime);
+ int64_t t = 0;
+ if (db_entry_get_attribute(folder_entry, DATABASE_INDEX_PROPERTY_MODIFICATION_TIME, (void *)&t, sizeof(t))) {
+ g_assert(t == (int64_t)mtime);
}
watch_folder(walk_context, folder_entry, path);
darray_add_item(walk_context->folders, folder_entry);
@@ -103,7 +103,7 @@ add_file(DatabaseWalkContext *walk_context, const char *name, off_t size, time_t
DATABASE_INDEX_PROPERTY_SIZE,
size,
DATABASE_INDEX_PROPERTY_MODIFICATION_TIME,
- mtime,
+ (int64_t)mtime,
DATABASE_INDEX_PROPERTY_NONE);
if (!file_entry) {
return NULL;
@@ -116,8 +116,8 @@ add_file(DatabaseWalkContext *walk_context, const char *name, off_t size, time_t
if (db_entry_get_attribute(file_entry, DATABASE_INDEX_PROPERTY_SIZE, (void *)&s, sizeof(off_t))) {
g_assert(s == size);
}
- time_t t = 0;
- if (db_entry_get_attribute(file_entry, DATABASE_INDEX_PROPERTY_MODIFICATION_TIME, (void *)&t, sizeof(time_t))) {
+ int64_t t = 0;
+ if (db_entry_get_attribute(file_entry, DATABASE_INDEX_PROPERTY_MODIFICATION_TIME, (void *)&t, sizeof(t))) {
g_assert(t == mtime);
}
darray_add_item(walk_context->files, file_entry);
diff --git fsearch-0.3.1/src/fsearch_query_matchers.c fsearch-0.3.1-patched/src/fsearch_query_matchers.c
index 3415786..7371c15 100644
--- fsearch-0.3.1/src/fsearch_query_matchers.c
+++ fsearch-0.3.1-patched/src/fsearch_query_matchers.c
@@ -65,7 +65,7 @@ uint32_t
fsearch_query_matcher_date_modified(FsearchQueryNode *node, FsearchQueryMatchData *match_data) {
FsearchDatabaseEntry *entry = fsearch_query_match_data_get_entry(match_data);
if (entry) {
- const time_t time = db_entry_get_mtime(entry);
+ int64_t time = db_entry_get_mtime(entry);
return cmp_num(time, node);
}
return 0;
diff --git fsearch-0.3.1/src/tests/test_database_file.c fsearch-0.3.1-patched/src/tests/test_database_file.c
index ba49cf6..c608783 100644
--- fsearch-0.3.1/src/tests/test_database_file.c
+++ fsearch-0.3.1-patched/src/tests/test_database_file.c
@@ -87,7 +87,7 @@ test_save_load_roundtrip_preserves_hierarchy_and_sort_orders(void) {
FsearchDatabaseEntry *files_before_save[3];
FsearchDatabaseEntry *file_parents_before_save[3];
off_t file_sizes_before_save[3];
- time_t file_mtimes_before_save[3];
+ int64_t file_mtimes_before_save[3];
for (uint32_t i = 0; i < 3; i++) {
files_before_save[i] = fsearch_database_chunked_array_get_entry(name_sorted_files_before_save, i);
file_parents_before_save[i] = db_entry_get_parent(files_before_save[i]);
Loading