Hi all,

The attached patch should fix #1602.  I have not had the energy to
test this on Windows yet (I need to build a new bootstrap CHICKEN
and such, and mingw doesn't have wget and #@!$^%%@#!).

Cheers,
Peter
From bb3b767b35c1a051e8010b30c091475d5dd6fcef Mon Sep 17 00:00:00 2001
From: Peter Bex <[email protected]>
Date: Sun, 7 Apr 2019 16:32:25 +0200
Subject: [PATCH] Fix definitions of (chicken file posix) permission values

These were accidentally copied from Windows, which does not have the
"group" and "other" definitions.

Fixes #1602
---
 NEWS                    |  4 ++++
 manual/Acknowledgements |  2 +-
 posix-common.scm        | 54 ++++++++++++++++++++++++++++++++++++++-----------
 3 files changed, 47 insertions(+), 13 deletions(-)

diff --git a/NEWS b/NEWS
index 77c5dfe4..3dd97f2f 100644
--- a/NEWS
+++ b/NEWS
@@ -9,6 +9,10 @@
      standard symbol table.  This brings full read-write invariance
      for symbols (they can now also start with NUL bytes).  Keywords
      no longer have plists.  Fixes #1576.
+  - In (chicken file posix), the values of perm/irgrp, perm/iwgrp,
+     perm/ixgrp, perm/iroth, perm/iwoth and perm/ixoth are now
+     correctly defined (they were all for "usr"; #1602, thanks to
+     Eric Hoffman)
 
 - Runtime system
   - Removed the unused, undocumented (and incorrect!) C functions
diff --git a/manual/Acknowledgements b/manual/Acknowledgements
index a962f708..70400415 100644
--- a/manual/Acknowledgements
+++ b/manual/Acknowledgements
@@ -22,7 +22,7 @@ Martin Gasbichler, Abdulaziz Ghuloum, Joey Gibson, Stephen C. Gilardi,
 Mario Domenech Goulart, Joshua Griffith, Johannes Groedem, Damian
 Gryski, Matt Gushee, Andreas Gustafsson, Sven Hartrumpf, Jun-ichiro
 itojun Hagino, Ahdi Hargo, Matthias Heiler, Karl M. Hegbloom, Moritz Heidkamp,
-William P. Heinemann, Bill Hoffman, Bruce Hoult, Hans Hübner, Markus Hülsmann,
+William P. Heinemann, Bill Hoffman, Eric Hoffman, Bruce Hoult, Hans Hübner, Markus Hülsmann,
 Götz Isenmann, Paulo Jabardo, Wietse Jacobs, David Janssens, Christian
 Jäger, Matt Jones, Dale Jordan, Valentin Kamyshenko, Daishi Kato,
 Peter Keller, Christian Kellermann, Brad Kind, Ron Kneusel, "Kooda", Matthias
diff --git a/posix-common.scm b/posix-common.scm
index 73e14841..b65317ed 100644
--- a/posix-common.scm
+++ b/posix-common.scm
@@ -44,6 +44,36 @@ static C_TLS struct stat C_statbuf;
 # define S_IFSOCK           0140000
 #endif
 
+#ifndef S_IRUSR
+# define S_IRUSR  S_IREAD
+#endif
+#ifndef S_IWUSR
+# define S_IWUSR  S_IWRITE
+#endif
+#ifndef S_IXUSR
+# define S_IXUSR  S_IEXEC
+#endif
+
+#ifndef S_IRGRP
+# define S_IRGRP  S_IREAD
+#endif
+#ifndef S_IWGRP
+# define S_IWGRP  S_IWRITE
+#endif
+#ifndef S_IXGRP
+# define S_IXGRP  S_IEXEC
+#endif
+
+#ifndef S_IROTH
+# define S_IROTH  S_IREAD
+#endif
+#ifndef S_IWOTH
+# define S_IWOTH  S_IWRITE
+#endif
+#ifndef S_IXOTH
+# define S_IXOTH  S_IEXEC
+#endif
+
 #define cpy_tmvec_to_tmstc08(ptm, v) \
     ((ptm)->tm_sec = C_unfix(C_block_item((v), 0)), \
     (ptm)->tm_min = C_unfix(C_block_item((v), 1)), \
@@ -419,18 +449,18 @@ EOF
 
 ;; open/noinherit is platform-specific
 
-(define-foreign-variable _s_irusr int "S_IREAD")
-(define-foreign-variable _s_iwusr int "S_IWRITE")
-(define-foreign-variable _s_ixusr int "S_IEXEC")
-(define-foreign-variable _s_irgrp int "S_IREAD")
-(define-foreign-variable _s_iwgrp int "S_IWRITE")
-(define-foreign-variable _s_ixgrp int "S_IEXEC")
-(define-foreign-variable _s_iroth int "S_IREAD")
-(define-foreign-variable _s_iwoth int "S_IWRITE")
-(define-foreign-variable _s_ixoth int "S_IEXEC")
-(define-foreign-variable _s_irwxu int "S_IREAD | S_IWRITE | S_IEXEC")
-(define-foreign-variable _s_irwxg int "S_IREAD | S_IWRITE | S_IEXEC")
-(define-foreign-variable _s_irwxo int "S_IREAD | S_IWRITE | S_IEXEC")
+(define-foreign-variable _s_irusr int "S_IRUSR")
+(define-foreign-variable _s_iwusr int "S_IWUSR")
+(define-foreign-variable _s_ixusr int "S_IXUSR")
+(define-foreign-variable _s_irgrp int "S_IRGRP")
+(define-foreign-variable _s_iwgrp int "S_IWGRP")
+(define-foreign-variable _s_ixgrp int "S_IXGRP")
+(define-foreign-variable _s_iroth int "S_IROTH")
+(define-foreign-variable _s_iwoth int "S_IWOTH")
+(define-foreign-variable _s_ixoth int "S_IXOTH")
+(define-foreign-variable _s_irwxu int "S_IRUSR | S_IWUSR | S_IXUSR")
+(define-foreign-variable _s_irwxg int "S_IRGRP | S_IWGRP | S_IXGRP")
+(define-foreign-variable _s_irwxo int "S_IROTH | S_IWOTH | S_IXOTH")
 
 (set! chicken.file.posix#perm/irusr _s_irusr)
 (set! chicken.file.posix#perm/iwusr _s_iwusr)
-- 
2.11.0

Attachment: signature.asc
Description: PGP signature

_______________________________________________
Chicken-hackers mailing list
[email protected]
https://lists.nongnu.org/mailman/listinfo/chicken-hackers

Reply via email to