mirror of
https://github.com/simon987/sist2.git
synced 2025-04-10 05:56:46 +00:00
Bug fixes
This commit is contained in:
parent
c03c148273
commit
ca2e308d89
@ -37,4 +37,5 @@ state.db
|
|||||||
build/
|
build/
|
||||||
__pycache__/
|
__pycache__/
|
||||||
sist2-vue/dist
|
sist2-vue/dist
|
||||||
sist2-admin/frontend/dist
|
sist2-admin/frontend/dist
|
||||||
|
*.fts
|
7
scripts/test_in_docker.sh
Normal file
7
scripts/test_in_docker.sh
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
docker build . -t tmp
|
||||||
|
|
||||||
|
docker run --rm -it\
|
||||||
|
-v $(pwd):/host \
|
||||||
|
tmp \
|
||||||
|
scan --ocr-lang eng --ocr-ebooks -t6 --incremental --very-verbose \
|
||||||
|
-o /host/docker.sist2 /host/third-party/libscan/libscan-test-files/test_files/
|
17
src/cli.c
17
src/cli.c
@ -93,9 +93,12 @@ int scan_args_validate(scan_args_t *args, int argc, const char **argv) {
|
|||||||
if (abs_path == NULL) {
|
if (abs_path == NULL) {
|
||||||
LOG_FATALF("cli.c", "Invalid PATH argument. File not found: %s", argv[1]);
|
LOG_FATALF("cli.c", "Invalid PATH argument. File not found: %s", argv[1]);
|
||||||
} else {
|
} else {
|
||||||
abs_path = realloc(abs_path, strlen(abs_path) + 2);
|
char *new_abs_path = realloc(abs_path, strlen(abs_path) + 2);
|
||||||
strcat(abs_path, "/");
|
if (new_abs_path == NULL) {
|
||||||
args->path = abs_path;
|
LOG_FATALF("cli.c", "FIXME: realloc() failed for argv[1]=%s, abs_path=%s", argv[1], abs_path);
|
||||||
|
}
|
||||||
|
strcat(new_abs_path, "/");
|
||||||
|
args->path = new_abs_path;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (args->tn_quality == OPTION_VALUE_UNSPECIFIED) {
|
if (args->tn_quality == OPTION_VALUE_UNSPECIFIED) {
|
||||||
@ -142,10 +145,14 @@ int scan_args_validate(scan_args_t *args, int argc, const char **argv) {
|
|||||||
|
|
||||||
char *abs_output = abspath(args->output);
|
char *abs_output = abspath(args->output);
|
||||||
if (args->incremental && abs_output == NULL) {
|
if (args->incremental && abs_output == NULL) {
|
||||||
LOG_WARNINGF("main.c", "Could not open original index for incremental scan: %s. Will not perform incremental scan.", args->output);
|
LOG_WARNINGF("main.c",
|
||||||
|
"Could not open original index for incremental scan: %s. Will not perform incremental scan.",
|
||||||
|
args->output);
|
||||||
args->incremental = FALSE;
|
args->incremental = FALSE;
|
||||||
} else if (!args->incremental && abs_output != NULL) {
|
} else if (!args->incremental && abs_output != NULL) {
|
||||||
LOG_FATALF("main.c", "Index already exists: %s. If you wish to perform incremental scan, you must specify --incremental", abs_output);
|
LOG_FATALF("main.c",
|
||||||
|
"Index already exists: %s. If you wish to perform incremental scan, you must specify --incremental",
|
||||||
|
abs_output);
|
||||||
}
|
}
|
||||||
free(abs_output);
|
free(abs_output);
|
||||||
|
|
||||||
|
@ -466,8 +466,8 @@ cJSON *database_fts_search(database_t *db, const char *query, const char *path,
|
|||||||
const char *path_where = path_where_clause(path);
|
const char *path_where = path_where_clause(path);
|
||||||
const char *size_where = size_where_clause(size_min, size_max);
|
const char *size_where = size_where_clause(size_min, size_max);
|
||||||
const char *date_where = date_where_clause(date_min, date_max);
|
const char *date_where = date_where_clause(date_min, date_max);
|
||||||
const char *index_id_where = index_ids_where_clause(index_ids);
|
char *index_id_where = index_ids_where_clause(index_ids);
|
||||||
const char *mime_where = mime_types_where_clause(mime_types);
|
char *mime_where = mime_types_where_clause(mime_types);
|
||||||
const char *query_where = match_where(query);
|
const char *query_where = match_where(query);
|
||||||
const char *after_where = get_after_where(after, sort);
|
const char *after_where = get_after_where(after, sort);
|
||||||
const char *tags_where = tags_where_clause(tags);
|
const char *tags_where = tags_where_clause(tags);
|
||||||
|
@ -3,6 +3,7 @@
|
|||||||
|
|
||||||
|
|
||||||
#include <signal.h>
|
#include <signal.h>
|
||||||
|
|
||||||
#define LOG_MAX_LENGTH 8192
|
#define LOG_MAX_LENGTH 8192
|
||||||
|
|
||||||
#define LOG_SIST_DEBUG 0
|
#define LOG_SIST_DEBUG 0
|
||||||
@ -33,11 +34,12 @@
|
|||||||
|
|
||||||
#define LOG_FATALF(filepath, fmt, ...)\
|
#define LOG_FATALF(filepath, fmt, ...)\
|
||||||
sist_logf(filepath, LOG_SIST_FATAL, fmt, __VA_ARGS__);\
|
sist_logf(filepath, LOG_SIST_FATAL, fmt, __VA_ARGS__);\
|
||||||
raise(SIGUSR1)
|
raise(SIGUSR1); \
|
||||||
|
exit(-1)
|
||||||
#define LOG_FATAL(filepath, str) \
|
#define LOG_FATAL(filepath, str) \
|
||||||
sist_log(filepath, LOG_SIST_FATAL, str);\
|
sist_log(filepath, LOG_SIST_FATAL, str);\
|
||||||
exit(SIGUSR1)
|
raise(SIGUSR1); \
|
||||||
|
exit(-1)
|
||||||
#define LOG_FATALF_NO_EXIT(filepath, fmt, ...) \
|
#define LOG_FATALF_NO_EXIT(filepath, fmt, ...) \
|
||||||
sist_logf(filepath, LOG_SIST_FATAL, fmt, __VA_ARGS__)
|
sist_logf(filepath, LOG_SIST_FATAL, fmt, __VA_ARGS__)
|
||||||
#define LOG_FATAL_NO_EXIT(filepath, str) \
|
#define LOG_FATAL_NO_EXIT(filepath, str) \
|
||||||
@ -46,6 +48,7 @@
|
|||||||
#include "sist.h"
|
#include "sist.h"
|
||||||
|
|
||||||
void sist_logf(const char *filepath, int level, char *format, ...);
|
void sist_logf(const char *filepath, int level, char *format, ...);
|
||||||
|
|
||||||
void vsist_logf(const char *filepath, int level, char *format, va_list ap);
|
void vsist_logf(const char *filepath, int level, char *format, va_list ap);
|
||||||
|
|
||||||
void sist_log(const char *filepath, int level, char *str);
|
void sist_log(const char *filepath, int level, char *str);
|
||||||
|
@ -51,11 +51,11 @@
|
|||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
#include "git_hash.h"
|
#include "git_hash.h"
|
||||||
|
|
||||||
#define VERSION "3.1.0"
|
#define VERSION "3.1.1"
|
||||||
static const char *const Version = VERSION;
|
static const char *const Version = VERSION;
|
||||||
static const int VersionMajor = 3;
|
static const int VersionMajor = 3;
|
||||||
static const int VersionMinor = 1;
|
static const int VersionMinor = 1;
|
||||||
static const int VersionPatch = 0;
|
static const int VersionPatch = 1;
|
||||||
|
|
||||||
#ifndef SIST_PLATFORM
|
#ifndef SIST_PLATFORM
|
||||||
#define SIST_PLATFORM unknown
|
#define SIST_PLATFORM unknown
|
||||||
|
@ -170,7 +170,7 @@ fts_search_req_t *get_search_req(struct mg_http_message *hm) {
|
|||||||
cJSON_Delete(json);
|
cJSON_Delete(json);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
if (req_path.val && (strstr(req_path.val->valuestring, "*") || strlen(req_path.val) >= PATH_MAX)) {
|
if (req_path.val && (strstr(req_path.val->valuestring, "*") || strlen(req_path.val->valuestring) >= PATH_MAX)) {
|
||||||
cJSON_Delete(json);
|
cJSON_Delete(json);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user