[fossil-users] SQLite pointer misuse in head?

2014-10-30 Thread Warren Young
I just updated my Fossil server from version [e061a675e6] 2014-09-26 21:02:03 
to the tip of trunk, as of a few minutes ago.  On restarting “fossil server”, I 
got these complaints:

SQLITE_MISUSE: API call with NULL database connection pointer
SQLITE_MISUSE: misuse at line 103842 of [83afe23e55]
SQLITE_MISUSE: API call with NULL database connection pointer
SQLITE_MISUSE: misuse at line 103842 of [83afe23e55]

I reverted my tree, restarted, and the error doesn’t recur.
___
fossil-users mailing list
fossil-users@lists.fossil-scm.org
http://lists.fossil-scm.org:8080/cgi-bin/mailman/listinfo/fossil-users


Re: [fossil-users] SQLite pointer misuse in head?

2014-10-30 Thread James Turner
Did you remember to run fossil rebuild?

On Thu, Oct 30, 2014 at 12:53:54PM -0600, Warren Young wrote:
 I just updated my Fossil server from version [e061a675e6] 2014-09-26 21:02:03 
 to the tip of trunk, as of a few minutes ago.  On restarting “fossil server”, 
 I got these complaints:
 
 SQLITE_MISUSE: API call with NULL database connection pointer
 SQLITE_MISUSE: misuse at line 103842 of [83afe23e55]
 SQLITE_MISUSE: API call with NULL database connection pointer
 SQLITE_MISUSE: misuse at line 103842 of [83afe23e55]
 
 I reverted my tree, restarted, and the error doesn’t recur.
 ___
 fossil-users mailing list
 fossil-users@lists.fossil-scm.org
 http://lists.fossil-scm.org:8080/cgi-bin/mailman/listinfo/fossil-users

-- 
James Turner
___
fossil-users mailing list
fossil-users@lists.fossil-scm.org
http://lists.fossil-scm.org:8080/cgi-bin/mailman/listinfo/fossil-users


Re: [fossil-users] SQLite pointer misuse in head?

2014-10-30 Thread Richard Hipp
On Thu, Oct 30, 2014 at 2:53 PM, Warren Young war...@etr-usa.com wrote:

 I just updated my Fossil server from version [e061a675e6] 2014-09-26
 21:02:03 to the tip of trunk, as of a few minutes ago.  On restarting
 “fossil server”, I got these complaints:

 SQLITE_MISUSE: API call with NULL database connection pointer
 SQLITE_MISUSE: misuse at line 103842 of [83afe23e55]
 SQLITE_MISUSE: API call with NULL database connection pointer
 SQLITE_MISUSE: misuse at line 103842 of [83afe23e55]

 I reverted my tree, restarted, and the error doesn’t recur.


It seems to be working fine for me.  Do you have any other hints on how I
might reproduce the problem?

-- 
D. Richard Hipp
d...@sqlite.org
___
fossil-users mailing list
fossil-users@lists.fossil-scm.org
http://lists.fossil-scm.org:8080/cgi-bin/mailman/listinfo/fossil-users


Re: [fossil-users] SQLite pointer misuse in head?

2014-10-30 Thread B Harder
I got same error msg on first web request, and then hit reload and it
worked fine.

-bch

On 10/30/14, Richard Hipp d...@sqlite.org wrote:
 On Thu, Oct 30, 2014 at 2:53 PM, Warren Young war...@etr-usa.com wrote:

 I just updated my Fossil server from version [e061a675e6] 2014-09-26
 21:02:03 to the tip of trunk, as of a few minutes ago.  On restarting
 fossil server, I got these complaints:

 SQLITE_MISUSE: API call with NULL database connection pointer
 SQLITE_MISUSE: misuse at line 103842 of [83afe23e55]
 SQLITE_MISUSE: API call with NULL database connection pointer
 SQLITE_MISUSE: misuse at line 103842 of [83afe23e55]

 I reverted my tree, restarted, and the error doesn't recur.


 It seems to be working fine for me.  Do you have any other hints on how I
 might reproduce the problem?

 --
 D. Richard Hipp
 d...@sqlite.org

___
fossil-users mailing list
fossil-users@lists.fossil-scm.org
http://lists.fossil-scm.org:8080/cgi-bin/mailman/listinfo/fossil-users


Re: [fossil-users] SQLite pointer misuse in head?

2014-10-30 Thread Warren Young
On Oct 30, 2014, at 12:57 PM, James Turner ja...@calminferno.net wrote:

 Did you remember to run fossil rebuild?

Fossil doesn’t diagnose DB schema mismatches itself?  Subversion does.

Anyway, no, that didn’t help.
___
fossil-users mailing list
fossil-users@lists.fossil-scm.org
http://lists.fossil-scm.org:8080/cgi-bin/mailman/listinfo/fossil-users


