Discussing FileSystem >> #workingDirectory and VM process getcwd(3)

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
13 messages Options
Reply | Threaded
Open this post in threaded view
|

Discussing FileSystem >> #workingDirectory and VM process getcwd(3)

Mariano Martinez Peck
Hi guys,

In a couple of recent threads, there were discussions about  FileSystem >> #workingDirectory VS  VM process getcwd(3) and the fact that they do not match. 

The current state is as follows:

1)  If Pharo was launched from double click then we do not care about its location and I think it's correct to default to image location:

1.1)  FileSystem >> #workingDirectory  refers to the directory containing the .image file
1.2) The VM process getcmd() is the default one of the particular OS ($HOME in my OSX). 

So...there is a mismatch between #workingDirectory and VM's process cmd. 

I think (as Damien said), that we should do a chdir() for the VM process to match the .image location.   

2) If Pharo was launched from command line then we likely are interested in the current CMD from where we launched the VM process (imagine using Pharo for scripting). The current status is:

2.1)  FileSystem >> #workingDirectory still refers to the directory containing the .image file which I think it is incorrect. 
2.2) The CMD of the VM process is correct. But again, there is a mismatch with #workingDirectory. 

For this case, I think we should set FileSystem >> #workingDirectory to CMD. 

Before start discussing how to implement this, do you agree with the idea?

Thanks in advance, 
Reply | Threaded
Open this post in threaded view
|

Re: Discussing FileSystem >> #workingDirectory and VM process getcwd(3)

Dale Henrichs-3
this pinged my memory about OSX ... the funkiness is that you had to arrange for PWD to be set "correctly" when double clicking an application ... when running from the command line PWD was set "correctly" ...

This was affecting GemStone because I was using the PWD of the client in certain circumstances (and years ago) ...

Sounds like this quirk probably doesn't apply, but I still think it is something to be aware of ...

Dale

On 3/21/16 11:13 AM, Mariano Martinez Peck wrote:
Hi guys,

In a couple of recent threads, there were discussions about  FileSystem >> #workingDirectory VS  VM process getcwd(3) and the fact that they do not match. 

The current state is as follows:

1)  If Pharo was launched from double click then we do not care about its location and I think it's correct to default to image location:

1.1)  FileSystem >> #workingDirectory  refers to the directory containing the .image file
1.2) The VM process getcmd() is the default one of the particular OS ($HOME in my OSX). 

So...there is a mismatch between #workingDirectory and VM's process cmd. 

I think (as Damien said), that we should do a chdir() for the VM process to match the .image location.   

2) If Pharo was launched from command line then we likely are interested in the current CMD from where we launched the VM process (imagine using Pharo for scripting). The current status is:

2.1)  FileSystem >> #workingDirectory still refers to the directory containing the .image file which I think it is incorrect. 
2.2) The CMD of the VM process is correct. But again, there is a mismatch with #workingDirectory. 

For this case, I think we should set FileSystem >> #workingDirectory to CMD. 

Before start discussing how to implement this, do you agree with the idea?

Thanks in advance, 

Reply | Threaded
Open this post in threaded view
|

Re: Discussing FileSystem >> #workingDirectory and VM process getcwd(3)

Damien Pollet
+1

FileSystem workingDirectory should never ever diverge from getcwd(); 2.1 is definitely a bug.

On 21 March 2016 at 19:39, Dale Henrichs <[hidden email]> wrote:
this pinged my memory about OSX ... the funkiness is that you had to arrange for PWD to be set "correctly" when double clicking an application ... when running from the command line PWD was set "correctly" ...

This was affecting GemStone because I was using the PWD of the client in certain circumstances (and years ago) ...

Sounds like this quirk probably doesn't apply, but I still think it is something to be aware of ...

Dale


On 3/21/16 11:13 AM, Mariano Martinez Peck wrote:
Hi guys,

In a couple of recent threads, there were discussions about  FileSystem >> #workingDirectory VS  VM process getcwd(3) and the fact that they do not match. 

The current state is as follows:

1)  If Pharo was launched from double click then we do not care about its location and I think it's correct to default to image location:

1.1)  FileSystem >> #workingDirectory  refers to the directory containing the .image file
1.2) The VM process getcmd() is the default one of the particular OS ($HOME in my OSX). 

So...there is a mismatch between #workingDirectory and VM's process cmd. 

I think (as Damien said), that we should do a chdir() for the VM process to match the .image location.   

