Script 'mail_helper' called by obssrc
Hello community,

here is the log from the commit of package execdir for openSUSE:Factory checked 
in at 2026-06-08 14:24:12
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/execdir (Old)
 and      /work/SRC/openSUSE:Factory/.execdir.new.2375 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "execdir"

Mon Jun  8 14:24:12 2026 rev:2 rq:1357928 version:0.5.0.git1780765455

Changes:
--------
--- /work/SRC/openSUSE:Factory/execdir/execdir.changes  2026-02-04 
21:08:48.039392820 +0100
+++ /work/SRC/openSUSE:Factory/.execdir.new.2375/execdir.changes        
2026-06-08 14:28:51.253854081 +0200
@@ -2 +2,8 @@
-Wed Feb  4 03:47:27 UTC 2026 - bunny bn <[email protected]>
+Sun Jun  7 07:03:16 UTC 2026 - Qrbi Vibj <[email protected]>
+
+Update to 0.5.0
+- Add option to clear the alias database
+- Add environment variable to set maxsize of the alias database
+
+-------------------------------------------------------------------
+Wed Feb  4 03:47:27 UTC 2026 - Qrbi Vibj <[email protected]>

Old:
----
  execdir-0.4.1.git1770014834.tar.gz

New:
----
  execdir-0.5.0.git1780765455.tar.gz

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ execdir.spec ++++++
--- /var/tmp/diff_new_pack.Ma4ljj/_old  2026-06-08 14:28:51.861879312 +0200
+++ /var/tmp/diff_new_pack.Ma4ljj/_new  2026-06-08 14:28:51.865879478 +0200
@@ -17,7 +17,7 @@
 
 
 Name:           execdir
-Version:        0.4.1.git1770014834
+Version:        0.5.0.git1780765455
 Release:        0
 Summary:        Execute a command in a specific directory
 License:        MIT

++++++ execdir-0.4.1.git1770014834.tar.gz -> execdir-0.5.0.git1780765455.tar.gz 
++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/execdir-0.4.1.git1770014834/execdir.c 
new/execdir-0.5.0.git1780765455/execdir.c
--- old/execdir-0.4.1.git1770014834/execdir.c   2026-02-02 07:47:14.000000000 
+0100
+++ new/execdir-0.5.0.git1780765455/execdir.c   2026-06-06 19:04:15.000000000 
+0200
@@ -8,7 +8,39 @@
 #include <sys/types.h>
 #include <sys/stat.h>
 #include <lmdb.h>
+#include <stdint.h>
 
+#ifndef DEFAULT_EXECDIR_DB_MAXSIZE
+// default: 10mb
+#define DEFAULT_EXECDIR_DB_MAXSIZE 10 * 1024 * 1024 * 2
+#endif
+
+size_t execdir_db_maxsize_new() {
+    const char *val = getenv("EXECDIR_DB_MAXSIZE");
+    if (!val) {
+        return 0; 
+    }
+
+    char *end = NULL;
+    unsigned long long size = strtoull(val, &end, 10);
+
+    if (end == val || *end != '\0') {
+        return 0;
+    }
+
+    return (size_t)size;
+}
+
+size_t execdir_db_maxsize(){
+    static size_t db_maxsize = 0;
+    if (db_maxsize == 0){
+        db_maxsize = execdir_db_maxsize_new() * 1024;
+        if (db_maxsize < 1024){
+            db_maxsize = DEFAULT_EXECDIR_DB_MAXSIZE;
+        }
+    }
+    return db_maxsize;
+}
 
 #define USAGE "Usage: execdir [-h] [-v] [-s] [-a] [-a] [-p] [-n NAME PATH] [-r 
NAME] [-g NAME] [-l] " \
 "[ARGS...]"
@@ -90,22 +122,30 @@
 
 // return execdir file path
 char *get_execdir_file_path() {
-    char *path;
-    char *home_dir;
+    const char *env_path = getenv("EXECDIR_DB_PATH");
 
-    home_dir = get_home_dir();
-    if(!home_dir) {
-        print_error("cannot get the home directory\n");
-        exit(EXIT_FAILURE);
+    const char *base_dir = NULL;
+    char *allocated_base = NULL;
+
+    if (env_path && env_path[0] != '\0') {
+        base_dir = env_path;
+    } else {
+        base_dir = get_home_dir();
+        if (!base_dir) {
+            print_error("cannot get home directory\n");
+            exit(EXIT_FAILURE);
+        }
     }
 
-    path = malloc(strlen(home_dir) + strlen("/" EXECDIR_FILE) + 1);
-    if(!path) {
+    size_t needed = strlen(base_dir) + 1 + strlen(EXECDIR_FILE) + 1;
+
+    char *path = malloc(needed);
+    if (!path) {
         print_error("cannot allocate memory: %s", strerror(errno));
         exit(EXIT_FAILURE);
     }
 
-    sprintf(path, "%s/" EXECDIR_FILE, home_dir);
+    snprintf(path, needed, "%s/%s", base_dir, EXECDIR_FILE);
 
     return path;
 }
@@ -201,6 +241,7 @@
            "  -v            output version information and exit\n"
            "  -s            execute the command as a shell command\n"
            "  -n NAME PATH  add an alias for a path\n"
+           "  -c            clear database\n"
            "  -r NAME       remove an alias\n"
            "  -a            use aliases (-aa for using only aliases)\n"
            "  -g NAME       get alias variable\n"
@@ -237,7 +278,7 @@
     handle_error(rc);
 
     // Set the map size (10 MB in this example)
-    rc = mdb_env_set_mapsize(db->env, 10485760);
+    rc = mdb_env_set_mapsize(db->env,  execdir_db_maxsize());
     handle_error(rc);
 
     // Open the environment
@@ -346,6 +387,13 @@
     return;
 }
 
+void drop_entire_db(const char *execdir) {
+    LMDB_Database *db = open_or_create_lmdb_database(execdir, 0);
+    int rc = mdb_drop(db->txn, db->dbi, 0);
+    handle_error(rc);
+    close_lmdb_database(db);
+}
+
 void add_alias_to_db(const char * execdir, const char * name, const char * 
value){
     LMDB_Database * db = open_or_create_lmdb_database(execdir, 0);
     put_string_value(db, name, value);
@@ -395,8 +443,10 @@
     int ls_alias_opt = 0;
     int use_alias_opt = 0;
     int mkdir_opt = 0;
+    int drop_opt = 0;
+    
 
-    while((opt = getopt(argc, argv, "hvsarlpng")) != -1) {
+    while((opt = getopt(argc, argv, "hvsarlpngc")) != -1) {
         switch(opt) {
             case 'g':
                 get_alias_opt = 1;
@@ -404,6 +454,9 @@
             case 'h':
                 help_opt = 1;
                 break;
+            case 'c':
+                drop_opt = 1;
+                break;
             case 'v':
                 version_opt = 1;
                 break;
@@ -473,6 +526,9 @@
     } else if (ls_alias_opt) {
         list_keys_and_values(execdir_file_path);
         goto do_not_skip_success;
+    } else if (drop_opt) {
+        drop_entire_db(execdir_file_path);
+        return 0;
     }
 
     goto skip_success;
@@ -489,6 +545,7 @@
 
     // save and skip the path argument
     path = *argv;
+    char * name;
     argc -= 1;
     argv += 1;
 
@@ -501,7 +558,7 @@
             goto alias_stat_exec_0;
         }
         alias_stat_exec_2:
-        char *name = path;
+        name = path;
 
         path = get_path_by_name(execdir_file_path, name);
         if(!path) {

Reply via email to