Re: [fossil-users] SQLite pointer misuse in head?

2014-10-30 Thread Richard Hipp
If you cannot tell me how to reproduce the problem, can you catch Fossil in
a debugger when it emits the message and send me a stack trace?

On Thu, Oct 30, 2014 at 5:21 PM, Warren Young war...@etr-usa.com wrote:

 On Oct 30, 2014, at 12:57 PM, James Turner ja...@calminferno.net wrote:

  Did you remember to run fossil rebuild?

 Fossil doesn’t diagnose DB schema mismatches itself?  Subversion does.

 Anyway, no, that didn’t help.
 ___
 fossil-users mailing list
 fossil-users@lists.fossil-scm.org
 http://lists.fossil-scm.org:8080/cgi-bin/mailman/listinfo/fossil-users




-- 
D. Richard Hipp
d...@sqlite.org
___
fossil-users mailing list
fossil-users@lists.fossil-scm.org
http://lists.fossil-scm.org:8080/cgi-bin/mailman/listinfo/fossil-users


Re: [fossil-users] SQLite pointer misuse in head?

2014-10-30 Thread Warren Young
On Oct 30, 2014, at 12:58 PM, Richard Hipp d...@sqlite.org wrote:

 On Thu, Oct 30, 2014 at 2:53 PM, Warren Young war...@etr-usa.com wrote:
 
 SQLITE_MISUSE: API call with NULL database connection pointer
 
 It seems to be working fine for me.  Do you have any other hints on how I 
 might reproduce the problem?

These are ancient, large trees.  The oldest goes back 15 years, and has gone 
through four SCM transitions.  (CVS - SVN - Git (only for svn2fossil) - 
Fossil)

Here’s the command I’m running:

fossil server -P 3691 /museum

The museum is where I keep my fossils.  Port 3691 is svnserve + 1.

Here’s the backtrace you wanted:


(gdb) break sqlite3.c:103842   
Breakpoint 1 at 0x4dcc85: file ./src/sqlite3.c, line 103842.
(gdb) run
warning: no loadable sections found in added symbol-file system-supplied DSO at 
0x2aaab000
SQLITE_MISUSE: API call with NULL database connection pointer

Breakpoint 1, sqlite3LockAndPrepare (db=value optimized out, zSql=0x7a0620 
INSERT INTO config(name,value,mtime) VALUES('server-code', 
lower(hex(randomblob(20))),now());, nBytes=-1, saveSqlFlag=1, pOld=0x0, 
ppStmt=value optimized out, pzTail=0x7fffe508) at ./src/sqlite3.c:103842
103842  return SQLITE_MISUSE_BKPT;
(gdb) bt
#0  sqlite3LockAndPrepare (db=value optimized out, zSql=0x7a0620 INSERT INTO 
config(name,value,mtime) VALUES('server-code', 
lower(hex(randomblob(20))),now());, nBytes=-1, saveSqlFlag=1, pOld=0x0, 
ppStmt=value optimized out, pzTail=0x7fffe508) at ./src/sqlite3.c:103842
#1  0x004dcec8 in sqlite3_prepare_v2 (db=0x350bf549e0, zSql=0x0, 
nBytes=0, ppStmt=0x7a0770, pzTail=value optimized out) at 
./src/sqlite3.c:103922
#2  0x0041b819 in db_multi_exec (zSql=0x500e50 INSERT INTO 
config(name,value,mtime) VALUES('server-code', 
lower(hex(randomblob(20))),now());) at ./src/db.c:508
#3  0x0041c847 in db_setup_server_and_project_codes (optional=value 
optimized out) at ./src/db.c:1335
#4  0x0043d288 in cmd_webserver () at ./src/main.c:2206
#5  0x0043ec6a in main (argc=value optimized out, argv=0x5) at 
./src/main.c:757


That is with “./configure --fossil-debug” because I thought that would fix the 
“value optimized out” problem.  It didn’t.


Here’s the tail end of running strace on that command:


