[sqlite] sqlite3 fails due to too long path (MAX_PATHNAME)
Hi, I was testing long pathnames and ran into this failure: $ sqlite3 /tmp/loong/loong/loong/loong/aaa/x.db 'create table x(int y);' Error: unable to open database "/tmp/loong/loong/loong/loong/aaa/x.db": unable to open database file Tested with sqlite3 3.8.7.1 and 3.8.8.1 on Linux. This is due to: /* ** Maximum supported path-length. */ #define MAX_PATHNAME 512 According to http://pubs.opengroup.org/onlinepubs/009695399/basedefs/limits.h.html PATH_MAX should be at least 256 (sqlite is still good with that), but with XSI extensions PATH_MAX should be at least 1024 (_XOPEN_PATH_MAX) and sqlite3 fails there. Would it be possible to raise that limit, or output a better error message that says why it failed to open the file? Best regards, --Edwin ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
Re: [sqlite] sqlite3 fails due to too long path (MAX_PATHNAME)
2015-02-02 11:59 GMT+01:00 Török Edwin : > Would it be possible to raise that limit, or output a better error message > that says why it failed to open the file? My suggestion would be to add something like this to sqliteLimit.h: /* ** Maximum supported path-length.. */ #ifndef SQLITE_MAX_PATH_LENGTH # define SQLITE_MAX_PATH_LENGTH 512 #endif and use that macro in os_unix.c in stead of the hardcoded '512' An amalgamation containing this (and an equivalent change in os_win.c) can be found here: http://cyqlite.sourceforge.net/cgi-bin/sqlite/tarball/cyqlite.tar.gz?uuid=trunk Hopefully, one day you will find this change (or something equivalent) in the official SQLite. Jan Nijtmans ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
Re: [sqlite] sqlite3 fails due to too long path (MAX_PATHNAME)
On Mon, 02 Feb 2015 12:59:55 +0200 Török Edwin wrote: > Would it be possible to raise that limit, or output a better error > message that says why it failed to open the file? Maybe. open(2) should return ENAMETOOLONG. It is possible, though unlikely these days, that the shell's command-line limit is less than PATH_MAX, in which case the string passed to the sqlite3 binary would be truncated (and invalid). --jkl ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users