[GRASSGUI] Re: [grass-addons] r343 - trunk/grassaddons/gui

Daniel Calvelo dca.gis at gmail.com
Tue Mar 27 18:06:12 EDT 2007


On 3/27/07, Michael Barton <michael.barton at asu.edu> wrote:
> Aha! A further clarification. Is octal base 8? (Pardon my novicity, but I
> don't use this much).

Yes, it's actually quite intuitive once you get the gist (and see bits
where appropriate):

0644 is:

0 : this is octal, i.e. base 8
6 : this is the octal value for user (owner) permissions as bits rwx,
6 = 4+2 so we have rw-
  1 for r
  1 for w
  0 for x
4 : octal value for group permissions : r--
  1 for r
  0 for w
  0 for x
4 : octal value for other (i.e. public) permissions, r-- as before

The unixy representation of this is rw-r--r-- ; the chmod "more human"
command would be chmod u+rw-x g+r-wx o+r-wx

Daniel.


>
> Michael
>
>
> On 3/27/07 1:34 PM, "Glynn Clements" <glynn at gclements.plus.com> wrote:
>
> >
> > Michael Barton wrote:
> >
> >>>> Modified:
> >>>>    trunk/grassaddons/gui/gis_set.py
> >>>> Log:
> >>>> Fixed bug with new mapset not copying WIND file from PERMANENT.
> >>>>
> >>>> ****Please check to see if permissions need to be set (I just copied
> >>>> the WIND file permissions). Line 674 has a chmod statement, but I don't
> >>>> know what to set it to (needs set of numbers for u+rw,go+r I think).
> >>>
> >>> 644  should mean: "u+rw, go+r"
> >>>
> >>> hope, it helps
> >>
> >> I just tried this. Seemed like a good idea but didn't work. I got an error
> >> saying that I didn't have the right permissions to use the mapset.
> >>
> >> Maybe Daniel understands how os.chmod works
> >
> > The documentation at:
> >
> > http://docs.python.org/lib/os-file-dir.html
> >
> > says:
> >
> > chmod(path, mode)
> >
> >    Change the mode of path to the numeric mode. mode may take one of
> >    the following values (as defined in the stat module) or bitwise
> >    or-ed combinations of them:
> >
> >        * S_ISUID
> >        * S_ISGID
> >        * S_ENFMT
> >        * S_ISVTX
> >        * S_IREAD
> >        * S_IWRITE
> >        * S_IEXEC
> >        * S_IRWXU
> >        * S_IRUSR
> >        * S_IWUSR
> >        * S_IXUSR
> >        * S_IRWXG
> >        * S_IRGRP
> >        * S_IWGRP
> >        * S_IXGRP
> >        * S_IRWXO
> >        * S_IROTH
> >        * S_IWOTH
> >        * S_IXOTH
> >
> > The stat.py file gives these constants their usual numeric values. If
> > you want to use a numeric value in the os.chmod() call, you will need
> > to specify it in octal (with a leading zero), e.g.:
> >
> >             os.chmod(os.path.join(database,location,mapset,'WIND'), 0644)
> >
> > Note: 644 (decimal) = 01204 (octal) = t-w----r-- (u=w,g=,o=r,t), which
> > isn't much use (the owner can't read it).
>
> __________________________________________
> Michael Barton, Professor of Anthropology
> School of Human Evolution & Social Change
> Center for Social Dynamics and Complexity
> Arizona State University
>
> phone: 480-965-6213
> fax: 480-965-7671
> www: http://www.public.asu.edu/~cmbarton
>
> _______________________________________________
> grassgui mailing list
> grassgui at grass.itc.it
> http://grass.itc.it/mailman/listinfo/grassgui
>


-- 
-- Daniel Calvelo Aros




More information about the grass-gui mailing list