Re: [sqlite] Bug in Cygwin SQLite: temporary table creation fails
On 12/27/2012 21:17, Joe Mistachkin wrote: I just looked at the patch briefly and I'm wondering if we could use the existing GetTempPath[A/W] as another fallback directory? The way I see it is, we are migrating from a hybrid Windows/Cygwin mode toward a purer POSIX style. Eventually, I want Cygwin SQLite to behave just like SQLite on any Linux variant, except that it happens to still interoperate well with native Windows programs. Also, is "cygwin_conv_path" superior to "cygwin_conv_to_win32_path" in some way? It reflects an API change between Cygwin 1.5 and Cygwin 1.7. The old API still exists -- if it didn't, we'd be calling it Cygwin 2.x -- but you get a deprecation warning from the compiler if you call it. The new API is 100% equivalent, it just offers a more flexible API. I've posted this patch here twice before, but since upstream hasn't accepted it, I keep patching Cygwin SQLite. I guess I should try posting it to sqlite-devel. I believe when I first developed the patch, that list was closed to "outsiders" like me. Now that I've got patching it in down as part of the normal build procedure, I haven't bothered reposting it until now. ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
Re: [sqlite] Bug in Cygwin SQLite: temporary table creation fails
Warren Young wrote: > > Here's the patch, for those with strong stomachs: > >http://etr-usa.com/cygwin/sqlite3/src.patch > > If you can come up with a cleaner patch, by all means, lay it on me. > Disclaimer: I'm not an expert on Cygwin. I just looked at the patch briefly and I'm wondering if we could use the existing GetTempPath[A/W] as another fallback directory? Also, is "cygwin_conv_path" superior to "cygwin_conv_to_win32_path" in some way? -- Joe Mistachkin ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
Re: [sqlite] Bug in Cygwin SQLite: temporary table creation fails
On 12/27/2012 18:08, Daniel Colascione wrote: Yes, we have to accept the minuses we can't easily fix, but this one, we can can. Porting the Unix-mode temporary file logic to the Windows build seems workable enough. "Who is this 'we,' kemosabe?" You think it's easy, try it. You'll find that you can't simply make a one-line patch that swaps a unixGetTempname() call in for an osGetTempPathW() call. It compiles and then fails to link, because unixGetTempname() is ifdef'd out 5000 lines away from the actual definition. You end up duplicating about 80 lines of code, simply because that's far easier than doing the ifdef gymnastics to reuse what's already there. We aren't going to tell Mr. Hipp about this patch, lest he barf all over his shoes. (Shhh.) Here's the patch, for those with strong stomachs: http://etr-usa.com/cygwin/sqlite3/src.patch If you can come up with a cleaner patch, by all means, lay it on me. Here are the packages built with it, for testing: http://etr-usa.com/cygwin/sqlite3/libsqlite3-devel-3.7.15.1-1.tar.bz2 http://etr-usa.com/cygwin/sqlite3/libsqlite3_0-3.7.15.1-1.tar.bz2 http://etr-usa.com/cygwin/sqlite3/sqlite3-3.7.15.1-1-src.tar.bz2 http://etr-usa.com/cygwin/sqlite3/sqlite3-3.7.15.1-1.tar.bz2 Relative to the current 3.7.13-1 packages on the Cygwin repo mirrors, this also changes: - Upgrade to 3.7.15.1 upstream - Enable a bunch of build options others wanted: column data, FTS... ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
Re: [sqlite] Bug in Cygwin SQLite: temporary table creation fails
On 12/27/12 5:04 PM, Warren Young wrote: > On 12/27/2012 17:43, Daniel Colascione wrote: >> Yep: there was recently a long thread on the Cygwin mailing list >> about which mode to use for the official sqlite3 package: > > Yeah, I know, I was there. > > (Hello from the Cygwin SQLite package maintainer.) Err, right. IIRC, I'd already posted a more abbreviated version of my analysis to that thread, so I figured the person to whom I was responding couldn't possibly have been there. :-) >> I hope you'll be able to fix this bug. > > In the end, building in Unix mode is the right thing. We just can't > safely do that right now. Right. > Until Cygwin gets the facilities that would make switching to Unix > mode a sane choice, you have to decide: > > a) Will you build SQLite in Unix mode locally, and administratively > ensure that there is no attempt to mix native Windows and Cygwin > users of a single SQLite DB? Or: > > b) Will you accept that the current impure Windows mode build has > its plusses and minuses, and accept the former happily and cope with > the latter? Yes, we have to accept the minuses we can't easily fix, but this one, we can can. Porting the Unix-mode temporary file logic to the Windows build seems workable enough. signature.asc Description: OpenPGP digital signature ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
Re: [sqlite] Bug in Cygwin SQLite: temporary table creation fails
On 12/27/2012 17:43, Daniel Colascione wrote: Yep: there was recently a long thread on the Cygwin mailing list about which mode to use for the official sqlite3 package: Yeah, I know, I was there. (Hello from the Cygwin SQLite package maintainer.) I hope you'll be able to fix this bug. In the end, building in Unix mode is the right thing. We just can't safely do that right now. Until Cygwin gets the facilities that would make switching to Unix mode a sane choice, you have to decide: a) Will you build SQLite in Unix mode locally, and administratively ensure that there is no attempt to mix native Windows and Cygwin users of a single SQLite DB? Or: b) Will you accept that the current impure Windows mode build has its plusses and minuses, and accept the former happily and cope with the latter? ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
Re: [sqlite] Bug in Cygwin SQLite: temporary table creation fails
On 12/27/12 4:39 PM, Warren Young wrote: > On 12/26/2012 22:19, Daniel Colascione wrote: >> The reason this operation fails is that SQLite cannot create a >> temporary file in "C:\Windows", > > ...unless you run as Admin, which is why you don't hear this > complaint come up more often. It's a shame that non-Administrator scenarios get so little attention in general. > Thanks for diagnosing this in any case. It's clarified some details > of what's going on for me. > >> In a Cygwin environment, SQLite should avoid GetTempPathW and instead >> use unixGetTempname to find the temporary directory, translating >> paths >> as appropriate. > > Actually, you *can* get SQLite to do that. There are two ways to > build SQLite under Cygwin, which I call "Windows mode" and "Unix > mode". The current Cygwin SQLite package builds it in Windows mode > so that Cygwin programs linked to it can interoperate with native > Windows programs also using SQLite. Yep: there was recently a long thread on the Cygwin mailing list about which mode to use for the official sqlite3 package: in the end, avoidance of database corruption when interoperating with pure Windows won over the benefits of "Unix mode", so we'll be shipping a "Windows mode" sqlite library to users. Personally, I think using "Windows mode" is the right call. Still, "Windows mode" SQLite should try to work properly in a Cygwin environment. I hope you'll be able to fix this bug. signature.asc Description: OpenPGP digital signature ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
Re: [sqlite] Bug in Cygwin SQLite: temporary table creation fails
On 12/26/2012 22:19, Daniel Colascione wrote: The reason this operation fails is that SQLite cannot create a temporary file in "C:\Windows", ...unless you run as Admin, which is why you don't hear this complaint come up more often. Thanks for diagnosing this in any case. It's clarified some details of what's going on for me. In a Cygwin environment, SQLite should avoid GetTempPathW and instead use unixGetTempname to find the temporary directory, translating paths as appropriate. Actually, you *can* get SQLite to do that. There are two ways to build SQLite under Cygwin, which I call "Windows mode" and "Unix mode". The current Cygwin SQLite package builds it in Windows mode so that Cygwin programs linked to it can interoperate with native Windows programs also using SQLite. If you rebuild SQLite in Unix mode, I think your immediate problem will be solved, but you might buy yourself a new problem along these lines: http://stackoverflow.com/questions/11007024/#11887905 As indicated in that answer, until Cygwin gets a method for selecting mandatory locking, the official Cygwin SQLite package will continue to be built in Windows mode. ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
Re: [sqlite] Bug in Cygwin SQLite: temporary table creation fails
On Wed, Dec 26, 2012 at 9:55 PM, Daniel Colascionewrote: > On 12/26/12 9:54 PM, Pavel Ivanov wrote: >> I believe you can get this functionality now by compiling SQLite code >> using cygwin compiler, not a Win32 one (and not downloading dll >> library from sqlite.org website). > > The latest sources I checked still have the bug. How do you compile it? Pavel ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
Re: [sqlite] Bug in Cygwin SQLite: temporary table creation fails
On 12/26/12 9:54 PM, Pavel Ivanov wrote: > I believe you can get this functionality now by compiling SQLite code > using cygwin compiler, not a Win32 one (and not downloading dll > library from sqlite.org website). The latest sources I checked still have the bug. signature.asc Description: OpenPGP digital signature ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
Re: [sqlite] Bug in Cygwin SQLite: temporary table creation fails
I believe you can get this functionality now by compiling SQLite code using cygwin compiler, not a Win32 one (and not downloading dll library from sqlite.org website). Pavel On Wed, Dec 26, 2012 at 9:19 PM, Daniel Colascionewrote: > Creating temporary tables fails in Cygwin SQLite: > > sqlite> CREATE TEMPORARY TABLE foo (bar INT); > Error: unable to open database file > > The reason this operation fails is that SQLite cannot create a > temporary file in "C:\Windows", which GetTempPathW reports as the > system temporary directory. GetTempPathW returns the system temporary > directory when none of the environment variables "TMP", "TEMP", and > "USERPROFILE" is set. In a typical Cygwin environment, these > environment variables are unset from the point of view of Windows > APIs: Cygwin maintains an internal, Cygwin-private environment block > and synchronizes it with the Windows environment block lazily. A > normal Cygwin process that uses SQLite has no reason to initialize its > Windows environment block. > > Programs run under strace or the debugger, however, do receive a > Windows environment block, so temporary table creation appears to work > in programs run using these tools. A user with administrative rights > can also create temporary tables, since he will be able to write to > the Windows directory. > > In a Cygwin environment, SQLite should avoid GetTempPathW and instead > use unixGetTempname to find the temporary directory, translating paths > as appropriate. > > > > > ___ > sqlite-users mailing list > sqlite-users@sqlite.org > http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users > ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
[sqlite] Bug in Cygwin SQLite: temporary table creation fails
Creating temporary tables fails in Cygwin SQLite: sqlite> CREATE TEMPORARY TABLE foo (bar INT); Error: unable to open database file The reason this operation fails is that SQLite cannot create a temporary file in "C:\Windows", which GetTempPathW reports as the system temporary directory. GetTempPathW returns the system temporary directory when none of the environment variables "TMP", "TEMP", and "USERPROFILE" is set. In a typical Cygwin environment, these environment variables are unset from the point of view of Windows APIs: Cygwin maintains an internal, Cygwin-private environment block and synchronizes it with the Windows environment block lazily. A normal Cygwin process that uses SQLite has no reason to initialize its Windows environment block. Programs run under strace or the debugger, however, do receive a Windows environment block, so temporary table creation appears to work in programs run using these tools. A user with administrative rights can also create temporary tables, since he will be able to write to the Windows directory. In a Cygwin environment, SQLite should avoid GetTempPathW and instead use unixGetTempname to find the temporary directory, translating paths as appropriate. signature.asc Description: OpenPGP digital signature ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users