[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Chicken-janitors] Re: #52: ##sys#expand-home-path bug on OS X
From: |
Chicken Trac |
Subject: |
[Chicken-janitors] Re: #52: ##sys#expand-home-path bug on OS X |
Date: |
Sun, 28 Jun 2009 02:35:57 -0000 |
#52: ##sys#expand-home-path bug on OS X
----------------------------+-----------------------------------------------
Reporter: zbigniew | Owner:
Type: defect | Status: new
Priority: minor | Milestone:
Component: core libraries | Version: 4.0.x
Keywords: |
----------------------------+-----------------------------------------------
Comment(by zbigniew):
Attached an attempt at fixing this. Creates a new parameter ##sys#tilde-
expander used by ##sys#expand-home-path which, by default, just checks
$HOME, but when the posixunix unit is loaded, will use either $HOME or
user-information. posixwin currently uses the default behavior. Also if
tilde-expansion fails the original unexpanded text will be used.
[Currently it will do ~/tmp -> /tmp if $HOME is unset].
I did not touch canonical-path, which is also broken (worse). It is a bit
hairy but could piggyback on this.
'''expand-home-path fix example'''
{{{
$ echo $HOME
/Users/jim
$ csi
#;1> (##sys#expand-home-path "~")
"/Users/jim"
#;2> (##sys#expand-home-path "~jim")
"/home/jim"
#;3> (##sys#expand-home-path "~root")
"/home/root"
#;3> (##sys#expand-home-path "~/tmp")
"/Users/jim/tmp"
#;4> (use posix)
; loading library posix ...
#;5> (##sys#expand-home-path "~")
"/Users/jim"
#;6> (##sys#expand-home-path "~jim")
"/Users/jim"
#;7> (##sys#expand-home-path "~/tmp")
"/Users/jim/tmp"
#;10> (##sys#expand-home-path "~root")
"/var/root"
#;11> (##sys#expand-home-path "~dummy")
"~dummy"
#;12> (unsetenv "HOME")
#;13> (##sys#expand-home-path "~")
"/Users/jim"
#;14> (setenv "HOME" "/dummy")
#;15> (##sys#expand-home-path "~/tmp")
"/dummy/tmp"
$ unset HOME; csi
#;1> (##sys#expand-home-path "~")
"~"
#;1> (##sys#expand-home-path "~/tmp")
"~/tmp"
}}}
'''Broken canonical-path example'''
{{{
#;2> (use posix)
#;3> (canonical-path "~")
"/Users/jim/~"
#;4> (canonical-path "~/")
"/Users/jim/"
#;8> (canonical-path "~jim")
"/Users/jim/~jim"
#;9> (canonical-path "~/tmp")
"/Users/jim/tmp"
}}}
--
Ticket URL: <http://www.irp.oist.jp/trac/chicken/ticket/52#comment:2>
Chicken Scheme <http://www.call-with-current-continuation.org/>
Chicken Scheme is a compiler for the Scheme programming language.