[#18042] Re: New array methods cycle, choice, shuffle (plus bug in cycle) — gdefty@...
Hi,
[#18052] Enumerators that know about a block — "David A. Black" <dblack@...>
Hi --
[#18086] Suggestion to change Time#to_s format to an official standard — Dirkjan Bussink <d.bussink@...>
Hello people,
[#18110] [Ruby 1.9 - Feature #403] (Open) Add support to Haiku — Anonymous <redmine@...>
Issue #403 has been reported by Anonymous.
[#18121] [Ruby 1.8.7 - Bug #405] (Open) ssl.rb:31: [BUG] Bus Error — Anonymous <redmine@...>
Issue #405 has been reported by Anonymous.
[#18130] Re: New array methods cycle, choice, shuffle (plus bug in cycle) — Brian Candler <B.Candler@...>
> Seriously though... Array.first is a noun.
[#18145] [PATCH] error.c (Init_Exception): Rename class "fatal" to "Fatal" — Otto Hilska <otto.hilska@...>
Hi,
Hi,
Nobuyoshi Nakada wrote:
Hi,
On Thu, Aug 7, 2008 at 1:37 AM, Nobuyoshi Nakada <nobu@ruby-lang.org> wrote:
On Thu, Aug 7, 2008 at 15:48, Jeremy Kemper <jeremy@bitsweat.net> wrote:
[#18164] Re: New array methods cycle, choice, shuffle (plus bug in cycle) — gdefty@...
In message "Re: [ruby-core:18133] Re: New array
[#18237] Severe problem with garbage collection — Bertram Scharpf <lists@...>
Hi,
[#18247] Thread#priority(=) will be obsolete — SASADA Koichi <ko1@...>
Hi,
[#18252] Re: result for mget [last:10 MIME/multipart] (1/1) (ruby-core ML) — "Giuseppe Bilotta" <giuseppe.bilotta@...>
>> We are planning to make Thread#priority(=) method as obsolete method
Hi,
[#18257] Definition of "Support levels", 1.9.1 supported platforms and recruitment for platform maintainers — "Yugui (Yuki Sonoda)" <yugui@...>
Hi, all.
HI! This answers the question that I asked a few days ago, thank you!
Hi,
Yukihiro Matsumoto wrote:
[#18263] Am I right that this is wrong? — "David A. Black" <dblack@...>
Hi --
Hi,
Hi --
On Wed, Aug 13, 2008 at 3:04 PM, David A. Black <dblack@rubypal.com> wrote:
[#18303] Ruby 1.8.6 yields 50%-100% performance gain when compiled at full optimization — kevin nolan <kpnolan@...>
After compiling Ruby 1.8.6 with '-O3 -mtune=K8 -march=K8' on an AMD 4800
kevin nolan:
On Sat, 2008-08-16 at 03:39 +0900, Shot (Piotr Szotkowski) wrote:
[#18314] [Bug #449] File.zero? returns true when given a directory on Windows — Anonymous <redmine@...>
Bug #449: File.zero? returns true when given a directory on Windows
Hi,
I submitted that original bug (first time using redmine :)). Here's some mo=
Hi,
Not at all - it means we're now free to do the right thing :)
On Mon, Aug 18, 2008 at 6:45 PM, John Lam (IRONRUBY)
[#18319] NEW Command: absolute_path() -- — "C.E. Thornton" <admin@...>
Core,
Hi,
Are you sure you didn't mean to use "~/oracle/bin"
Trans wrote:
[#18349] [Feature:1.9] autoload with a block — Nobuyoshi Nakada <nobu@...>
Hi,
[#18354] Retrieving bytecode for method — Michael Neumann <mneumann@...>
Hi,
[#18381] [Bug #496] DRb.start_service(nil) is very slow — Hongli Lai <redmine@...>
Bug #496: DRb.start_service(nil) is very slow
[#18387] [Bug:1.9] rubygems fails to cache spec file — "Yusuke ENDOH" <mame@...>
Hi,
[#18396] problems with test_io.rb on cygwin — Martin Duerst <duerst@...>
I have run into problems with test_io.rb on cygwin.
Hello,
[#18405] [Bug #512] String#% behavior — Federico Builes <redmine@...>
Bug #512: String#% behavior
[#18409] ruby-lang.org has old download links — Nate_Wiger@...
The download links here:
[#18414] DoS vulnerability in REXML — "Shugo Maeda" <shugo@...>
Hi,
[#18424] [Bug #528] Several ruby-mode.el improvements — Nathan Weizenbaum <redmine@...>
Bug #528: Several ruby-mode.el improvements
[ruby-core:18293] absolute_path() Implementation patch for 1.9 trunk
Core,
I have attached a patch to the latest 1.9 trunk
to implement 'absolute_path()'. This function
expands relative paths to an absolute path.
However, absolute_path does NOT convert
directories starting with a tilde (~).
----- absolute_path documentation ------
/*
* call-seq:
* File.absolute_path(file_name [, dir_string] ) -> abs_file_name
*
* Converts a pathname to an absolute pathname. Relative paths are
* referenced from the current working directory of the process unless
* <i>dir_string</i> is given, in which case it will be used as the
* starting point. If the given pathname starts with a ``<code>~</code>''
* it is NOT expanded, it is treated as a normal directory name.
*
* File.absolute_path("~oracle/bin") #=> <relatvive path>/~oracle/bin"
*/
Chuck T.
--
Competency and chastity have much in common,
they both encompass their own punishment!
-- C.E. Thornton -- Hawthorne Press --
Attachments (1)
--- file.c 2008-08-14 03:11:31.000000000 +0000
+++ file.c_new 2008-08-14 04:34:33.000000000 +0000
@@ -2590,7 +2590,7 @@
static int is_absolute_path(const char*);
static VALUE
-file_expand_path(VALUE fname, VALUE dname, VALUE result)
+file_expand_path(VALUE fname, VALUE dname, int abs_mode, VALUE result)
{
const char *s, *b;
char *buf, *p, *pend, *root;
@@ -2602,8 +2602,7 @@
s = StringValuePtr(fname);
BUFINIT();
tainted = OBJ_TAINTED(fname);
-
- if (s[0] == '~') {
+ if (s[0] == '~' && abs_mode == 0) { /* Execute only if NOT absoloute_path() */
if (isdirsep(s[1]) || s[1] == '\0') {
const char *dir = getenv("HOME");
@@ -2665,7 +2664,7 @@
/* specified drive, but not full path */
int same = 0;
if (!NIL_P(dname)) {
- file_expand_path(dname, Qnil, result);
+ file_expand_path(dname, Qnil, abs_mode, result);
BUFINIT();
if (has_drive_letter(p) && TOLOWER(p[0]) == TOLOWER(s[0])) {
/* ok, same drive */
@@ -2689,7 +2688,7 @@
#endif
else if (!is_absolute_path(s)) {
if (!NIL_P(dname)) {
- file_expand_path(dname, Qnil, result);
+ file_expand_path(dname, Qnil, abs_mode, result);
BUFINIT();
}
else {
@@ -2881,7 +2880,7 @@
VALUE
rb_file_expand_path(VALUE fname, VALUE dname)
{
- return file_expand_path(fname, dname, rb_usascii_str_new(0, MAXPATHLEN + 2));
+ return file_expand_path(fname, dname, 0, rb_usascii_str_new(0, MAXPATHLEN + 2));
}
/*
@@ -2914,6 +2913,38 @@
return rb_file_expand_path(fname, dname);
}
+VALUE
+rb_file_absolute_path(VALUE fname, VALUE dname)
+{
+ return file_expand_path(fname, dname, 1, rb_usascii_str_new(0, MAXPATHLEN + 2));
+}
+
+/*
+ * call-seq:
+ * File.absolute_path(file_name [, dir_string] ) -> abs_file_name
+ *
+ * Converts a pathname to an absolute pathname. Relative paths are
+ * referenced from the current working directory of the process unless
+ * <i>dir_string</i> is given, in which case it will be used as the
+ * starting point. If the given pathname starts with a ``<code>~</code>''
+ * it is NOT expanded, it is treated as a normal directory name.
+ *
+ * File.absolute_path("~oracle/bin") #=> "<relative_path>/~oracle/bin"
+ */
+
+VALUE
+rb_file_s_absolute_path(int argc, VALUE *argv)
+{
+ VALUE fname, dname;
+
+ if (argc == 1) {
+ return rb_file_absolute_path(argv[0], Qnil);
+ }
+ rb_scan_args(argc, argv, "11", &fname, &dname);
+
+ return rb_file_absolute_path(fname, dname);
+}
+
static int
rmext(const char *p, int l1, const char *e)
{
@@ -4504,7 +4535,7 @@
FilePathValue(str);
if (RSTRING_LEN(str) == 0) continue;
- file_expand_path(fname, str, tmp);
+ file_expand_path(fname, str, 0, tmp);
if (file_load_ok(RSTRING_PTR(tmp))) {
RBASIC(tmp)->klass = rb_obj_class(*filep);
OBJ_FREEZE(tmp);
@@ -4565,7 +4596,7 @@
VALUE str = RARRAY_PTR(load_path)[i];
FilePathValue(str);
if (RSTRING_LEN(str) > 0) {
- file_expand_path(path, str, tmp);
+ file_expand_path(path, str, 0, tmp);
f = RSTRING_PTR(tmp);
if (file_load_ok(f)) goto found;
}
@@ -4687,6 +4718,7 @@
rb_define_singleton_method(rb_cFile, "umask", rb_file_s_umask, -1);
rb_define_singleton_method(rb_cFile, "truncate", rb_file_s_truncate, 2);
rb_define_singleton_method(rb_cFile, "expand_path", rb_file_s_expand_path, -1);
+ rb_define_singleton_method(rb_cFile, "absolute_path", rb_file_s_absolute_path, -1);
rb_define_singleton_method(rb_cFile, "basename", rb_file_s_basename, -1);
rb_define_singleton_method(rb_cFile, "dirname", rb_file_s_dirname, 1);
rb_define_singleton_method(rb_cFile, "extname", rb_file_s_extname, 1);