rubyscript2exe.rb question


rubyscript2exe.rb question

Postby ara.t.howard » Wed, 14 Mar 2007 07:31:08 GMT

anybody seen this:

   jib:ahoward > ruby rubyscript2exe.rb rq q create
   Tracing rq ...
   Gathering files...
   Copying files...
   Creating rq_linux ...

   jib:ahoward > rq_linux q list
   /tmp/eee.rq_linux.2/bin/ruby: warning: Insecure world writable dir /tmp in LOAD_PATH, mode 041777
   /tmp/eee.rq_linux.2/bin/ruby: loading from unsafe file /tmp/eee.rq_linux.2/bootstrap.rb (SecurityError)

   jib:ahoward > echo $?


be kind whenever possible... it is always possible.
- the dalai lama

Re: rubyscript2exe.rb question

Postby Erik Veenstra » Wed, 14 Mar 2007 19:49:25 GMT

> anybody seen this:

Environment? Versions?

Could you try this (as root):

 $ chmod +t /tmp

Depending on the shell:

 $ mkdir ~/tmp
 $ TEMP=~/tmp rq_linux q list

Erik V. -  http://www.**--****.com/ 

Re: rubyscript2exe.rb question

Postby Eric I. » Sun, 15 Apr 2007 00:41:42 GMT

I've experienced this same issue on OS X (10.4.9) using Ruby 1.8.6.
I've been able to verify it's not a problem using Ruby 1.8.2 on OS X
and that it's not a problem on Ruby 1.8.4 using Linux.  And I'm pretty
sure it wasn't an issue with Ruby 1.8.5 under OS X.  So my guess is
that it surrounds a change in Ruby made between 1.8.5 and 1.8.6.

My best guess is that Ruby 1.8.6. does not seem to be taking into
account the sticky bit.

The original message in this thread showed an error message indicating
the permissions were 041777.  My error message reports the same.  And
the "1" would indicate that the sticky bit is set.

I can verify that your workaround of setting TEMP to a non-world-
writeable directory worked.

And is it the case that when running an application created with
rubyscript2exe, that the SAFE level is greater than 0?  Because if it
were 0 my understanding is it should at most generate a warning and
not an error.



Re: rubyscript2exe.rb question

Postby Erik Veenstra » Sun, 15 Apr 2007 03:51:41 GMT

I've addressed this problem in the not-yet-released version.

It doesn't use /tmp anymore, but ~/.eee instead. The Ruby
equivalent is something like this:

 dir    = ENV["HOME"] || ENV["USERPROFILE"] || ENV["TEMP"]
 dir    ||= "c:/"       if windows?
 dir    ||= "/tmp"
 dir    = File.join(dir, "eee")         if windows? or cygwin?
 dir    = File.join(dir, ".eee")        unless windows? or cygwin?

Maybe, just maybe, I'll release it in a couple of days...

Erik V. -  http://www.**--****.com/ 

Re: rubyscript2exe.rb question

Postby Eric I. » Sun, 15 Apr 2007 04:32:19 GMT

Wow, the ugliness of the real world raises its head, doesn't it?
Thanks for rubyscript2exe and for handling this.

I guess I'm still uncertain what the difficulty is with a sticky,
world-writeable directory on the load path.  Perhaps there's a
subtlety I don't understand.  But once the file is created, only the
owner can remove or rename the file (due to the sticky bit), and if
the file's permissions are otherwise set correctly, no one other than
the owner could alter it.  So where exactly is the vectory through
which someone could do some evil?


Re: rubyscript2exe.rb question

Postby Erik Veenstra » Sun, 15 Apr 2007 06:13:00 GMT

> Wow, the ugliness of the real world raises its head, doesn't

"In theory, there's no difference between theory and practice.
In practice, there is."

I really don't know. It's a Ruby thing. Maybe Matz has the
answer. AFAIR, he changed his mind on this topic, several
times... :}

RubyScript2Exe doesn't change the SAFE mode of your application.

Erik V. -  http://www.**--****.com/ 

Re: rubyscript2exe.rb question

Postby Erik Veenstra » Tue, 17 Apr 2007 06:29:05 GMT

> I've addressed this problem in the not-yet-released version.

It's released:

Erik V. -  http://www.**--****.com/ 

Similar Threads:

1.rubyscript2exe.rb issue

I have created some script which runs fine when i ran it from the
command promt ruby file.rb.
but when i conver it to exe using rubyscript2exe & tried to ran the
exe it gave me following error
I didnt find WINDOWS-1252.rb file on my machine. so question
1)how it running from command prompt without this file

I also tried packing the iconv.rb file into exe package but still no
Can anybody please help me on this?