2) If Pharo was launched from command line then we likely are interested in the current CMD from where we launched the VM process (imagine using Pharo for scripting). The current status is:

2.1)  FileSystem >> #workingDirectory still refers to the directory containing the .image file which I think it is incorrect. 
2.2) The CMD of the VM process is correct. But again, there is a mismatch with #workingDirectory. 

For this case, I think we should set FileSystem >> #workingDirectory to CMD. 

Before start discussing how to implement this, do you agree with the idea?

Thanks in advance, 




--
Damien Pollet
type less, do more [ | ] http://people.untyped.org/damien.pollet
Reply | Threaded
Open this post in threaded view
|

Re: Discussing FileSystem >> #workingDirectory and VM process getcwd(3)

Damien Cassou-2
In reply to this post by Mariano Martinez Peck
Mariano Martinez Peck <[hidden email]> writes:

> 1)  *If Pharo was launched from double click* then we do not care about its
> location and I think it's correct to default to image location:
>
> 1.1)  FileSystem >> #workingDirectory  refers to the directory containing
> the .image file
> 1.2) The VM process getcmd() is the default one of the particular OS ($HOME
> in my OSX).
>
> So...there is a mismatch between #workingDirectory and VM's process cmd.
>
> *I think (as Damien said), that we should do a chdir() for the VM process
> to match the .image location.   *

typical applications ran with double-click are bound to the HOME
directory. Why do you want to do it differently?

--
Damien Cassou
http://damiencassou.seasidehosting.st

"Success is the ability to go from one failure to another without
losing enthusiasm." --Winston Churchill

Reply | Threaded
Open this post in threaded view
|

Re: Discussing FileSystem >> #workingDirectory and VM process getcwd(3)

Damien Pollet

On 22 March 2016 at 12:56, Damien Cassou <[hidden email]> wrote:
typical applications ran with double-click are bound to the HOME
directory. Why do you want to do it differently?

Only on Linux. On OS X it's /


--
Damien Pollet
type less, do more [ | ] http://people.untyped.org/damien.pollet
Reply | Threaded
Open this post in threaded view
|

Re: Discussing FileSystem >> #workingDirectory and VM process getcwd(3)

Damien Cassou-2
Damien Pollet <[hidden email]> writes:

> On 22 March 2016 at 12:56, Damien Cassou <[hidden email]> wrote:
>
>> typical applications ran with double-click are bound to the HOME
>> directory. Why do you want to do it differently?
>>
>
> Only on Linux. On OS X it's /

so, why do you want to make it the image directory?

--
Damien Cassou
http://damiencassou.seasidehosting.st

"Success is the ability to go from one failure to another without
losing enthusiasm." --Winston Churchill

Reply | Threaded
Open this post in threaded view
|

Re: Discussing FileSystem >> #workingDirectory and VM process getcwd(3)

Damien Pollet
Because there is this concept called "consistency" that's interesting to have :p

If your code wants $HOME it can ask for it explicitly, same for /. However if it just wants to do something in $PWD consistent with most use-cases, the image directory is the sensible default.

On 22 March 2016 at 13:05, Damien Cassou <[hidden email]> wrote:
Damien Pollet <[hidden email]> writes:

> On 22 March 2016 at 12:56, Damien Cassou <[hidden email]> wrote:
>
>> typical applications ran with double-click are bound to the HOME
>> directory. Why do you want to do it differently?
>>
>
> Only on Linux. On OS X it's /

so, why do you want to make it the image directory?

--
Damien Cassou
http://damiencassou.seasidehosting.st

"Success is the ability to go from one failure to another without
losing enthusiasm." --Winston Churchill



--
Damien Pollet
type less, do more [ | ] http://people.untyped.org/damien.pollet
Reply | Threaded
Open this post in threaded view
|

Re: Discussing FileSystem >> #workingDirectory and VM process getcwd(3)

Mariano Martinez Peck


On Tue, Mar 22, 2016 at 9:37 AM, Damien Pollet <[hidden email]> wrote:
Because there is this concept called "consistency" that's interesting to have :p

If your code wants $HOME it can ask for it explicitly, same for /. However if it just wants to do something in $PWD consistent with most use-cases, the image directory is the sensible default.


I agree with Pollet. I don't care if it is image directory or $HOME. What I care is that $PWD of the VM process should match with FileSystem >> workingDirectory.  And right now it does not match.


 
On 22 March 2016 at 13:05, Damien Cassou <[hidden email]> wrote:
Damien Pollet <[hidden email]> writes:

