Is the permissions_mode method from the FileDescriptorInfo trait for checking the File Descriptor permissions over a file (the permissions that the file was opened with) OR for checking the File permissions (the permissions that the file has at any given time)?
Problem
This issue refers to unmerged tests in the upstream for filesystem, more specifically 3
Per documentation for chmod:
This function changes the permissions on a certain file/directory specified by the path
Which is to be understood.
What I can not figure out is if the method permissions_mode belonging to the FileDescriptorInfo trait wants to replicate the fstat function from sys/stat.h (fstat) and return the permissions of the underlying file that the FD points to OR replicate the fcntl function from fcntl.h (fcntl) and retrieve the permissions of the FD (with which the file was opened --- fcntl(fd, F_GETFL))?
If it is wanted for permissions_mode to replicate the fstat function, wouldn't that mean that the FDInfo structure and the FileDescriptorInfo trait's implementation for it both have to be modified? If that's the case, I'd have no problem with modifying them myself, but just want to make sure I'm not modifying things I should not be and want to double check this is the way you intend us to do it.
Example
I will exemplify this by making use of the chmod_simple test's code:
Here the file_chmod.txt is created with Write permissions, after which the FILE'S permissions are modified to Read permissions by making use of chmod. In the end, we are trying to assert that the permissions of the File Descriptor are Read permissions, or so I think, but this is trying to assert that the File's permissions are Read permissions (???), whilst having them grabbed through the permissions_mode method implemented for the FDInfo structure from the FileDescriptorInfo trait.
IF we wanted to check the new permissions of the file, shouldn't we try to open that specific file again but with the newer permissions and having the open function return us OK since the new perms are matching?
Finally, reiterating my question: Is the permissions_mode method from the FileDescriptorInfo trait for checking the File Descriptor permissions over a file (the permissions that the file was opened with) OR for checking the File permissions (the permissions that the file has at any given time)?
Question
Is the
permissions_mode
method from theFileDescriptorInfo
trait for checking the File Descriptor permissions over a file (the permissions that the file was opened with) OR for checking the File permissions (the permissions that the file has at any given time)?Problem
This issue refers to unmerged tests in the upstream for filesystem, more specifically 3
Per documentation for
chmod
:Which is to be understood.
What I can not figure out is if the method
permissions_mode
belonging to theFileDescriptorInfo
trait wants to replicate thefstat
function fromsys/stat.h
(fstat) and return the permissions of the underlying file that the FD points to OR replicate thefcntl
function fromfcntl.h
(fcntl) and retrieve the permissions of the FD (with which the file was opened ---fcntl(fd, F_GETFL)
)?If it is wanted for
permissions_mode
to replicate thefstat
function, wouldn't that mean that theFDInfo
structure and theFileDescriptorInfo
trait's implementation for it both have to be modified? If that's the case, I'd have no problem with modifying them myself, but just want to make sure I'm not modifying things I should not be and want to double check this is the way you intend us to do it.Example
I will exemplify this by making use of the
chmod_simple
test's code:Here the
file_chmod.txt
is created withWrite
permissions, after which the FILE'S permissions are modified toRead
permissions by making use ofchmod
. In the end, we are trying to assert that the permissions of the File Descriptor areRead
permissions, or so I think, but this is trying to assert that the File's permissions areRead
permissions (???), whilst having them grabbed through thepermissions_mode
method implemented for theFDInfo
structure from theFileDescriptorInfo
trait.IF we wanted to check the new permissions of the file, shouldn't we try to open that specific file again but with the newer permissions and having the
open
function return usOK
since the new perms are matching?Finally, reiterating my question: Is the
permissions_mode
method from theFileDescriptorInfo
trait for checking the File Descriptor permissions over a file (the permissions that the file was opened with) OR for checking the File permissions (the permissions that the file has at any given time)?