Re: [Pharo-dev] FileSystem Permissions

2013-07-02 Thread Sven Van Caekenberghe
Hi Thierry,

On 02 Jul 2013, at 11:34, Goubier Thierry thierry.goub...@cea.fr wrote:

 Hi all,
 
 it seems FileSystem permissions are not working at all like intended in 
 Linux, and it's the case in both 2.0 and 3.0 (but it 3.0 it has the elegance 
 of rendering the file browser and all file dialogs unusable :().
 
 https://pharo.fogbugz.com/f/cases/11102/FileSystemError-Path-root
 
 (an entry like drwx-- 10 root root 4096 mai   15 13:26 /root is readable 
 according to FileReference :()
 
 Is there any point in the vm to do a fstat/stat ?

I think the basic information is there, see 
FileSystemDirectoryEntryposixPermissions. It seems that the way that 
information is subsequently handled in Pharo is wrong, or at least way too 
simple. The question is of course, what is a good cross platform API. Mac OS X 
 Linux will be quite similar, but Windows ?

Sven

 Thierry
 -- 
 Thierry Goubier
 CEA list
 Laboratoire des Fondations des Systèmes Temps Réel Embarqués
 91191 Gif sur Yvette Cedex
 France
 Phone/Fax: +33 (0) 1 69 08 32 92 / 83 95
 




Re: [Pharo-dev] FileSystem Permissions

2013-07-02 Thread Camillo Bruni

On 2013-07-02, at 11:44, Sven Van Caekenberghe s...@stfx.eu wrote:

 Hi Thierry,
 
 On 02 Jul 2013, at 11:34, Goubier Thierry thierry.goub...@cea.fr wrote:
 
 Hi all,
 
 it seems FileSystem permissions are not working at all like intended in 
 Linux, and it's the case in both 2.0 and 3.0 (but it 3.0 it has the elegance 
 of rendering the file browser and all file dialogs unusable :().
 
 https://pharo.fogbugz.com/f/cases/11102/FileSystemError-Path-root
 
 (an entry like drwx-- 10 root root 4096 mai   15 13:26 /root is readable 
 according to FileReference :()
 
 Is there any point in the vm to do a fstat/stat ?
 
 I think the basic information is there, see 
 FileSystemDirectoryEntryposixPermissions. It seems that the way that 
 information is subsequently handled in Pharo is wrong, or at least way too 
 simple. The question is of course, what is a good cross platform API. Mac OS 
 X  Linux will be quite similar, but Windows ?


The problem is deeper that the mere permissions. The permissions only look at 
the POSIX permissions returned by fstat/stat, but it does not respect the 
current user.

The problem you find is rather that all the other FS primitives do not know how 
to deal with permissions.
The following code yields an error since the primitive signals a Directory Not 
Found which should not happen:

(FileSystem root / 'lost+found') exists
ifTrue: [ (FileSystem root / 'lost+found') hasChildren ].




Re: [Pharo-dev] FileSystem Permissions

2013-07-02 Thread Goubier Thierry



Le 02/07/2013 11:44, Sven Van Caekenberghe a écrit :

Hi Thierry,

On 02 Jul 2013, at 11:34, Goubier Thierry thierry.goub...@cea.fr wrote:


Hi all,

it seems FileSystem permissions are not working at all like intended in Linux, 
and it's the case in both 2.0 and 3.0 (but it 3.0 it has the elegance of 
rendering the file browser and all file dialogs unusable :().

https://pharo.fogbugz.com/f/cases/11102/FileSystemError-Path-root

(an entry like drwx-- 10 root root 4096 mai   15 13:26 /root is readable 
according to FileReference :()

Is there any point in the vm to do a fstat/stat ?


I think the basic information is there, see 
FileSystemDirectoryEntryposixPermissions. It seems that the way that information 
is subsequently handled in Pharo is wrong, or at least way too simple. The question is of 
course, what is a good cross platform API. Mac OS X  Linux will be quite similar, 
but Windows ?


No, it's not. There are no primitives I could see in FilePlugin (at 
least the ones used) to write correct permissions in Pharo... In short, 
no isReadable, isWriteable can be made correct in Pharo at the moment.


I wrote test code expecting this to work :(

Thierry
--
Thierry Goubier
CEA list
Laboratoire des Fondations des Systèmes Temps Réel Embarqués
91191 Gif sur Yvette Cedex
France
Phone/Fax: +33 (0) 1 69 08 32 92 / 83 95



Re: [Pharo-dev] FileSystem Permissions

2013-07-02 Thread Camillo Bruni
 
 Le 02/07/2013 11:44, Sven Van Caekenberghe a écrit :
 Hi Thierry,
 
 On 02 Jul 2013, at 11:34, Goubier Thierry thierry.goub...@cea.fr wrote:
 
 Hi all,
 
 it seems FileSystem permissions are not working at all like intended in 
 Linux, and it's the case in both 2.0 and 3.0 (but it 3.0 it has the 
 elegance of rendering the file browser and all file dialogs unusable :().
 
 https://pharo.fogbugz.com/f/cases/11102/FileSystemError-Path-root
 
 (an entry like drwx-- 10 root root 4096 mai   15 13:26 /root is 
 readable according to FileReference :()
 
 Is there any point in the vm to do a fstat/stat ?
 
 I think the basic information is there, see 
 FileSystemDirectoryEntryposixPermissions. It seems that the way that 
 information is subsequently handled in Pharo is wrong, or at least way too 
 simple. The question is of course, what is a good cross platform API. Mac OS 
 X  Linux will be quite similar, but Windows ?
 
 No, it's not. There are no primitives I could see in FilePlugin (at least the 
 ones used) to write correct permissions in Pharo... In short, no isReadable, 
 isWriteable can be made correct in Pharo at the moment.
 
 I wrote test code expecting this to work :(


nope there is indeed no code for this. 
We modified the VM to support the permission reading, but we didn't add support 
for writing it.

Maybe this is again a nice usecase for NativeBoost?


Re: [Pharo-dev] FileSystem Permissions

2013-07-02 Thread Goubier Thierry



Le 02/07/2013 12:48, Camillo Bruni a écrit :


On 2013-07-02, at 11:44, Sven Van Caekenberghe s...@stfx.eu wrote:


Hi Thierry,

On 02 Jul 2013, at 11:34, Goubier Thierry thierry.goub...@cea.fr wrote:


Hi all,

it seems FileSystem permissions are not working at all like intended in Linux, 
and it's the case in both 2.0 and 3.0 (but it 3.0 it has the elegance of 
rendering the file browser and all file dialogs unusable :().

https://pharo.fogbugz.com/f/cases/11102/FileSystemError-Path-root

(an entry like drwx-- 10 root root 4096 mai   15 13:26 /root is readable 
according to FileReference :()

Is there any point in the vm to do a fstat/stat ?


I think the basic information is there, see 
FileSystemDirectoryEntryposixPermissions. It seems that the way that information 
is subsequently handled in Pharo is wrong, or at least way too simple. The question is of 
course, what is a good cross platform API. Mac OS X  Linux will be quite similar, 
but Windows ?



The problem is deeper that the mere permissions. The permissions only look at 
the POSIX permissions returned by fstat/stat, but it does not respect the 
current user.


Yes, it's something like that.


The problem you find is rather that all the other FS primitives do not know how 
to deal with permissions.
The following code yields an error since the primitive signals a Directory Not 
Found which should not happen:

(FileSystem root / 'lost+found') exists
 ifTrue: [ (FileSystem root / 'lost+found') hasChildren ].


No, they do work, but the base permission information (as far as I could 
see, it's only retrieved with getting directory entries) is unusable. 
It's the overall POSIX data, but without the ownership and anyway to 
correlate pharo ownership and file ownership.


Anybody to explain me how to write NB code to call directly stat/fstat? 
I find this failure to be really embarassing for Pharo.


Thierry
--
Thierry Goubier
CEA list
Laboratoire des Fondations des Systèmes Temps Réel Embarqués
91191 Gif sur Yvette Cedex
France
Phone/Fax: +33 (0) 1 69 08 32 92 / 83 95



Re: [Pharo-dev] FileSystem Permissions

2013-07-02 Thread Camillo Bruni
 
 The problem is deeper that the mere permissions. The permissions only look 
 at the POSIX permissions returned by fstat/stat, but it does not respect the 
 current user.
 
 Yes, it's something like that.
 
 The problem you find is rather that all the other FS primitives do not know 
 how to deal with permissions.
 The following code yields an error since the primitive signals a Directory 
 Not Found which should not happen:
 
 (FileSystem root / 'lost+found') exists
 ifTrue: [ (FileSystem root / 'lost+found') hasChildren ].
 
 No, they do work, but the base permission information (as far as I could see, 
 it's only retrieved with getting directory entries) is unusable. It's the 
 overall POSIX data, but without the ownership and anyway to correlate pharo 
 ownership and file ownership.
 
 Anybody to explain me how to write NB code to call directly stat/fstat? I 
 find this failure to be really embarassing for Pharo.


be lucky that there even IS support for permissions ;), but yeah for me this is 
also hard to understand
that for years there hasn't been support for this :/


Re: [Pharo-dev] FileSystem Permissions

2013-07-02 Thread Goubier Thierry



Le 02/07/2013 15:08, Camillo Bruni a écrit :


The problem is deeper that the mere permissions. The permissions only look at 
the POSIX permissions returned by fstat/stat, but it does not respect the 
current user.


Yes, it's something like that.


The problem you find is rather that all the other FS primitives do not know how 
to deal with permissions.
The following code yields an error since the primitive signals a Directory Not 
Found which should not happen:

(FileSystem root / 'lost+found') exists
 ifTrue: [ (FileSystem root / 'lost+found') hasChildren ].


No, they do work, but the base permission information (as far as I could see, 
it's only retrieved with getting directory entries) is unusable. It's the 
overall POSIX data, but without the ownership and anyway to correlate pharo 
ownership and file ownership.

Anybody to explain me how to write NB code to call directly stat/fstat? I find 
this failure to be really embarassing for Pharo.



be lucky that there even IS support for permissions ;), but yeah for me this is 
also hard to understand
that for years there hasn't been support for this :/


It's as if there are none, at the moment. It only works on files you own :)

I could write OSProcess-based code, I'm becoming good at that ;)

Thierry
--
Thierry Goubier
CEA list
Laboratoire des Fondations des Systèmes Temps Réel Embarqués
91191 Gif sur Yvette Cedex
France
Phone/Fax: +33 (0) 1 69 08 32 92 / 83 95



Re: [Pharo-dev] FileSystem Permissions

2013-07-02 Thread Camillo Bruni
On 2013-07-02, at 15:11, Goubier Thierry thierry.goub...@cea.fr wrote:
 Le 02/07/2013 15:02, Camillo Bruni a écrit :
 
 Le 02/07/2013 11:44, Sven Van Caekenberghe a écrit :
 Hi Thierry,
 
 On 02 Jul 2013, at 11:34, Goubier Thierry thierry.goub...@cea.fr wrote:
 
 Hi all,
 
 it seems FileSystem permissions are not working at all like intended in 
 Linux, and it's the case in both 2.0 and 3.0 (but it 3.0 it has the 
 elegance of rendering the file browser and all file dialogs unusable :().
 
 https://pharo.fogbugz.com/f/cases/11102/FileSystemError-Path-root
 
 (an entry like drwx-- 10 root root 4096 mai   15 13:26 /root is 
 readable according to FileReference :()
 
 Is there any point in the vm to do a fstat/stat ?
 
 I think the basic information is there, see 
 FileSystemDirectoryEntryposixPermissions. It seems that the way that 
 information is subsequently handled in Pharo is wrong, or at least way too 
 simple. The question is of course, what is a good cross platform API. Mac 
 OS X  Linux will be quite similar, but Windows ?
 
 No, it's not. There are no primitives I could see in FilePlugin (at least 
 the ones used) to write correct permissions in Pharo... In short, no 
 isReadable, isWriteable can be made correct in Pharo at the moment.
 
 I wrote test code expecting this to work :(
 
 
 nope there is indeed no code for this.
 We modified the VM to support the permission reading, but we didn't add 
 support for writing it.
 
 Maybe this is again a nice usecase for NativeBoost?
 
 I'm ready to try. Anybody to explain me how to use NativeBoost for that?

You can check the OSEnvironment classes, they use getenv / setenv to accomplish 
simple callouts.

But I think fstat is more complex than that since it returns a struct and pass 
in 
the proper file descriptors :/...

As an immediate ver short term solution under linux I suggest using OSProcess + 
a chmod call :(


Re: [Pharo-dev] FileSystem Permissions

2013-07-02 Thread Goubier Thierry



Le 02/07/2013 15:12, Camillo Bruni a écrit :

On 2013-07-02, at 15:11, Goubier Thierry thierry.goub...@cea.fr wrote:

Le 02/07/2013 15:02, Camillo Bruni a écrit :



Le 02/07/2013 11:44, Sven Van Caekenberghe a écrit :

Hi Thierry,

On 02 Jul 2013, at 11:34, Goubier Thierry thierry.goub...@cea.fr wrote:


Hi all,

it seems FileSystem permissions are not working at all like intended in Linux, 
and it's the case in both 2.0 and 3.0 (but it 3.0 it has the elegance of 
rendering the file browser and all file dialogs unusable :().

https://pharo.fogbugz.com/f/cases/11102/FileSystemError-Path-root

(an entry like drwx-- 10 root root 4096 mai   15 13:26 /root is readable 
according to FileReference :()

Is there any point in the vm to do a fstat/stat ?


I think the basic information is there, see 
FileSystemDirectoryEntryposixPermissions. It seems that the way that information 
is subsequently handled in Pharo is wrong, or at least way too simple. The question is of 
course, what is a good cross platform API. Mac OS X  Linux will be quite similar, 
but Windows ?


No, it's not. There are no primitives I could see in FilePlugin (at least the 
ones used) to write correct permissions in Pharo... In short, no isReadable, 
isWriteable can be made correct in Pharo at the moment.

I wrote test code expecting this to work :(



nope there is indeed no code for this.
We modified the VM to support the permission reading, but we didn't add support 
for writing it.

Maybe this is again a nice usecase for NativeBoost?


I'm ready to try. Anybody to explain me how to use NativeBoost for that?


You can check the OSEnvironment classes, they use getenv / setenv to accomplish
simple callouts.


Ok. Thanks.


But I think fstat is more complex than that since it returns a struct and pass 
in
the proper file descriptors :/...

As an immediate ver short term solution under linux I suggest using OSProcess + 
a chmod call :(


No, what I really want is to get permission reading right... At the 
moment I can't even add a file based repository to a Pharo 3.0 image :(:(


Thierry
--
Thierry Goubier
CEA list
Laboratoire des Fondations des Systèmes Temps Réel Embarqués
91191 Gif sur Yvette Cedex
France
Phone/Fax: +33 (0) 1 69 08 32 92 / 83 95



Re: [Pharo-dev] FileSystem Permissions

2013-07-02 Thread Goubier Thierry

I think I have what is needed.

ACCESS(2)  Linux Programmer's Manual 
ACCESS(2)


NAME
   access - check real user's permissions for a file

SYNOPSIS
   #include unistd.h

   int access(const char *pathname, int mode);

Thierry

Le 02/07/2013 15:12, Camillo Bruni a écrit :

On 2013-07-02, at 15:11, Goubier Thierry thierry.goub...@cea.fr wrote:

Le 02/07/2013 15:02, Camillo Bruni a écrit :



Le 02/07/2013 11:44, Sven Van Caekenberghe a écrit :

Hi Thierry,

On 02 Jul 2013, at 11:34, Goubier Thierry thierry.goub...@cea.fr wrote:


Hi all,

it seems FileSystem permissions are not working at all like intended in Linux, 
and it's the case in both 2.0 and 3.0 (but it 3.0 it has the elegance of 
rendering the file browser and all file dialogs unusable :().

https://pharo.fogbugz.com/f/cases/11102/FileSystemError-Path-root

(an entry like drwx-- 10 root root 4096 mai   15 13:26 /root is readable 
according to FileReference :()

Is there any point in the vm to do a fstat/stat ?


I think the basic information is there, see 
FileSystemDirectoryEntryposixPermissions. It seems that the way that information 
is subsequently handled in Pharo is wrong, or at least way too simple. The question is of 
course, what is a good cross platform API. Mac OS X  Linux will be quite similar, 
but Windows ?


No, it's not. There are no primitives I could see in FilePlugin (at least the 
ones used) to write correct permissions in Pharo... In short, no isReadable, 
isWriteable can be made correct in Pharo at the moment.

I wrote test code expecting this to work :(



nope there is indeed no code for this.
We modified the VM to support the permission reading, but we didn't add support 
for writing it.

Maybe this is again a nice usecase for NativeBoost?


I'm ready to try. Anybody to explain me how to use NativeBoost for that?


You can check the OSEnvironment classes, they use getenv / setenv to accomplish
simple callouts.

But I think fstat is more complex than that since it returns a struct and pass 
in
the proper file descriptors :/...

As an immediate ver short term solution under linux I suggest using OSProcess + 
a chmod call :(




--
Thierry Goubier
CEA list
Laboratoire des Fondations des Systèmes Temps Réel Embarqués
91191 Gif sur Yvette Cedex
France
Phone/Fax: +33 (0) 1 69 08 32 92 / 83 95



Re: [Pharo-dev] FileSystem Permissions

2013-07-02 Thread Camillo Bruni

On 2013-07-02, at 15:27, Goubier Thierry thierry.goub...@cea.fr wrote:

 I think I have what is needed.
 
 ACCESS(2)  Linux Programmer's Manual ACCESS(2)
 
 NAME
   access - check real user's permissions for a file
 
 SYNOPSIS
   #include unistd.h
 
   int access(const char *pathname, int mode);

that looks doable in NativeBoost :)



Re: [Pharo-dev] FileSystem Permissions

2013-07-02 Thread Goubier Thierry

Done:

SLICE-Issue-11102-FileSystemError-Path--root-ThierryGoubier.1

In http://ss3.gemstone.com/ss/PharoInbox

(It's for 2.0 at the moment. I'll try on 3.0 to port the same code).

Thierry

Le 02/07/2013 15:24, Camillo Bruni a écrit :


On 2013-07-02, at 15:27, Goubier Thierry thierry.goub...@cea.fr wrote:


I think I have what is needed.

ACCESS(2)  Linux Programmer's Manual ACCESS(2)

NAME
   access - check real user's permissions for a file

SYNOPSIS
   #include unistd.h

   int access(const char *pathname, int mode);


that looks doable in NativeBoost :)





--
Thierry Goubier
CEA list
Laboratoire des Fondations des Systèmes Temps Réel Embarqués
91191 Gif sur Yvette Cedex
France
Phone/Fax: +33 (0) 1 69 08 32 92 / 83 95