Bug #3077

`expand_path': couldn't find HOME environment on Windows

Added by phasis68 (Heesob Park) about 2 years ago. Updated about 1 year ago.

[ruby-core:29216]
Status:Closed Start date:04/02/2010
Priority:Normal Due date:
Assignee:- % Done:

100%

Category:core
Target version:1.9.2
ruby -v:ruby 1.9.2dev (2010-04-02 trunk 27160) [i386-mswin32_90]

Description

1.9.2dev didn't set HOME environment on Windows.

C:\Ruby19\bin>ruby -ve 'p ENV["HOME"]'
ruby 1.9.1p129 (2009-05-12 revision 23412) [i386-mingw32]
"C:/Documents and Settings/Compaq_Owner"

C:\work\snapshot>ruby -ve 'p ENV["HOME"]'
ruby 1.9.2dev (2010-04-02 trunk 27160) [i386-mswin32_90]
nil

C:\work\snapshot>ruby -ve 'p File.expand_path("~")'
ruby 1.9.2dev (2010-04-02 trunk 27160) [i386-mswin32_90]
-e:1:in `expand_path': couldn't find HOME environment -- expanding `~' (Argument
Error)
        from -e:1:in `<main>'

As a result, The nightly snapshot unable to build RDoc.

Generating RDoc documentation
        .\ruby.exe -I./lib -I".ext/i386-mswin32_90" "./tool/runruby.rb" --extout
=".ext"  -- "./bin/rdoc" --all --ri --op ".ext/rdoc" "."
C:/work/snapshot/lib/rdoc/ri/paths.rb:16:in `expand_path': couldn't find HOME en
vironment -- expanding `~' (ArgumentError)
        from C:/work/snapshot/lib/rdoc/ri/paths.rb:16:in `<module:Paths>'
        from C:/work/snapshot/lib/rdoc/ri/paths.rb:6:in `<top (required)>'
        from C:/work/snapshot/lib/rdoc/options.rb:3:in `require'
        from C:/work/snapshot/lib/rdoc/options.rb:3:in `<top (required)>'
        from C:/work/snapshot/lib/rdoc/rdoc.rb:12:in `require'
        from C:/work/snapshot/lib/rdoc/rdoc.rb:12:in `<top (required)>'
        from ./bin/rdoc:11:in `require'
        from ./bin/rdoc:11:in `<main>'
NMAKE : fatal error U1077: '.\ruby.exe' : '0x1' 반환 코드입니다.
Stop.

Associated revisions

Revision 27171
Added by usa (Usaku NAKAMURA) about 2 years ago

* win32/win32.c (init_env): wrong calculation of the head of setenv string. [ruby-core:29216] a patch from Heesob Park in [ruby-core:29218]

History

Updated by phasis68 (Heesob Park) about 2 years ago

Here is a patch

--- win32.c     2010-04-02 11:21:28.658460040 +0900
+++ win32.c.new 2010-04-02 11:21:53.730708450 +0900
@@ -456,7 +456,7 @@
 #define env wk.val
 #define set_env_val(vname) do { \
        typedef char namesizecheck[numberof(wk.name) < numberof(vname) - 1 ? -1 : 1]; \
-       WCHAR *const buf = wk.name + numberof(wk.name) - numberof(vname); \
+       WCHAR *const buf = wk.name + numberof(wk.name) - numberof(vname) + 1; \
        MEMCPY(buf, vname, WCHAR, numberof(vname) - 1); \
        _wputenv(buf); \
     } while (0)

Updated by usa (Usaku NAKAMURA) about 2 years ago

  • Status changed from Open to Closed
  • % Done changed from 0 to 100
This issue was solved with changeset r27171.
Heesob, thank you for reporting this issue.
Your contribution to Ruby is greatly appreciated.
May Ruby be with you.

Also available in: Atom PDF