View Ticket
Not logged in
Ticket UUID: 045f23be750d93c0bd91f179f39c5c829ed01bc6
Title: commit gives error "2fossil: unknown command:

<font"

Status: Fixed Type: Code_Defect
Severity: Important Priority:
Subsystem: Resolution: Fixed
Last Modified: 2009-08-01 13:00:42
Version Found In: e124881a70
Description & Comments:
Following script re-creates problem with "fossil commit" giving an error message "2fossil: unknown command: <p><font". Problem seen on both linux (CentOS 5.3) and Windows XP SP3. I was trying to get 2 repo's to automatically sync with each other.
cat > bug2.sh <<EOF
#!/bin/bash
#
# Try and set up bi-directional sync:
#   create golden.fsl
#   clone golden.fsl -> clone.fsl
#   pull  clone.fsl  -> golden.fsl
#   then add file to golden.fsl and see if added to clone.fsl
#
echo 888888888888888888888888888 OS/fossil versions
cat /etc/redhat-release
uname -a
fossil version
#
echo 888888888888888888888888888 cleanup/create test dir
rm -rf testsync
mkdir -p testsync/co
cd testsync
#
echo 888888888888888888888888888 creating golden.fsl
fossil new golden.fsl
fossil setting autosync 1 -R golden.fsl
fossil setting clearsign 0 -R golden.fsl
#
echo   888888888888888888888888888 cloning to clone.fsl
fossil clone file://golden.fsl clone.fsl
echo   888888888888888888888888888 pull clone.fsl back to golden.fsl
# fossil sync file://clone.fsl -R golden.fsl
fossil pull file://clone.fsl -R golden.fsl
#
echo   888888888888888888888888888 open golden.fsl
cd co
fossil open ../golden.fsl
echo 888888888888888888888888888 adding file.txt to golden.fsl
echo "test line 1" > file.txt
fossil add file.txt
echo   888888888888888888888888888 now commit golden.fsl
fossil commit -m "added file.txt"
echo   888888888888888888888888888 now close golden.fsl
fossil close
cd ..
EOF

Output of this script is as follows:

jgm@centos fossil$ ./bug2.sh
888888888888888888888888888 OS/fossil versions
CentOS release 5.3 (Final)
Linux centos.bitbender.org 2.6.18-128.2.1.el5xen #1 SMP Tue Jul 14 07:07:49 EDT 2009 x86_64 x86_64 x86_64 GNU/Linux
This is fossil version e124881a70 2009-07-07 14:53:58 UTC
888888888888888888888888888 cleanup/create test dir
888888888888888888888888888 creating golden.fsl
project-id: ee97b450c6e570ec745310a78445d534fe9aa095
server-id:  9f3d475997305073f33b7fc7826cbc7e241a21ad
admin-user: jgm (initial password is "292735")
888888888888888888888888888 cloning to clone.fsl
Repository cloned into clone.fsl
Rebuilding repository meta-data...
1 (100%)...
project-id: ee97b450c6e570ec745310a78445d534fe9aa095
server-id:  b37c8c01daa996368e3ca708c62f5701a14da2f4
admin-user: jgm (password is "292735")
888888888888888888888888888 pull clone.fsl back to golden.fsl
                Bytes      Cards  Artifacts     Deltas
Send:             130          1          0          0
Received:          46          2          0          0
888888888888888888888888888 open golden.fsl
888888888888888888888888888 adding file.txt to golden.fsl
ADDED  file.txt
888888888888888888888888888 now commit golden.fsl
Autosync:  file:///home/jgm/storage/workspace/fossil/testsync/co/clone.fsl
                Bytes      Cards  Artifacts     Deltas
Send:             130          1          0          0
2fossil: unknown command: <p><font
888888888888888888888888888 now close golden.fsl
fossil: there are unsaved changes in the current checkout

bharder added on 2009-07-24 03:50:43:
debugging session:
initial fail at

autosync(AUTOSYNC_PULL) at line 437 of checkin_.c
... (/me continues debugging)

...and closer still:

client_sync() at line 64, sync_.c

...and closer still:

previous to line 1139, xfer_.c
...and closer:
xfer_.c, line 979 call to http_exchange() has the recv buffer aData filled with:
< p>< font color=\"red\">repository does not exists or is in an unreadable directory: /home/bch/fossiltestings/testsync/co/clone.fsl</ font></ p>

... suggests that the exchange is looking for the fossil repo in the working directory of the checkout, not the fossil-repo's actual home.

End of investigation for now.


anonymous added on 2009-07-24 08:25:14:
Hmmmm, the bug2.sh script works as expected if "fossil pull" has the full path to clone.fsl:

jgm@centos fossil$ diff bug2.sh bug2fixed.sh
28c28
< fossil pull file://clone.fsl -R golden.fsl
---
> fossil pull file://$PWD/clone.fsl -R golden.fsl

And this little test script shows last-sync-url is set differently by "fossil pull" vs. "fossil clone":

cat > pulltest.sh <<EOF
#!/bin/bash
echo 888888888888888888888888888 cleanup/create test dir
rm -rf testsync
mkdir -p testsync/co
cd testsync
echo 888888888888888888888888888 creating golden.fsl
fossil new golden.fsl
echo   888888888888888888888888888 cloning to clone.fsl
fossil clone file://golden.fsl clone.fsl
echo   888888888888888888888888888   results in clone.fsl last-sync-url =
sqlite3 clone.fsl "SELECT value FROM config WHERE name = 'last-sync-url'"
echo   888888888888888888888888888 pull clone.fsl from testsync dir
fossil pull file://clone.fsl -R golden.fsl
echo   888888888888888888888888888   results in golden.fsl last-sync-url =
sqlite3 golden.fsl "SELECT value FROM config WHERE name = 'last-sync-url'"
echo   888888888888888888888888888 pull clone.fsl from testsync/co dir
cd co
fossil pull file://../clone.fsl -R ../golden.fsl
cd ..
echo   888888888888888888888888888   results in last-sync-url =
sqlite3 golden.fsl "SELECT value FROM config WHERE name = 'last-sync-url'"
EOF