> On 22 March 2016 at 12:56, Damien Cassou <[hidden email]> wrote:
>
>> typical applications ran with double-click are bound to the HOME
>> directory. Why do you want to do it differently?
>>
>
> Only on Linux. On OS X it's /

so, why do you want to make it the image directory?

--
Damien Cassou
http://damiencassou.seasidehosting.st

"Success is the ability to go from one failure to another without
losing enthusiasm." --Winston Churchill



--
Damien Pollet
type less, do more [ | ] http://people.untyped.org/damien.pollet



--
Reply | Threaded
Open this post in threaded view
|

Re: Discussing FileSystem >> #workingDirectory and VM process getcwd(3)

Dale Henrichs-3
Mariano,

I think this _is_ the OSX issue that I was talking about ... there is a way to arrange for PWD to be set correctly when double clicking apps, but it has to be set a system option so each user has to do it themselves ...

Dale

On 3/22/16 6:01 AM, Mariano Martinez Peck wrote:


On Tue, Mar 22, 2016 at 9:37 AM, Damien Pollet <[hidden email]> wrote:
Because there is this concept called "consistency" that's interesting to have :p

If your code wants $HOME it can ask for it explicitly, same for /. However if it just wants to do something in $PWD consistent with most use-cases, the image directory is the sensible default.


I agree with Pollet. I don't care if it is image directory or $HOME. What I care is that $PWD of the VM process should match with FileSystem >> workingDirectory.  And right now it does not match.


 
On 22 March 2016 at 13:05, Damien Cassou <[hidden email]> wrote:
Damien Pollet <[hidden email]> writes:

> On 22 March 2016 at 12:56, Damien Cassou <[hidden email]> wrote:
>
>> typical applications ran with double-click are bound to the HOME
>> directory. Why do you want to do it differently?
>>
>
> Only on Linux. On OS X it's /

so, why do you want to make it the image directory?

--
Damien Cassou
http://damiencassou.seasidehosting.st

"Success is the ability to go from one failure to another without
losing enthusiasm." --Winston Churchill



--
Damien Pollet
type less, do more [ | ] http://people.untyped.org/damien.pollet



--

Reply | Threaded
Open this post in threaded view
|

Re: Discussing FileSystem >> #workingDirectory and VM process getcwd(3)

Damien Cassou-2
In reply to this post by Mariano Martinez Peck
Mariano Martinez Peck <[hidden email]> writes:

> On Tue, Mar 22, 2016 at 9:37 AM, Damien Pollet <[hidden email]>
> wrote:
>
>> Because there is this concept called "consistency" that's interesting to
>> have :p
>>
>> If your code wants $HOME it can ask for it explicitly, same for /. However
>> if it just wants to do something in $PWD consistent with most use-cases,
>> the image directory is the sensible default.
>>
>>
> I agree with Pollet. I don't care if it is image directory or $HOME. What I
> care is that $PWD of the VM process should match with FileSystem >>
> workingDirectory.  And right now it does not match.

I was not clear enough: I agree that consistency is important and VM
must answer the same as image. What that "same" should be is still
unclear to me though. You propose the image folder, but this is
inconsistent with other applications launched by double-click. I propose
to be consistent with other applications: HOME on Linux, / on OS X.

--
Damien Cassou
http://damiencassou.seasidehosting.st

"Success is the ability to go from one failure to another without
losing enthusiasm." --Winston Churchill

Reply | Threaded
Open this post in threaded view
|

Re: Discussing FileSystem >> #workingDirectory and VM process getcwd(3)

Damien Pollet
as long as $PWD is respected, I don't think either way really matters

On 23 March 2016 at 11:53, Damien Cassou <[hidden email]> wrote:
Mariano Martinez Peck <[hidden email]> writes:

> On Tue, Mar 22, 2016 at 9:37 AM, Damien Pollet <[hidden email]>
> wrote:
>
>> Because there is this concept called "consistency" that's interesting to
>> have :p
>>
>> If your code wants $HOME it can ask for it explicitly, same for /. However
>> if it just wants to do something in $PWD consistent with most use-cases,
>> the image directory is the sensible default.
>>
>>
> I agree with Pollet. I don't care if it is image directory or $HOME. What I
> care is that $PWD of the VM process should match with FileSystem >>
> workingDirectory.  And right now it does not match.

I was not clear enough: I agree that consistency is important and VM
must answer the same as image. What that "same" should be is still
unclear to me though. You propose the image folder, but this is
inconsistent with other applications launched by double-click. I propose
to be consistent with other applications: HOME on Linux, / on OS X.

