New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Haiku supporting patches #3723
Haiku supporting patches #3723
Conversation
This change seems unsetting |
And what error occurs in that case? |
Packaged filesystem is read-only and doesn't allow to set them, it results an error at starting ruby if it instaleld trough the package management. |
I meant which value |
|
strace output:
|
Thank you, I installed Haiku on Virtualbox, but can't find manpages. |
Can you explain how can i test it? |
Sorry, it wasn't a link. |
@jonatanmurga Thank you, are you an expert on Haiku-OS (and packaged FS)? |
@nobu, i am kind of. I am with the HaikuPorts team. |
@nobu: with the linked patch the result is the same:
strace:
|
Thank you, I reread the log and found I misread it. Since I'm in hospital now, please wait for a while. |
@nobu: Thanks, i wish you quick recovery. |
Sorry to be late. Does this patch work? commit 5c3e04837a1db517a4e6d0cc71189db224532626
Author: Nobuyoshi Nakada <nobu@ruby-lang.org>
AuthorDate: 2020-12-15 23:17:23 +0900
Commit: Nobuyoshi Nakada <nobu@ruby-lang.org>
CommitDate: 2020-12-15 23:17:23 +0900
Ignore failure on unsupported fcntl to drop non-blocking mode
diff --git a/ruby.c b/ruby.c
index fc9adf775dd..aa6d4a2b9d0 100644
--- a/ruby.c
+++ b/ruby.c
@@ -2244,9 +2244,13 @@ open_load_file(VALUE fname_v, int *xflag)
rb_update_max_fd(fd);
#if defined HAVE_FCNTL && MODE_TO_LOAD != O_RDONLY
+# ifdef ENOTSUP
+# define IS_SUPPORTED_OP(e) ((e) != ENOTSUP)
+# else
+# define IS_SUPPORTED_OP(e) ((void)(e), 1)
+# endif
/* disabling O_NONBLOCK */
- if (fcntl(fd, F_SETFL, 0) < 0) {
- e = errno;
+ if (fcntl(fd, F_SETFL, 0) < 0 && IS_SUPPORTED_OP(e = errno)) {
(void)close(fd);
rb_load_fail(fname_v, strerror(e));
} |
Sadly nope:
|
Isn't 0x8000600e |
Ok, it seems B_UNSUPPORTED. |
Does this work? diff --git a/ruby.c b/ruby.c
index fa65c16bd45..022ee1c4b30 100644
--- a/ruby.c
+++ b/ruby.c
@@ -2214,6 +2214,26 @@ load_file_internal(VALUE argp_v)
return (VALUE)ast;
}
+/* disabling O_NONBLOCK, and returns 0 on success, otherwise errno */
+static inline int
+disable_nonblock(int fd)
+{
+#if defined(HAVE_FCNTL) && defined(F_SETFL)
+ if (fcntl(fd, F_SETFL, 0) < 0) {
+ int e = errno;
+ ASSUME(e != 0);
+# if defined ENOTSUP
+ if (e == ENOTSUP) return 0;
+# endif
+# if defined B_UNSUPPORTED
+ if (e == B_UNSUPPORTED) return 0;
+# endif
+ return e;
+ }
+#endif
+ return 0;
+}
+
static VALUE
open_load_file(VALUE fname_v, int *xflag)
{
@@ -2263,18 +2283,10 @@ open_load_file(VALUE fname_v, int *xflag)
}
rb_update_max_fd(fd);
-#if defined HAVE_FCNTL && MODE_TO_LOAD != O_RDONLY
-# ifdef ENOTSUP
-# define IS_SUPPORTED_OP(e) ((e) != ENOTSUP)
-# else
-# define IS_SUPPORTED_OP(e) ((void)(e), 1)
-# endif
- /* disabling O_NONBLOCK */
- if (fcntl(fd, F_SETFL, 0) < 0 && IS_SUPPORTED_OP(e = errno)) {
+ if (MODE_TO_LOAD != O_RDONLY && (e = disable_nonblock(fd)) != 0) {
(void)close(fd);
rb_load_fail(fname_v, strerror(e));
}
-#endif
e = ruby_is_fd_loadable(fd);
if (!e) { |
I've got this:
Patch not tested yet. |
You patched your earlier patch, so i had to apply it manually, this is how the complete patch looks like now (i post it because it is possible i made a mistake somewhere):
Result:
|
It is for the master, or 3.0 branch.
It is waiting for the script from stdin. |
Will check! |
Seems to be working:
|
Just some basic patches from HaikuPorts.