kburtch / SparForte

Bourne shell, template engine, scripting language reliable, scalable projects. Based a ISO standard proven effective for large, mission-critical projects, SparForte is designed for fast development while, at the same time, providing easier designing, maintenance and bug removal. About 130.000 lines of code.
https://www.sparforte.com
GNU General Public License v2.0
50 stars 6 forks source link

build failure with freebsd; patch attached #18

Closed jrmarino closed 4 years ago

jrmarino commented 4 years ago

sparforte can't possibly build on freebsd. This patch fixes one problem:

--- src/os_bindings/spar_freebsd.ads.orig       2020-03-28 23:21:57 UTC
+++ src/os_bindings/spar_freebsd.ads
@@ -653,7 +653,7 @@ pragma import( C, C_is_includable_file,
 --  True if a file exists, is readable, not world writable and has data
 -- (that is, that it has permissions for an include file)

-function C_is_secure_dir( char * path ) return boolean;
+function C_is_secure_dir( path : string ) return boolean;
 pragma import( C, C_is_secure_dir, "C_is_secure_dir" );
 --  True if a dir exists, is readable, not world writable.

Another problem is group_member function isn't available on freebsd (c_os.c) but it's used unconditionally in C_is_executable_file. That's a problem that requires opening another issue I think.

jrmarino commented 4 years ago

FWIW, this is the c_os.c patch I used, and now with the 2 patches, I can build sparforte on DragonFly (and FreeBSD)

--- src/c_os.c.orig     2020-03-28 23:21:57 UTC
+++ src/c_os.c
@@ -16,7 +16,7 @@
 #include <stdio.h>
 #include <limits.h>

-#ifdef __APPLE__
+#if defined(__APPLE__) || defined(__FreeBSD__) || defined(__DragonFly__)
 int group_member(gid_t gid) {
   int ngroups, i, ret;
   int groups[NGROUPS_MAX];

I just piggy-backed on APPLE fix for the missing group_member function.

kburtch commented 4 years ago

I didn't get a chance to test FreeBSD against the last version.

I used the group members function after examining the Bash source code. This will allow SparForte to check for group read/write/execute permissions across all the groups that a person belongs to.

Apparently this was a Linux-specific feature. I didn't notice this while looking at the source code.

Thanks for the patch.

kburtch commented 4 years ago

I will release a 2.3.1 version shortly which will include the patches. Thanks.