[GRASS-user] Cannot use grass on vfat partition

Glynn Clements glynn at gclements.plus.com
Thu May 1 21:24:01 EDT 2008


Agustin Lobo wrote:

> Also, if within the grass text session I do:
>   g.mapset /media/mifat32/test/testmapset
> I get:
> ERROR: The mapset does not exist.

That's correct. The mapset= argument should be the name of a mapset
(e.g. "testmapset"), not a full path.

> Just found the difference between locations on
> the vfat and on the ext3 partition:
> mapsets on the vfat partition get
> files  MYNAME  WIND as myname and wind.

That explains it.

> Just renaming these files makes everything work.
> 
> What I do not understand is why grass
> writes thes files in lower case, it does not
> with LOCATION for example, and even less
> why grass has a different behaviour
> for different partition formats

It isn't GRASS that's doing this, but Linux.

The reason why it only does it to those files and not to PERMANENT and
DEFAULT_WIND is the length of the name.

If you look at the mount(8) manual page, in the section entitled
"Mount options for vfat", it says:

       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.

       The default is "lower".

With the default setting of "lower", MYNAME and WIND fit into 8.3
format (up to 8 characters, with an optional extension of up to 3
characters), and are all upper-case, so the VFAT filesystem driver
only creates a normal "DOS" filename, and not a VFAT long filename
(LFN). When the directory is enumerated, the short filenames are
returned as lower case (the on-disk format uses upper case).

If you add shortname=win95 to the mount options, the issue should go
away. If the name is all upper case, only a short name will be stored,
but the short name will be returned in upper case. If the name isn't
all upper case, a long name will be stored, and the long name will
always be returned as-is; the short name will be ignored.

Using shortname=winnt would also work, but that results in a mix of
upper- and lower-case short names on disk, which is less compatible
(MS-DOS only ever used upper case for the on-disk format).

BTW, I have no idea why the default is "lower".

Even so, this still indicates a bug in GRASS; i.e. something is
enumerating the directory and expecting to see a file named "WIND",
rather than asking the OS whether "WIND" exists. This is wrong, for
the reasons which I outlined previously.

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


More information about the grass-user mailing list