From 2c91dec8cc0ca45966c7e6ef71ab606925e6392b Mon Sep 17 00:00:00 2001 From: AleksArt000 Date: Sun, 25 Aug 2024 22:11:32 +0200 Subject: [PATCH 1/7] fixed a bug with env variable --- src/install.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/install.c b/src/install.c index 0bc38b5..ed02b51 100755 --- a/src/install.c +++ b/src/install.c @@ -100,7 +100,7 @@ int f_install_package_source(const char* spm_path, int as_dep, char* repo) { for (int i = 0; i < pkg.exportsCount; i++) { - fprintf(env_file, "%s \n", pkg.exports[i]); + fprintf(env_file, "%s\n", pkg.exports[i]); if((pkg.exports[i][0] != '#' || (pkg.exports[i][0] != '/' && pkg.exports[i][1] != '/')) && strstr(pkg.exports[i], "=") != 0) { From 09bf36d8fd9a807c77aa2aca1010395ae73ccc9e Mon Sep 17 00:00:00 2001 From: AleksArt000 Date: Fri, 30 Aug 2024 01:10:31 +0200 Subject: [PATCH 2/7] fixed hashes starting with 0 --- src/make.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/make.c b/src/make.c index 3ca5f58..6b4af37 100755 --- a/src/make.c +++ b/src/make.c @@ -107,9 +107,9 @@ int make(char* package_dir, struct package* pkg) { SHA256((unsigned char*) buffer, size, hash); - if (hash[0] == 0) { - msg(FATAL, "Could not verify the file's hash"); - return -1; + if (hash == NULL) { + msg(FATAL, "Could not verify the file's hash"); + return -1; } dbg(1, "Hash is %s", file_sha256); From 226897e960ac39c81e4d7895aa7ec71b6c206ba3 Mon Sep 17 00:00:00 2001 From: AleksArt000 Date: Sat, 31 Aug 2024 01:20:36 +0200 Subject: [PATCH 3/7] fixed fatal error when removing missing files --- src/uninstall.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/uninstall.c b/src/uninstall.c index e4aebfc..a2b7dff 100755 --- a/src/uninstall.c +++ b/src/uninstall.c @@ -65,7 +65,7 @@ int uninstall(char* name) //dbg(3, "Removing %s", loc_path); if (rmany(loc_path) != 0) { - msg(FATAL,"Failed to remove %s",loc_path); + msg(ERROR,"Failed to remove %s",loc_path); perror("remove"); } } From e1ee0bea1694022735da6c8929cf68e1875f6403 Mon Sep 17 00:00:00 2001 From: AleksArt000 Date: Sat, 31 Aug 2024 02:40:36 +0200 Subject: [PATCH 4/7] added user agent to curl --- makefile | 2 +- src/download.c | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/makefile b/makefile index 63b27fb..a9e1b67 100755 --- a/makefile +++ b/makefile @@ -34,7 +34,7 @@ DBGFLAGS = -g -fsanitize=address # set local lib to lib/*/*.a LOCAL_LIBS = $(wildcard lib/*/*.a) -LIBS = ${LOCAL_LIBS} -lcurl -lsqlite3 -lm -lcrypto +LIBS = ${LOCAL_LIBS} -lcurl -lm -lcrypto # change these to proper directories where each file should be SRCDIR = src diff --git a/src/download.c b/src/download.c index 2e9b778..921c003 100644 --- a/src/download.c +++ b/src/download.c @@ -17,6 +17,7 @@ int download(char* url, FILE* fp) if(curl) { CURLcode res; + curl_easy_setopt(curl, CURLOPT_USERAGENT, "CCCP/1.0 (https://www.sovietlinux.org/)"); curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, 1); curl_easy_setopt(curl, CURLOPT_URL, url); curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, NULL); From da00334196a7d03fffba7a260442bf9f6cbea278 Mon Sep 17 00:00:00 2001 From: AleksArt000 Date: Sat, 31 Aug 2024 09:39:18 +0200 Subject: [PATCH 5/7] fixed segmentation fault --- src/install.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/install.c b/src/install.c index b181124..660c77f 100755 --- a/src/install.c +++ b/src/install.c @@ -483,9 +483,7 @@ int free_pkg(struct package* pkg) { free(pkg->optional); } if (pkg->files) { - for (int i = 0; i < pkg->filesCount; i++) { - if (pkg->files[i] != NULL) free(pkg->files[i]); - } + if (*pkg->files) free(*pkg->files); free(pkg->files); } return 0; From d2bed68ba323bbf3bbac855b8ac98fbbb0108d92 Mon Sep 17 00:00:00 2001 From: AleksArt000 Date: Sat, 31 Aug 2024 10:39:48 +0200 Subject: [PATCH 6/7] fixed one less package in source --- src/list.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/list.c b/src/list.c index 1aa97c8..64f0bfa 100644 --- a/src/list.c +++ b/src/list.c @@ -131,7 +131,7 @@ char ** search(char *term, int *num_results) { if (files_array != NULL) { // Print each file path - for (int i = 0; i < num_files-1; i++) + for (int i = 0; i < num_files; i++) { // This will break if the files are not separated into repos From 85568949ccfec8fde74d8f018be8044aa4509409 Mon Sep 17 00:00:00 2001 From: AleksArt000 Date: Mon, 2 Sep 2024 11:08:51 +0200 Subject: [PATCH 7/7] made file error quiet --- src/clean.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/clean.c b/src/clean.c index c8a6f4d..8510d30 100755 --- a/src/clean.c +++ b/src/clean.c @@ -30,7 +30,7 @@ int clean() struct stat st; if (lstat(cleanup_loc[i], &st) != 0) { - msg(ERROR,"Error getting file info\n"); + dbg(2, "Error getting file info"); } else {