--
Damien Cassou
http://damiencassou.seasidehosting.st

"Success is the ability to go from one failure to another without
losing enthusiasm." --Winston Churchill




--
Damien Pollet
type less, do more [ | ] http://people.untyped.org/damien.pollet
Reply | Threaded
Open this post in threaded view
|

Re: Discussing FileSystem >> #workingDirectory and VM process getcwd(3)

Eliot Miranda-2
In reply to this post by Dale Henrichs-3
Hi Dale,

On Tue, Mar 22, 2016 at 7:49 AM, Dale Henrichs <[hidden email]> wrote:
Mariano,

I think this _is_ the OSX issue that I was talking about ... there is a way to arrange for PWD to be set correctly when double clicking apps, but it has to be set a system option so each user has to do it themselves ...

Is that a setting in the Desktop preferences (or...?) or is it a setting on the app itself?
 


Dale


On 3/22/16 6:01 AM, Mariano Martinez Peck wrote:


On Tue, Mar 22, 2016 at 9:37 AM, Damien Pollet <[hidden email]> wrote:
Because there is this concept called "consistency" that's interesting to have :p

If your code wants $HOME it can ask for it explicitly, same for /. However if it just wants to do something in $PWD consistent with most use-cases, the image directory is the sensible default.


I agree with Pollet. I don't care if it is image directory or $HOME. What I care is that $PWD of the VM process should match with FileSystem >> workingDirectory.  And right now it does not match.


 
On 22 March 2016 at 13:05, Damien Cassou <[hidden email][hidden email]> wrote:
Damien Pollet <[hidden email][hidden email]> writes:

> On 22 March 2016 at 12:56, Damien Cassou <[hidden email]> wrote:
>
>> typical applications ran with double-click are bound to the HOME
>> directory. Why do you want to do it differently?
>>
>
> Only on Linux. On OS X it's /

so, why do you want to make it the image directory?

--
Damien Cassou
http://damiencassou.seasidehosting.st

"Success is the ability to go from one failure to another without
losing enthusiasm." --Winston Churchill



--
Damien Pollet
type less, do more [ | ] http://people.untyped.org/damien.pollet



--




--
_,,,^..^,,,_
best, Eliot
Reply | Threaded
Open this post in threaded view
|

Re: Discussing FileSystem >> #workingDirectory and VM process getcwd(3)

Dale Henrichs-3
I think it was a shell command and`sudo` may have been required ... I had to do it with Mavericks (or earlier) ... it's possible that with Yosemite that it is no longer possible:) I haven't checked for a while.

Dale

On 3/23/16 5:46 PM, Eliot Miranda wrote:
Hi Dale,

On Tue, Mar 22, 2016 at 7:49 AM, Dale Henrichs <[hidden email]> wrote:
Mariano,

I think this _is_ the OSX issue that I was talking about ... there is a way to arrange for PWD to be set correctly when double clicking apps, but it has to be set a system option so each user has to do it themselves ...

Is that a setting in the Desktop preferences (or...?) or is it a setting on the app itself?
 


Dale


On 3/22/16 6:01 AM, Mariano Martinez Peck wrote:


On Tue, Mar 22, 2016 at 9:37 AM, Damien Pollet <[hidden email]> wrote:
Because there is this concept called "consistency" that's interesting to have :p

If your code wants $HOME it can ask for it explicitly, same for /. However if it just wants to do something in $PWD consistent with most use-cases, the image directory is the sensible default.


I agree with Pollet. I don't care if it is image directory or $HOME. What I care is that $PWD of the VM process should match with FileSystem >> workingDirectory.  And right now it does not match.


 
On 22 March 2016 at 13:05, Damien Cassou <[hidden email]> wrote:
Damien Pollet <[hidden email]> writes:

> On 22 March 2016 at 12:56, Damien Cassou <[hidden email]> wrote:
>
>> typical applications ran with double-click are bound to the HOME
>> directory. Why do you want to do it differently?
>>
>
> Only on Linux. On OS X it's /

so, why do you want to make it the image directory?

--
Damien Cassou
http://damiencassou.seasidehosting.st

"Success is the ability to go from one failure to another without
losing enthusiasm." --Winston Churchill



--
Damien Pollet
type less, do more [ | ] http://people.untyped.org/damien.pollet



--




--
_,,,^..^,,,_
best, Eliot