[GRASS-dev] libgis: ERROR: Unable to make mapset element cell_misc/...

Markus Neteler neteler at osgeo.org
Fri Mar 6 18:36:49 EST 2009


On Fri, Mar 6, 2009 at 10:35 AM, Maris Nartiss <maris.gis at gmail.com> wrote:
> Hello,
> with ETX3 You can't have more than 31998 sub-directories per one
> directory [1]. It doesn't matter if You use 32 or 64 bit arch.

Sniff, right:
grep _LINK_MAX /usr/include/*/*
...
/usr/include/bits/posix1_lim.h:#define  _POSIX_LINK_MAX         8
/usr/include/ext2fs/ext2_fs.h:#define EXT2_LINK_MAX             32000
/usr/include/linux/ext2_fs.h:#define EXT2_LINK_MAX              32000
/usr/include/linux/ext3_fs.h:#define EXT3_LINK_MAX              32000
...
/usr/include/linux/minix_fs.h:#define MINIX_LINK_MAX    250
/usr/include/linux/minix_fs.h:#define MINIX2_LINK_MAX   65530
/usr/include/linux/reiserfs_fs.h:#define REISERFS_LINK_MAX (MAX_US_INT - 1000)

grep MAX_US_INT /usr/include/*/*
/usr/include/linux/reiserfs_fs.h:#define MAX_US_INT 0xffff

Seems that I do need to split the mapset (expected 45000 maps).

Is this patch reasonable?

svn diff mapset_msc.c
Index: mapset_msc.c
===================================================================
--- mapset_msc.c        (revision 36196)
+++ mapset_msc.c        (working copy)
@@ -12,6 +12,7 @@
 #include <string.h>
 #include <unistd.h>
 #include <stdlib.h>
+#include <errno.h>
 #include <sys/types.h>
 #include <sys/stat.h>
 #include <grass/gis.h>
@@ -56,9 +57,10 @@
            *p = 0;
            if (access(path, 0) != 0)
                G_mkdir(path);
-           if (access(path, 0) != 0)
-               G_fatal_error(_("Unable to make mapset element %s (%s)"),
-                             p_element, path);
+           if (access(path, 0) != 0) {
+               G_fatal_error(_("Unable to make mapset element %s (%s): %s"),
+                             p_element, path, strerror(errno));
+           }
            if (*element == 0)
                return 1;
        }

Strangly, it says:

r.in.gdal -o --o aqua_lst1km20090130.QC_Day.tif out=aqua_lst1km20090130.QC_Day
WARNING: Over-riding projection check
 100%
ERROR: Unable to make mapset element cell_misc/aqua_lst1km20090130.QC_Day
       (/home/neteler/grassdata/patUTM32/modisLST005filt/cell_misc/aqua_lst1km20090130.QC_Day):
       No such file or directory

while it should say:

mkdir /home/neteler/grassdata/patUTM32/modisLST005filt/cell_misc/aqua_lst1km20090130.QC_Day
mkdir: cannot create directory
`/home/neteler/grassdata/patUTM32/modisLST005filt/cell_misc/aqua_lst1km20090130.QC_Day':
Too many links

?
Markus

PS: Just discovered that I had this problem already in Oct 2008.
Time to add better error trapping.


More information about the grass-dev mailing list