open(/proc/mounts, O_RDONLY)  = 3
fstat(3, {st_mode=S_IFREG|0444, st_size=0, ...}) = 0
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 
0x2afc3b683000
read(3, rootfs / rootfs rw 0 0\n/dev/root..., 1024) = 1024
read(3, etc/auto.misc /misc autofs rw,fd..., 1024) = 179
read(3, , 1024)   = 0
close(3)= 0
munmap(0x2afc3b683000, 4096)= 0
getrusage(RUSAGE_SELF, {ru_utime={0, 0}, ru_stime={0, 3999}, ...}) = 0
fcntl(2, F_GETFL)   = 0x8002 (flags O_RDWR|O_LARGEFILE)
stat(/museum, {st_mode=S_IFDIR|0775, st_size=4096, ...}) = 0
write(2, SQLITE_MISUSE: API call with NUL..., 62SQLITE_MISUSE: API call with 
NULL database connection pointer
) = 62
write(2, SQLITE_MISUSE: misuse at line 10..., 53SQLITE_MISUSE: misuse at line 
103842 of [83afe23e55]
) = 53
write(2, SQLITE_MISUSE: API call with NUL..., 62SQLITE_MISUSE: API call with 
NULL database connection pointer
) = 62
write(2, SQLITE_MISUSE: misuse at line 10..., 53SQLITE_MISUSE: misuse at line 
103842 of [83afe23e55]
) = 53
socket(PF_INET, SOCK_STREAM, IPPROTO_IP) = 3
setsockopt(3, SOL_SOCKET, SO_REUSEADDR, [1], 4) = 0
bind(3, {sa_family=AF_INET, sin_port=htons(3691), 
sin_addr=inet_addr(0.0.0.0)}, 16) = 0
listen(3, 10)   = 0
fstat(1, {st_mode=S_IFREG|0664, st_size=0, ...}) = 0
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 
0x2afc3b683000
write(1, Listening for HTTP requests on T..., 45) = 45
select(4, [3], NULL, NULL, {60, 0} unfinished …


I chose to start with the open(“proc/mounts”) call only because it’s the first 
thing I saw that struck me as odd.  I don’t know why Fossil or SQLite cares 
about my mount table.
___
fossil-users mailing list
fossil-users@lists.fossil-scm.org
http://lists.fossil-scm.org:8080/cgi-bin/mailman/listinfo/fossil-users


Re: [fossil-users] SQLite pointer misuse in head?

2014-10-30 Thread Warren Young
On Oct 30, 2014, at 4:08 PM, Richard Hipp d...@sqlite.org wrote:

 Thank you.  That was the hint I needed.  The fix is now checked in.

Confirmed.  Thanks!

So, how about that “fossil rebuild” tip?  Is it really needed prophylactically 
on every Fossil trunk pull-and-rebuild, or will Fossil diagnose the condition 
for me?
___
fossil-users mailing list
fossil-users@lists.fossil-scm.org
http://lists.fossil-scm.org:8080/cgi-bin/mailman/listinfo/fossil-users


Re: [fossil-users] SQLite pointer misuse in head?

2014-10-30 Thread Richard Hipp
On Thu, Oct 30, 2014 at 7:45 PM, Warren Young war...@etr-usa.com wrote:


 So, how about that “fossil rebuild” tip?  Is it really needed
 prophylactically on every Fossil trunk pull-and-rebuild, or will Fossil
 diagnose the condition for me?


It was a good idea to run rebuild in the early days (circa 2008) but
lately, I think the subroutine at
https://www.fossil-scm.org/fossil/artifact/eb8403b26667?ln=1134-1150 will
take care of letting you know if a rebuild is needed.  And, the schema has
been stable for years now, so even without the db_verify_schema() call you
could usually get away without running rebuild.

-- 
D. Richard Hipp
d...@sqlite.org
___
fossil-users mailing list
fossil-users@lists.fossil-scm.org
http://lists.fossil-scm.org:8080/cgi-bin/mailman/listinfo/fossil-users


[fossil-users] proposed patch: symlinks appear as regular files even when allow-symlinks is on

2014-10-30 Thread Eric Rubin-Smith
Even when I have the versionable 'allow-symlinks' setting on, 'fossil open'
initially creates symlinks as regular files (as if 
.fossil-settings/allow-symlinks did not exist or were set to 'off').

I have to first delete the symlink files and then run 'fossil update'
in order for the setting to take effect and give me proper symlinks.

'TRANSCRIPT - BEFORE' below shows how to see the issue from scratch.

This causes trouble when new developers create sandboxes for the first time, 
especially in large repositories with lots of symlinks.

This is because g.allowSymlinks is false within file.c:symlink_create() 
during the 'fossil open' command.  This in turn is because Fossil doesn't
discover the existence of the file .fossil-settings/allow-symlinks until
after it has cached the false value.

I humbly submit a simple patch (against today's trunk) that I think 
remedies the issue.  'TRANSCRIPT - AFTER' shows the behavior after the 
patch.

PATCH

[miami:src] $ fossil diff
Index: src/vfile.c
==
--- src/vfile.c
+++ src/vfile.c
@@ -268,21 +268,29 @@
   int promptFlag /* Prompt user to confirm overwrites */
 ){
   Stmt q;
   Blob content;
   int nRepos = strlen(g.zLocalRoot);
+  char bSawSymlinkSetting = 0;
 
+  /* In order to properly write out symlinks rather than regular files,
+  ** we must first observe the .fossil-settings/allow-symlinks file if it
+  ** exists.  If it does, we want to make sure we see it prior to any
+  ** symlink files.  This is why we sort ascending by 'islink'.
+  */
   if( vid0  id==0 ){
 db_prepare(q, SELECT id, %Q || pathname, mrid, isexe, islink
  FROM vfile
-WHERE vid=%d AND mrid0,
+WHERE vid=%d AND mrid0
+ORDER BY islink ASC,
g.zLocalRoot, vid);
   }else{
 assert( vid==0  id0 );
 db_prepare(q, SELECT id, %Q || pathname, mrid, isexe, islink
  FROM vfile
-WHERE id=%d AND mrid0,
+WHERE id=%d AND mrid0
+ORDER BY islink ASC,
g.zLocalRoot, id);
   }
   while( db_step(q)==SQLITE_ROW ){
 int id, rid, isExe, isLink;
 const char *zName;
@@ -291,10 +299,21 @@
 zName = db_column_text(q, 1);
 rid = db_column_int(q, 2);
 isExe = db_column_int(q, 3);
 isLink = db_column_int(q, 4);
 content_get(rid, content);
+if( !bSawSymlinkSetting 
+zName[nRepos]=='.'  zName[nRepos+1]=='f'  zName[nRepos+2]=='o' 
+strcmp(zName[nRepos], .fossil-settings/allow-symlinks)==0
+){
+  bSawSymlinkSetting = 1;
+  char zValue[4] = {0,0,0,0};
+  int i;
+  snprintf(zValue, sizeof(zValue), %s, blob_str(content));
+  for (i=3;i=1;--i) {if (zValue[i]=='\n') {zValue[i]=0; break;}}
+  g.allowSymlinks = is_truth(zValue);
+}
 if( file_is_the_same(content, zName) ){
   blob_reset(content);
   if( file_wd_setexe(zName, isExe) ){
 db_multi_exec(UPDATE vfile SET mtime=%lld WHERE id=%d,
   file_wd_mtime(zName), id);

TRANSCRIPT - BEFORE

[miami:fstest] $ fossil new
Usage: fossil new REPOSITORY-NAME
[miami:fstest] $ fossil new test
project-id: 981a44330154ce354fc1407af51b2ccaaacf1440
server-id:  71ac17e7234eee4a388e3c8321ce5bc8e698e966
admin-user: eas (initial password is 72f66b)
[miami:fstest] $ mkdir sandbox1
[miami:fstest] $ cd !$
cd sandbox1
[miami:sandbox1] $ fossil open ../test
project-name: unnamed
repository:   /home/eas/tmp/fstest/sandbox1/../test
local-root:   /home/eas/tmp/fstest/sandbox1/
config-db:/home/eas/.fossil
project-code: 981a44330154ce354fc1407af51b2ccaaacf1440
checkout: c8b4245419520d30cc360295cfa22d28c814e586 2014-10-31 00:24:42 UTC
leaf: open
tags: trunk
comment:  initial empty check-in (user: eas)
checkins: 1
[miami:sandbox1] $ a
[miami:sandbox1] $ ln -s a b
[miami:sandbox1] $ ls
a  b@
[miami:sandbox2] $ ls -l
total 0
-rw-r--r--. 1 eas eas 0 Oct 30 20:25 a
lrwxrwxrwx. 1 eas eas 1 Oct 30 20:26 b - a
[miami:sandbox1] $ mkdir .fossil-settings
[miami:sandbox1] $ echo on  .fossil-settings/allow-symlinks
[miami:sandbox1] $ fossil add .fossil-settings/allow-symlinks a b
ADDED  .fossil-settings/allow-symlinks
ADDED  a
ADDED  b
[miami:sandbox1] $ fossil commit -m Test
New_Version: 3aee795224e735d8b6c08f3bcd10c8acf98b15c0
[miami:sandbox1] $ cd ..
[miami:fstest] $ mkdir sandbox2
[miami:fstest] $ cd sandbox2
[miami:sandbox2] $ fossil open ../test 
.fossil-settings/allow-symlinks
a
b
project-name: unnamed
repository:   /home/eas/tmp/fstest/sandbox2/../test
local-root:   /home/eas/tmp/fstest/sandbox2/
config-db:/home/eas/.fossil
project-code: 981a44330154ce354fc1407af51b2ccaaacf1440
checkout: 3aee795224e735d8b6c08f3bcd10c8acf98b15c0 2014-10-31 00:25:31 UTC
parent:   c8b4245419520d30cc360295cfa22d28c814e586 2014-10-31 00:24:42 UTC
leaf: open
tags: trunk
comment:  

Re: [fossil-users] proposed patch: symlinks appear as regular files even when allow-symlinks is on

2014-10-30 Thread David Mason
Excellent!  I reported on the bug here some time ago, but didn't
provide a fix.  I hope this gets into trunk soon.

../Dave
___
fossil-users mailing list
fossil-users@lists.fossil-scm.org
http://lists.fossil-scm.org:8080/cgi-bin/mailman/listinfo/fossil-users