no such file to load -- rexml/encodings/WINDOWS-1252.rb
parsers/treeparser.rb:89:in `parse': #<ArgumentError: No decoder found
for encodin
g WINDOWS-1252.  Please install iconv.> (REXML::ParseException)
encoding.rb:42:in `encoding='
source.rb:47:in `encoding='
parsers/baseparser.rb:203:in `pull'
parsers/treeparser.rb:21:in `parse'
document.rb:190:in `build'
document.rb:45:in `initialize'
No decoder found for encoding WINDOWS-1252.  Please install iconv.
Line: 1
Position: 47
Last 80 unconsumed characters:
        from C:/DOCUME~1/VINOD_~1/LOCALS~1/Temp/eee.solutionfile.exe.2/
lib/rexml/document.rb:190:in `build'
        from C:/DOCUME~1/VINOD_~1/LOCALS~1/Temp/eee.solutionfile.exe.2/
lib/rexml/document.rb:45:in `initialize'
        from C:\DOCUME~1\VINOD_~1\LOCALS~1\Temp\eee.solutionfile.exe.
        from C:\DOCUME~1\VINOD_~1\LOCALS~1\Temp\eee.solutionfile.exe.
        from C:\DOCUME~1\VINOD_~1\LOCALS~1\Temp\eee.solutionfile.exe.

2.Question about tempfile.rb - Ruby vs C

Hi all,

Just curious - why was Ruby's temporary file handling class
(tempfile.rb) written in pure Ruby instead of using the tmpfile()
function? That function appears to be supported on most platforms,
including MS Windows.

Are there file locking or threading issues I'm not aware of?

The tmpfile() function does have the advantage of deleting itself when
all references to it are gone, instead of waiting until the Ruby
process itself dies. Perhaps there's no real advantage to that,

Like I said, not an issue, just curious.



PS - Below is a simple version I created for Solaris (before I
realized how ubiquitous the tmpfile function was):

#include <ruby.h>
#include <stdio.h>

#define VERSION "0.0.1"

VALUE mSolaris, cTempfile;

/* :call-seq:
 * => file
 * Creates a new, anonymous temporary file in your Tempfile::TMPDIR
 * or /tmp if that cannot be accessed. If your $TMPDIR environment
variable is
 * set, it will be used instead. If $TMPDIR is not writable by the
process, it
 * will resort back to Tempfile::TMPDIR or /tmp.
static VALUE tempfile_init(VALUE self){
   VALUE v_args[1];

   v_args[0] = INT2FIX(fileno(tmpfile()));

   rb_call_super(1, v_args);

void Init_tempfile(){
   mSolaris  = rb_define_module("Solaris");
   cTempfile = rb_define_class_under(mSolaris, "Tempfile", rb_cFile);

   rb_define_method(cTempfile, "initialize", tempfile_init, 0);

   rb_define_const(cTempfile, "TMPDIR", rb_str_new2(P_tmpdir));
   rb_define_const(cTempfile, "VERSION", rb_str_new2(VERSION));

3.setup.rb question


I'm packaging a ruby extension, and want setup.rb to perform 
a particular part of the install only on a particular platform.

I figure others may have dealt with this with their own 
extensions, and I was wondering how it's usually done.

On win32, I'm including a pre-built .dll that my extension
requires, because it's kind of a pain to build on windows.
I've put the .dll in the bin/ directory - and setup.rb does
the right thing (for windows) and installs the .dll alongside
the ruby.exe binary, wherever that may be on the system.

However, on Linux, the shared library .so's needed by the
extension a) are easy to build, so I see no need to include
pre-built ones, and b) don't belong next to the ruby 
executable anyway... and c) I certainly don't want the
win32 .dll copied into /usr/bin or wherever on Linux.  :)

So my question is how to have setup.rb do the right thing
on windows with the files in ./bin (which it currently is)...
and basically ignore the files in ./bin on Linux.

Is it typical to just hack setup.rb to add the desired
behavior?  Just wondering how it's usually done.



4.Question about "No such file to load -- rexml/encodings/ISO-8859-1.rb"

Hi all,

I am new to Ruby, so forgave me if this question has been asked before.
I am running a software on Windows XP which is written in Ruby . The
script has been converted to exe. I kept getting the following error
message when I run it.

No such file to load -- rexml/encodinigs/ISO-8859-1.rb
name>.2/lib/rexml/encoding.rb:33:in encodinig=': No decoder found for
encoding ISO-8859-1. Please install iconv.

I know that ISO-8859-1 is the encoder for Latin characters. I checked
the path shown in the error message and there is nothing Ruby there. I
installed Ruby in my computer after that and I do have the file
ISO-8859-1.rb under Ruby directory now. But I am still getting the same
message. So I am not sure if this problem comes up because I am using
Windows. Can I specify the library for the executable to link some how?

Thanks in advance.


5.mkmf.rb questions

6. Newbie Question. eval.rb variable scope issue

7. resolv.rb question

8. from irb to .rb? and general question

Return to ruby


Who is online

Users browsing this forum: No registered users and 54 guest