rubyscript2exe.rb question

ruby

    Next

  • 1. Ruby GDChart on Windows
    I have used Ruby-GDChart for an old project. And now I need to run this on Windows. Is this possible? Any information will be appreciated. regards, George.
  • 2. An idiom I like... modifiable defaults
    Just thought I'd share a little concept that I find useful. Your comments are welcome. Sometimes objects are created with certain defaults. One way to override them is with default values in the constructor (and often corresponding writer methods). But sometimes I "don't like" the default and want to change it (for this program/session). Often I use class-level accessors for that purpose. Here's a contrived example... Cheers, Hal class Text class << self attr_accessor :color Text.color = "black" end attr_accessor :color def initialize(txt, color="black") # Hint: You can improve this further by saying # def initialize(txt, color=Text.color) puts "#{color} text..." end end # The old way... a = Text.new("some") # black b = Text.new("random","blue") # blue c = Text.new("text") # black c.color = "blue" # but now it's blue # The new way... Text.color = "blue" e = Text.new("Ruby is cool") # blue f = Text.new("as dry ice") # blue
  • 3. - Sterile Classes / Sterile Meta Classes
    Martin DeMello wrote: > I like the idea of using a single, invented word rather than a two word > phrase, since we avoid overloaded associations from other languages and > contexts. Thus far: > > uniclass > idioclass > eigenclass It might be my maths-y background, but I'm a big fan of eigenclass. I'm not too sure about the meaning of the German ('own', 'characteristic'??), but for those who know a bit of abstract algebra - eigenvalues, eigenvectors etc - it conjures up some handy images. So I think it's a winner for a) mathematicians and b) German speakers. Who could that possibly leave out? ;-) -- George [On the other hand, if you don't fall into either of those two camps, it probably just makes you say 'eh? what the hell is that?'.]

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...
   Stripping...
   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 $?
   1

workaround?

-a
-- 
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

gegroet,
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.

Thanks,

Eric


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...

gegroet,
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?

Eric


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.

gegroet,
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:
 http://www.**--****.com/ 

gegroet,
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
luck
Can anybody please help me on this?

Vinod
----------------------------------------------------------------------------------------------------------------------
no such file to load -- rexml/encodings/WINDOWS-1252.rb
C:/DOCUME~1/VINOD_~1/LOCALS~1/Temp/eee.solutionfile.exe.2/lib/rexml/
parsers/treeparser.rb:89:in `parse': #<ArgumentError: No decoder found
for encodin
g WINDOWS-1252.  Please install iconv.> (REXML::ParseException)
C:/DOCUME~1/VINOD_~1/LOCALS~1/Temp/eee.solutionfile.exe.2/lib/rexml/
encoding.rb:42:in `encoding='
C:/DOCUME~1/VINOD_~1/LOCALS~1/Temp/eee.solutionfile.exe.2/lib/rexml/
source.rb:47:in `encoding='
C:/DOCUME~1/VINOD_~1/LOCALS~1/Temp/eee.solutionfile.exe.2/lib/rexml/
parsers/baseparser.rb:203:in `pull'
C:/DOCUME~1/VINOD_~1/LOCALS~1/Temp/eee.solutionfile.exe.2/lib/rexml/
parsers/treeparser.rb:21:in `parse'
C:/DOCUME~1/VINOD_~1/LOCALS~1/Temp/eee.solutionfile.exe.2/lib/rexml/
document.rb:190:in `build'
C:/DOCUME~1/VINOD_~1/LOCALS~1/Temp/eee.solutionfile.exe.2/lib/rexml/
document.rb:45:in `initialize'
C:\DOCUME~1\VINOD_~1\LOCALS~1\Temp\eee.solutionfile.exe.2\app
\solutionfile.rb:25
C:\DOCUME~1\VINOD_~1\LOCALS~1\Temp\eee.solutionfile.exe.2\app
\solutionfile.rb:20
C:\DOCUME~1\VINOD_~1\LOCALS~1\Temp\eee.solutionfile.exe.2\bootstrap.rb:
50
...
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.
2\app\solutionfile.rb:25
        from C:\DOCUME~1\VINOD_~1\LOCALS~1\Temp\eee.solutionfile.exe.
2\app\solutionfile.rb:20
        from C:\DOCUME~1\VINOD_~1\LOCALS~1\Temp\eee.solutionfile.exe.
2\bootstrap.rb:50

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,
though?

Like I said, not an issue, just curious.

Regards,

Dan

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:
 *    Solaris::Tmpfile.new => file
 *
 * Creates a new, anonymous temporary file in your Tempfile::TMPDIR
directory,
 * 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

Hi,

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.


Thanks,

Bill




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
C:\DOCUME~1/username/LOCALS~1/Temp/eee.<executable
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.

Yaoyao 


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 8 guest