[GRASS-dev] Re: [GRASS-windows] Problems with accessing location between windows and linux

Glynn Clements glynn at gclements.plus.com
Fri Oct 10 13:27:56 EDT 2008


Moritz Lennert wrote:

> >>> I have
> >>> created some locations and mapsets using GRASS Windows (with the native
> >>> windows installer, 6.3.0-4), on a FAT32 disk.

> AFAIK, group permissions are not enough, you need to be the _owner_ of 
> the directory and files. Can you chown the files in the windows 
> partition ?

The FAT filesystem has neither permissions nor ownership.

[NTFS has these attributes, but the implementation is quite different
to Unix, so I'm not sure how well it maps. Also, writing to NTFS
partitions from Linux has always been considered risky, due to the
complexity of the format and the lack of documentation.]

When you mount FAT/VFAT filesystems on Linux, you can choose the owner
and permissions of the files with the following options:

       uid=value and gid=value
	      Set the owner and group of all files.  (Default: the uid and gid
	      of the current process.)

       umask=value
	      Set  the	umask  (the  bitmask  of  the permissions that are not
	      present). The default is the umask of the current process.   The
	      value is given in octal.

       dmask=value
	      Set  the	umask applied to directories only.  The default is the
	      umask of the current process.  The value is given in octal.

       fmask=value
	      Set the umask applied to regular files only.  The default is the
	      umask of the current process.  The value is given in octal.

For GRASS, you will need to make yourself the owner. As Moritz points
out, write permission alone isn't enough.

There might be other problems, e.g. due to the fact that FAT doesn't
support hard links, which GRASS code occasionally uses.

Also, there could be issues due to filenames being case insensitive
(when GRASS tries to open a file directly, the case doesn't matter,
but if it scans the directory looking for a specific file, it may
overlook it if the case isn't what it expects). If that is a problem,
you can change how case is handled with the option:

       shortname=[lower|win95|winnt|mixed]

	      Defines the behaviour for	 creation  and	display	 of  filenames
	      which fit into 8.3 characters. If a long name for a file exists,
	      it will always be preferred display. There are four modes:

	      lower  Force the short name to lower case upon display; store  a
		     long name when the short name is not all upper case.

	      win95  Force  the short name to upper case upon display; store a
		     long name when the short name is not all upper case.

	      winnt  Display the shortname as is; store a long name  when  the
		     short name is not all lower case or all upper case.

	      mixed  Display  the short name as is; store a long name when the
		     short name is not all upper case.

We have had to iron out many such problems in the process of porting
GRASS to Windows. However, sometimes this has been achieved by adding
Windows-specific cases to the code, which won't have any effect if
you're actually running on Unix.

Finally, if you built GRASS from source, you can disable the ownership
checks by deleting the code within the "#ifndef __MINGW32__" blocks in
G__mapset_permissions() and G__mapset_permissions2() in the file
lib/gis/mapset_msc.c, then re-compiling.

Note to grass-dev: should we consider providing a mechanism to allow
the ownership check to be overridden? On a single-user system (or a
"shared" system where everyone has root/sudo access), the check isn't
critical, and can sometimes get in the way (like this).

-- 
Glynn Clements <glynn at gclements.plus.com>


More information about the grass-dev mailing list