Saturday, May 4, 2024
 Popular · Latest · Hot · Upcoming
2
rated 0 times [  2] [ 0]  / answers: 1 / hits: 1176  / 2 Years ago, fri, october 28, 2022, 9:52:30

I've mounted a Windows directory with CIFS :



sudo mount -t cifs //SERVER/Bases/some/path ~/mnt/data -o user=windomain/login%password


This works :



cp mnt/data/blabla/file.mdb .
/usr/bin/mdb-export file.mdb tablename


But this doesn't :



/usr/bin/mdb-export mnt/data/blabla/file.mdb tablename


It fails with output



Can't alloc filename


Why ? How can I execute mdb-export on a mounted file without having to copy it locally first ?


More From » 12.04

 Answers
2

A workaround is to change the mount command to add the noserverino,nounix options :



sudo mount -t cifs //SERVER/Bases/some/path ~/mnt/data -o user=windomain/login%password,noserverino,nounix





Florian pointed me to the right direction, that is the mdb_find_file function in the source code of the MDB tools :



static gchar *mdb_find_file(char *file_name)
{
struct stat status;
gchar *mdbpath, **dir, *tmpfname;
unsigned int i = 0;

/* try the provided file name first */
if (!stat(file_name, &status)) {
return g_strdup(file_name);
}

/* Now pull apart $MDBPATH and try those */
mdbpath = (gchar *) getenv("MDBPATH");
/* no path, can't find file */
if (!mdbpath || !strlen(mdbpath)) return NULL;

dir = g_strsplit(mdbpath, ":", 0);
while (dir[i]) {
if (!strlen(dir[i])) continue;
tmpfname = g_strconcat(dir[i++], "/", file_name, NULL);
if (!stat(tmpfname, &status)) {
g_strfreev(dir);
return tmpfname;
}
g_free(tmpfname);
}
g_strfreev(dir);
return NULL;
}


As I don't have any MDBPATH env var, it's obvious that there is an error in the stat call. I googled in that direction and got this :



http://www.linuxquestions.org/questions/programming-9/problem-with-stat-on-cifs-852983/



As I didn't try to recompile the MDB tools to get the error code, I'm not sure it's the same problem but adding the options that this thread suggested solved my problem, there's no more error when calling mdb-export.


[#29687] Saturday, October 29, 2022, 2 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
edseager

Total Points: 185
Total Questions: 105
Total Answers: 102

Location: Angola
Member since Wed, Apr 13, 2022
2 Years ago
;