[Gambas-user] File mode syntax

Tobias Boege taboege at ...626...
Thu Feb 4 14:59:49 CET 2016


On Thu, 04 Feb 2016, Rolf-Werner Eilert wrote:
> Hi folks, I stumbled over this one:
> 
> The help page about File Mode Syntax (for Chmod and Chgrp) says that 
> file mode has to be a string with 9 characters. The table lists them.
> 
> I can leave out or taint random positions by unknown characters... but 
> it does not say which of the given characters are interpreted if I leave 
> out some of them.
> 
> If I write "rwx", is this 1,2,3 (user)? And "rwx...r--" or "rwx###r--" 
> would mean "rwx for user, no change in group, and read-only for others?
> 
> And I cannot simply set "660", right?
> 
> Thanks for your insight...
> 

I can't tell you what is the intended behaviour but the attached project
shows that:

  - "rwx" alone sets the owner bits, i.e. the first block,
  - "r+-*/x--" sets owner's "r" and group's "x" and leaves owner's "w" and
    group's "r" unchanged (the "+" and "/" characters) and resets everything
    else because these have a "-",
  - "rrr" only sets the owner's "r",
  - octal modes such as "660" do not work.

Included is also a function which converts a string of three octals into the
Chmod mode syntax.

Regards,
Tobi

-- 
"There's an old saying: Don't change anything... ever!" -- Mr. Monk
-------------- next part --------------
A non-text attachment was scrubbed...
Name: chmod-test-0.0.1.tar.gz
Type: application/octet-stream
Size: 11558 bytes
Desc: not available
URL: <http://lists.gambas-basic.org/pipermail/user/attachments/20160204/22ce3813/attachment.obj>


More information about the User mailing list