[#19261] lstripped here-document (Re: comments and continuing strings on the next line) — nobu.nakada@...

なかだです。

29 messages 2003/01/01
[#19360] Re: lstripped here-document (Re: comments and continuing strings on the next line) — "K.Kosako" <kosako@...> 2003/01/15

nobu.nakada@nifty.ne.jpさんの

[#19361] Re: lstripped here-document (Re: comments and continuing strings on the next line) — "NAKAMURA, Hiroshi" <nakahiro@...> 2003/01/15

なひです。

[#19364] Re: lstripped here-document (Re: comments and continuing strings on the next line) — nobu.nakada@... 2003/01/17

なかだです。

[#19366] Re: lstripped here-document (Re: comments and continuing strings on the next line) — "NAKAMURA, Hiroshi" <nakahiro@...> 2003/01/17

なひです。

[#19299] [BUG] errno == 0 — Kazuhiro Yoshida <moriq@...>

もりきゅうです。win32だけかもしれません。

22 messages 2003/01/04
[#19301] Re: [BUG] errno == 0 — "U.Nakamura" <usa@...> 2003/01/04

こんにちは、なかむら(う)です。

[#19302] Re: [BUG] errno == 0 — "U.Nakamura" <usa@...> 2003/01/04

こんにちは、なかむら(う)です。

[#19303] Re: [BUG] errno == 0 — "U.Nakamura" <usa@...> 2003/01/04

こんにちは、なかむら(う)です。

[#19304] Re: [BUG] errno == 0 — "U.Nakamura" <usa@...> 2003/01/04

こんにちは、なかむら(う)です。

[#19306] Re: [BUG] errno == 0 — nobu.nakada@... 2003/01/05

なかだです。

[ruby-dev:19372] Re: shebang line of bin/*

From: nobu.nakada@...
Date: 2003-01-17 07:32:37 UTC
List: ruby-dev #19372
なかだです。

At Fri, 17 Jan 2003 15:58:02 +0900,
U.Nakamura <usa@osb.att.ne.jp> wrote:
> 今、binにあるファイルのshebangは
>   #!/usr/bin/env ruby
> になってて、"ruby"の部分だけruby_install_nameに置き換えてイ
> ンストールされますが、shebang行全体を実際にインストールされ
> るrubyインタプリタ名に置き換える(つまり、
>   #!/usr/local/bin/ruby
> とかにする)のはどうでしょう?

いいんじゃないでしょうか。

> 現状こうなってないということは、当然デメリットがあるんだと思
> うのですが、わかってないのでとりあえず提案してみました。

少なくとも、本体と同時にインストールされるものについては問題な
いと思いますが。

# そういえば、なんでopenのブロックの中でわざわざcloseしてるんだ
# ろう。


Index: instruby.rb
===================================================================
RCS file: /cvs/ruby/src/ruby/instruby.rb,v
retrieving revision 1.38
diff -u -2 -p -w -r1.38 instruby.rb
--- instruby.rb	5 Jan 2003 07:04:09 -0000	1.38
+++ instruby.rb	17 Jan 2003 07:31:15 -0000
@@ -50,5 +50,7 @@ arc = CONFIG["LIBRUBY_A"]
 makedirs [bindir, libdir, rubylibdir, archlibdir, sitelibdir, sitearchlibdir, mandir]
 
-install ruby_install_name+exeext, File.join(bindir, ruby_install_name+exeext), 0755
+ruby_bin = File.join(bindir, ruby_install_name)
+
+install ruby_install_name+exeext, ruby_bin+exeext, 0755
 if rubyw_install_name and !rubyw_install_name.empty?
   install rubyw_install_name+exeext, bindir, 0755
@@ -82,12 +84,16 @@ for src in Dir["bin/*"]
   install src, dest, 0755
 
+  next if $dryrun
+
   open(dest, "r+") { |f|
-    shebang = f.gets.sub(/ruby/, ruby_install_name)
+    shebang = f.gets
     body = f.read
 
+    if shebang.sub!(/^\#!.*?ruby\b/) {ruby_bin}
     f.rewind
     f.print shebang, body
     f.truncate(f.pos)
-    f.close
+    end
+  }
 
     if RUBY_PLATFORM =~ /mswin32|mingw|bccwin32/
@@ -107,5 +113,4 @@ EOF
       }
     end
-  } unless $dryrun
 end
 


-- 
--- 僕の前にBugはない。
--- 僕の後ろにBugはできる。
    中田 伸悦

In This Thread