Here's the output:

jgm@centos fossil$ ./pulltest.sh
888888888888888888888888888 cleanup/create test dir
888888888888888888888888888 creating golden.fsl
project-id: 9dbf292e1429855cd81bad75ee792e8457acc8a7
server-id:  ea887f7d879acfe81ac307418c554250e377d4ae
admin-user: jgm (initial password is "2b5812")
888888888888888888888888888 cloning to clone.fsl
Repository cloned into clone.fsl
Rebuilding repository meta-data...
1 (100%)...
project-id: 9dbf292e1429855cd81bad75ee792e8457acc8a7
server-id:  5bd16395fde4ff4b511db581ae541313f7cc93ef
admin-user: jgm (password is "2b5812")
888888888888888888888888888 results in clone.fsl last-sync-url =
file:///home/jgm/storage/workspace/fossil/testsync/golden.fsl
888888888888888888888888888 pull clone.fsl from testsync dir
                Bytes      Cards  Artifacts     Deltas
Send:             130          1          0          0
Received:          46          2          0          0
888888888888888888888888888 results in golden.fsl last-sync-url =
file://clone.fsl
888888888888888888888888888 pull clone.fsl from testsync/co dir
                Bytes      Cards  Artifacts     Deltas
Send:             130          1          0          0
Received:          46          2          0          0
888888888888888888888888888 results in golden.fsl last-sync-url =
file://../clone.fsl

Changing "fossil pull/sync/push" to set last-sync-url to the full file path just like "fossil clone" would seem to fix this problem.


bharder claiming to be bch added on 2009-07-24 15:44:19:
Regardless of the problem mechanics of finding the repo, this error report needs to be improved as well; the sub-set of html markup returned is useless. Will open seperate ticket [bad-link: ] to track this issue. New ticket 8a7a49c47d7f2 filed.


anonymous added on 2009-07-25 21:07:00:
I'm new to the code, but seems the problem is the value stored in the sqlite field last-sync-url. If you trust url_parse() to set the right g.urlCanonical value, then simply making both clone.c and sync.c store g.urlCanonical in last-sync-url would seem to fix this consistently:

[jgm@centos src]$ fossil diff
Index: src/clone.c
===================================================================
fossil diff /home/jgm/storage/workspace/fossil/work/src/clone.c
--- src/clone.c
+++ src/clone.c
@@ -56,12 +56,12 @@
     db_record_repository_filename(g.argv[3]);
     db_multi_exec(
       "REPLACE INTO config(name,value)"
       " VALUES('server-code', lower(hex(randomblob(20))));"
       "REPLACE INTO config(name,value)"
-      " VALUES('last-sync-url', 'file://%q');",
-      g.urlName
+      " VALUES('last-sync-url', '%q');",
+      g.urlCanonical
     );
     g.zLogin = db_text(0, "SELECT login FROM user WHERE cap LIKE '%%s%%'");
     if( g.zLogin==0 ){
       db_create_default_users(1);
     }
@@ -73,11 +73,11 @@
     db_record_repository_filename(g.argv[3]);
     db_initial_setup(0, 0);
     user_select();
     db_set("content-schema", CONTENT_SCHEMA, 0);
     db_set("aux-schema", AUX_SCHEMA, 0);
-    db_set("last-sync-url", g.argv[2], 0);
+    db_set("last-sync-url", g.urlCanonical, 0);
     db_multi_exec(
       "REPLACE INTO config(name,value)"
       " VALUES('server-code', lower(hex(randomblob(20))));"
     );
     url_enable_proxy(0);

Index: src/sync.c
===================================================================
fossil diff /home/jgm/storage/workspace/fossil/work/src/sync.c
--- src/sync.c
+++ src/sync.c
@@ -83,11 +83,11 @@
   if( zUrl==0 ){
     if( urlOptional ) exit(0);
     usage("URL");
   }
   url_parse(zUrl);
-  db_set("last-sync-url", zUrl, 0);
+  db_set("last-sync-url", g.urlCanonical, 0);
   user_select();
   if( g.argc==2 ){
     if( g.urlPort!=g.urlDfltPort ){
       printf("Server:    %s://%s:%d%s\n",
               g.urlProtocol, g.urlName, g.urlPort, g.urlPath);

Another possible tact is to make minimal changes and instead only change 1 line in sync.c:

[jgm@centos work2]$ fossil diff
Index: src/sync.c
===================================================================
fossil diff /home/jgm/storage/workspace/fossil/work2/src/sync.c
--- src/sync.c
+++ src/sync.c
@@ -83,11 +83,11 @@
   if( zUrl==0 ){
     if( urlOptional ) exit(0);
     usage("URL");
   }
   url_parse(zUrl);
-  db_set("last-sync-url", zUrl, 0);
+  db_set("last-sync-url", g.urlIsFile ? g.urlCanonical : zUrl, 0);
   user_select();
   if( g.argc==2 ){
     if( g.urlPort!=g.urlDfltPort ){
       printf("Server:    %s://%s:%d%s\n",
               g.urlProtocol, g.urlName, g.urlPort, g.urlPath);

Did I overlook anything?


drh added on 2009-08-01 13:00:42:
Fix by ticket 47d8fc4944c2f2bf535a89f069d6f9ce0df5b257.