`win-file/ruby_1_9_3` sounds good for tcs experimental build.
However, we need to make a patch against latest trunk to merge upstream.
Is it `win-file/trunk`?
--
Hiroshi Shirosaki
Yes.
FYI, the only thing I changed in `win-file/ruby_1_9_3` from your original gist was switching from `rb_cloexec_open` back to `open` in `file.c:file_load_ok`
Jon
The following fixes:
* change static file_expand_path() to public rb_file_expand_path_internal()
* rename Fenix functions name
* use xmalloc/xfree
* add tweaks for `int abs_mode, VALUE result` arguments.
rb_file_absolute_path() uses `abs_mode = 1`
* fix a test failure since fenix uses ENV["HOMEDRIVE"] etc.
I confirmed make using rubyinstaller.
`make test` is OK.
`make test-all`: `test_short_filename` Failure seems only difference from trunk.
--
Hiroshi Shirosaki
Just downloaded and will try applying trunk patch on top of `win-file/ruby_1_9_3` and look at conflicts.
You and Luis were thinking of completely removing path expansion from Fenix but had WEBrick and cygwin concerns. What's your current thoughts?
Cygwin should not a concern. Cygwin is not a ruby-core "best effort" platform for 1.9.3 http://bugs.ruby-lang.org/projects/ruby-trunk/wiki/SupportedPlatforms and frankly, if someone wants cygwin support, they'll need to step up with resourcing.
IMO, as long as things work on OSX, Ubuntu, Arch, FreeBSD, MinGW, and WinSDK, life is good.
Jon
I'm thinking to apply a patch like the following to webrick for
`test_short_filename` test.
https://gist.github.com/1859130
More work will be required:
* this patch should work on _WIN32 platform (cygwin is not _WIN32 and
doesn't use fenix)
* Win32API will be deprecated. This should use `dl` or other.
* add else condition like the following would be better.
def long_path_name(name)
if (len = GetLongPathName.call(name, nil, 0)).nonzero?
buf = "\0" * len
buf[0...GetLongPathName.call(name, buf, buf.size)]
+ else
+ name
end
--
Hiroshi Shirosaki
I updated the patch.
https://gist.github.com/2057234
* apply webrick fix and `make test-all` result is fine
* add some Fenix fixes for tainted strings etc.
Here is Fenix bench against patched trunk ruby.
https://gist.github.com/2057307
Patched ruby looks comparable speed, but a little slower than Fenix.
I guess `check_expand_path_args(fname, dname)` in
rb_file_expand_path() might do more expensive things.
https://github.com/thecodeshop/ruby/blob/trunk/file.c#L3248
--
Hiroshi Shirosaki
It does. If no dname is provided (nil) it get the current directory, which is something we already do.
If you remove that should be good. After all is not required in Fenix.
Sorry for top posting. Sent from mobile.
Thanks for comments. I investigated further.
Difference between patched trunk and Fenix seems processing of
rb_get_path_check().
https://github.com/thecodeshop/ruby/blob/trunk/file.c#L152-L181
I added missing code to Fenix and did bench. Pached trunk bench result
was almost same as Fenix.
https://gist.github.com/2131421
The following calls are added.
rb_safe_level()
insecure_obj_p()
rb_enc_get()
rb_enc_asciicompat()
rb_str_new4()
I think above things should not be removed. Some input checks are done
by there code.
What do you think?
--
Hiroshi Shirosaki
We shouldn't limit to ASCII, there are paths in windows with more than ASCII and Ruby should be able to use it.
Dir.pwd used to have problems with that, so I think expand_path.
Sorry for top posting. Sent from mobile.
rb_enc_asciicompat() means not just ASCII. We can use more than ASCII.
For example, CP932 and UTF_8 are ASCII compatible.
>ruby -e "p Encoding::CP932.ascii_compatible?"
true
>ruby -e "p Encoding::UTF_8.ascii_compatible?"
true
>ruby -e "p Encoding::UTF_16BE.ascii_compatible?"
false
--
Hiroshi Shirosaki
Hmn, didn't find any documentation on it before, that is why I
completely ignored it.
You're right, let's keep the same things, except for the one that
check args and set dir if nil.
Thank you.
--
Luis Lavena
AREA 17
-
Perfection in design is achieved not when there is nothing more to add,
but rather when there is nothing more to take away.
Antoine de Saint-Exupéry
There is no need for that one.
check_expand_path_args() does nothing if dir is nil.
https://github.com/thecodeshop/ruby/blob/trunk/file.c#L3237
#define check_expand_path_args(fname, dname) \
(((fname) = rb_get_path(fname)), \
(void)(NIL_P(dname) ? (dname) : ((dname) = rb_get_path(dname))))
Getting the current directory with nil dir is positioned in
file_expand_path(). It is not executed since I replaced
file_expand_path() with Fenix implementation.
https://github.com/thecodeshop/ruby/blob/trunk/file.c#L2985
--
Hiroshi Shirosaki
Thank you Hiroshi for the explanation.
Can you push these changes to Fenix itself and update the patch?
> Can you push these changes to Fenix itself and update the patch?
>
I pushed changes to Fenix.
Ruby trunk@35138 patch. make, make test and make test-all seem fine.
https://gist.github.com/2205269
It would be better if the following will be done.
* add tests from Fenix spec to verify no regression
* cleanups comments
--
Hiroshi Shirosaki
Thank you Hiroshi.
> Ruby trunk@35138 patch. make, make test and make test-all seem fine.
> https://gist.github.com/2205269
>
> It would be better if the following will be done.
> * add tests from Fenix spec to verify no regression
> * cleanups comments
I'll work on some specs and refresh the entire code comments next weekend.
Once again, thank you for your effort, really appreciated.
Thank you.
I noticed `else` statement format fix is needed like this commit.
https://github.com/ruby/ruby/commit/b95b56cc3a5c75cb33830cd649a78c17eb777e38
Updated the patch.
https://gist.github.com/2205269
--
Hiroshi Shirosaki
Ah, that is a new one :P
Will keep that in mind. Never liked the Egyptian brackets style :P
On Wed, Mar 28, 2012 at 5:08 PM, Luis Lavena <luisl...@gmail.com> wrote:
> On Wed, Mar 28, 2012 at 10:53 AM, Hiroshi Shirosaki
> <h.shi...@gmail.com> wrote:
>>
>> I noticed `else` statement format fix is needed like this commit.
>> https://github.com/ruby/ruby/commit/b95b56cc3a5c75cb33830cd649a78c17eb777e38
>>
>
> Ah, that is a new one :P
>
> Will keep that in mind. Never liked the Egyptian brackets style :P
>
Bumping my own response.
Shall we submit this as pull request and a ticket on Ruby-Core?
I've been using TCS build with this patch and had no issue with it
over the past few weeks.
Anyone opposes?