* [PATCH] test spawning non-Ruby process with socket_dir
@ 2023-01-08 21:55 5% Eric Wong
0 siblings, 0 replies; 2+ results
From: Eric Wong @ 2023-01-08 21:55 UTC (permalink / raw)
To: mwrap-public
This tests commit
649a0d3e3578 (httpd: undefine ruby_snprintf alias for non-Ruby processes, 2023-01-08)
---
test/test_mwrap.rb | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/test/test_mwrap.rb b/test/test_mwrap.rb
index 176dca6..e04fab5 100644
--- a/test/test_mwrap.rb
+++ b/test/test_mwrap.rb
@@ -6,6 +6,7 @@ require 'mwrap'
require 'rbconfig'
require 'tempfile'
require 'io/wait'
+require 'tmpdir'
class TestMwrap < Test::Unit::TestCase
RB = "#{RbConfig::CONFIG['bindir']}/#{RbConfig::CONFIG['RUBY_INSTALL_NAME']}"
@@ -79,6 +80,15 @@ class TestMwrap < Test::Unit::TestCase
assert_match(/\b0x[a-f0-9]+\b/s, dump, 'dump output has addresses')
end
+ def test_spawn_non_ruby
+ Dir.mktmpdir do |dir|
+ sockdir = "#{dir}/sockdir"
+ env = @@env.merge('MWRAP' => "socket_dir:#{sockdir}")
+ out = IO.popen(env, %w(ls -alR), { chdir: dir }, &:read)
+ assert_match(/\b\d+\.sock\b/, out)
+ end
+ end
+
def test_clear
cmd = @@cmd + %w(
-e ("0"*10000).clear
^ permalink raw reply related [relevance 5%]
* [PATCH] httpd: undefine ruby_snprintf alias for non-Ruby processes
@ 2023-01-08 18:41 7% Eric Wong
0 siblings, 0 replies; 2+ results
From: Eric Wong @ 2023-01-08 18:41 UTC (permalink / raw)
To: mwrap-public
ruby/subst.h (included by ruby.h) replaces `snprintf' with
`ruby_snprintf'. This only works in processes linked to Ruby,
but won't work in subprocesses spawned by Ruby.
---
ext/mwrap/httpd.h | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/ext/mwrap/httpd.h b/ext/mwrap/httpd.h
index 03aef9f..da7ff6d 100644
--- a/ext/mwrap/httpd.h
+++ b/ext/mwrap/httpd.h
@@ -43,6 +43,14 @@
#define TYPE_CSV "text/csv"
#define TYPE_PLAIN "text/plain"
+/*
+ * C ruby defines snprintf to ruby_snprintf, we can't have that in
+ * non-ruby processes spawned by C ruby
+ */
+#if MWRAP_RUBY && defined(snprintf)
+# undef snprintf
+#endif
+
enum mw_qev {
MW_QEV_IGNORE = 0,
MW_QEV_RD = POLLIN,
^ permalink raw reply related [relevance 7%]
Results 1-2 of 2 | reverse | options above
-- pct% links below jump to the message on this page, permalinks otherwise --
2023-01-08 18:41 7% [PATCH] httpd: undefine ruby_snprintf alias for non-Ruby processes Eric Wong
2023-01-08 21:55 5% [PATCH] test spawning non-Ruby process with socket_dir Eric Wong
Code repositories for project(s) associated with this public inbox
https://80x24.org/mwrap.git/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).