Re: [fossil-users] JSON login demo: is this interface acceptable?

2011-09-16 Thread Stephan Beal
On Fri, Sep 16, 2011 at 4:18 AM, Ron Wilson ronw.m...@gmail.com wrote:

 On Wed, Sep 14, 2011 at 6:40 PM, Stephan Beal Instead of sending the
 password in plain text, you hash the password
 with a nonce received from the server. Of course, to get the nonce,
 you have to attempt to login without supplying credentials. The server
 would then respond with a payload containing the nonce to use in the
 hash.


The problem with that is that we need the hash routine for every client
language :/.

-- 
- stephan beal
http://wanderinghorse.net/home/stephan/
___
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] JSON/wiki: what info needs to be returned for...

2011-09-16 Thread Stephan Beal
On Fri, Sep 16, 2011 at 5:48 AM, Ron Wilson ronw.m...@gmail.com wrote:

 Actually, Fossil fetches wiki pages by name. Artifact Id would be used
 to fetch a specific version of a page


Sorry, i meant when we get a list of pages from the server, e.g. for
creating a  list all wiki pages page. i generally like to have more info
about each page than just the name. But it's certainly not a requirement.

-- 
- stephan beal
http://wanderinghorse.net/home/stephan/
___
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] authentication in JSON: anonymous vs. guest user

2011-09-16 Thread Stephan Beal
On Fri, Sep 16, 2011 at 5:07 AM, Ron Wilson ronw.m...@gmail.com wrote:

 A simplification on templates would be a list of fields in the desired
 order. Since most of the JSON responses would be lists of fields and
 their values, this would achieve nearly all that templates could.
 (True, some fields do have complex values, but a field list should be
 simple to implement and would be a good next step)


i've seen SOAP APIs where for some requests the user supplies the list of
fields to include or (in some cases) exclude from the result. That would
certainly be a simpler first step than implementing a template parser.

-- 
- stephan beal
http://wanderinghorse.net/home/stephan/
___
fossil-users mailing list
fossil-users@lists.fossil-scm.org
http://lists.fossil-scm.org:8080/cgi-bin/mailman/listinfo/fossil-users


[fossil-users] Windows build of json branch?

2011-09-16 Thread Stephan Beal
Hello, fellow developers,

Could i ask (beg!) one of you Windows users to try to compile the json
branch on Windows? i've introduced two new files in that branch (the
underlying JSON lib) and while i am 98% certain that all of that code is
portable C89 (it builds warning-free on tcc, clang, and gcc), there may be
an outstanding point or two where i've used a POSIX- or Unix-only construct
which needs to be reworked for portability.

i don't have Windows or i'd do this myself, of course :).

-- 
- stephan beal
http://wanderinghorse.net/home/stephan/
___
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] Has any fossil user ever experienced a SHA1 collision?

2011-09-16 Thread Michael Richter
On 15 September 2011 22:43, Ron Aaron r...@ronware.org wrote:

 On 09/15/2011 05:34 PM, Richard Hipp wrote:
  Using the birthday paradox, I calculated last year that for the
  SQLite repository, if it continues to change and evolve at the same
  rate it has for the previous 10 years, will encounter its first SHA1
  collision in approximately 3.6e20 years



 Oh, sure -- but what will you do then?


Evolve into a more responsible life form that uses SHA-1073741824,
obviously.

-- 
Perhaps people don't believe this, but throughout all of the discussions of
entering China our focus has really been what's best for the Chinese people.
It's not been about our revenue or profit or whatnot.
--Sergey Brin, demonstrating the emptiness of the don't be evil mantra.
___
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] Windows build of json branch?

2011-09-16 Thread Joe Mistachkin

Tried here (using MinGW) and got the following errors:

src/cson_amalgamation.c:3914:0: warning: ignoring #pragma warning
src/cson_amalgamation.c: In function 'cson_session_file_remove':
src/cson_amalgamation.c:5445:4: error: #error unlink not implemented for
this platform.
src/cson_amalgamation.c: In function 'cson_cgi_init':
src/cson_amalgamation.c:8410:29: error: 'SIGPIPE' undeclared (first use in
this function)
src/cson_amalgamation.c:8410:29: note: each undeclared identifier is
reported only once for each function it appears in
make: *** [wbld/cson_amalgamation.o] Error 1 

--
Joe Mistachkin

___
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] JSON login demo: is this interface acceptable?

2011-09-16 Thread Joshua Paine

On 9/15/2011 10:18 PM, Ron Wilson wrote:

For the password on GET, you could mimic what HTTP-Auth-Digest does.


AFAIK, in every programming context where you'd want to make a JSON 
request, POST is as easy to do as GET. The main reason to support GET at 
all is to make it easy for people to experiment with the API manually, 
which would be completely defeated by requiring a two-request login 
process and hashing.


--
Joshua Paine
LetterBlock: Web Applications Built With Joy
http://letterblock.com/
301-576-1920
___
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] Windows build of json branch?

2011-09-16 Thread Stephan Beal
On Fri, Sep 16, 2011 at 3:34 PM, Joe Mistachkin sql...@mistachkin.comwrote:

 src/cson_amalgamation.c:5445:4: error: #error unlink not implemented for
 this platform.


i just committed that fix before your mail arrived, thanks to a report from
Robert Engelhardt.  :)

i now use remove() in Windows mode. If that doesn't fix it, i can remove
those parts from the build because fossil doesn't use them (they're part of
the amalgamation, which is why they're there).


 src/cson_amalgamation.c: In function 'cson_cgi_init':
 src/cson_amalgamation.c:8410:29: error: 'SIGPIPE' undeclared (first use in
 this function)


Fixed and committed! Signals are now disabled if _WIN32 or _WIN64 is
defined. i might need to disable them in general to avoid screwing up signal
any handling fossil does.

Thank you, Joe!

-- 
- stephan beal
http://wanderinghorse.net/home/stephan/
___
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] Windows build of json branch?

2011-09-16 Thread Stephan Beal
2011/9/16 Robert Engelhardt m...@robert-engelhardt.de

 ...Ja, damit funktioniert es nun, und man erhält ein lauffähiges Binary :)


Translation: the windows build now works and the binary runs.

THANK YOU, Robert and Joe!

-- 
- stephan beal
http://wanderinghorse.net/home/stephan/
___
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] Windows build of json branch?

2011-09-16 Thread Richard Hipp
On Fri, Sep 16, 2011 at 9:50 AM, Stephan Beal sgb...@googlemail.com wrote:

 2011/9/16 Robert Engelhardt m...@robert-engelhardt.de

 ...Ja, damit funktioniert es nun, und man erhält ein lauffähiges Binary :)


 Translation: the windows build now works and the binary runs.

 THANK YOU, Robert and Joe!


The MinGW build works for me, but MSVC errors out.  Unresolved cson_*
symbols.  No time to debug it now - perhaps latter.

Note there are lots of fossil_* functions (fossil_unlink(), fossil_open,
etc) that provide portability between unix and windows.  It is important to
use them.  Especially fossil_open() and fossil_print().  Otherwise, the
display won't work right for people with a non-ASCII setup.




 --
 - stephan beal
 http://wanderinghorse.net/home/stephan/

 ___
 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] Windows build of json branch?

2011-09-16 Thread Stephan Beal
On Fri, Sep 16, 2011 at 4:20 PM, Richard Hipp d...@sqlite.org wrote:

 The MinGW build works for me, but MSVC errors out.  Unresolved cson_*
 symbols.  No time to debug it now - perhaps latter.


This is related to the build files, not the code. i need to figure out how
to tell makemake.tcl to include cson_amalgamation.c in the windows build.


 Note there are lots of fossil_* functions (fossil_unlink(), fossil_open,
 etc) that provide portability between unix and windows.  It is important to
 use them.  Especially fossil_open() and fossil_print().  Otherwise, the
 display won't work right for people with a non-ASCII setup.


cson_amalgamation.* includes some potentially problematic code in that
regard, but it's not used in the Fossil bits - it's only there because its
part of the amalgamation. i'll do some work on removing the pieces which
aren't used by fossil. JSON is, by definition, UTF8, and i'm hoping that
outputing raw UTF8 to a FILE handle is portable.

-- 
- stephan beal
http://wanderinghorse.net/home/stephan/
___
fossil-users mailing list
fossil-users@lists.fossil-scm.org
http://lists.fossil-scm.org:8080/cgi-bin/mailman/listinfo/fossil-users


[fossil-users] Ticket editing problems

2011-09-16 Thread Jousef Lofstrom
I have a user with limited access. The account can only handle wiki, attachments
and tickets. But I am unable to modify tickets in the web gui as no clickable
links are active.

Here is the permission string bcfjkmnrtw.

Did I miss something?

/Jousef

Fossil version 1.19 [6517b5c857] 2011-09-01 18:25:19 


___
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] Ticket editing problems

2011-09-16 Thread Stephan Beal
On Fri, Sep 16, 2011 at 4:24 PM, Jousef Lofstrom jou...@netscape.netwrote:

 Here is the permission string bcfjkmnrtw.


According to the sources, permission k==write wiki and:

if( (rid  g.perm.WrWiki) || (!rid  g.perm.NewWiki) ){
  style_submenu_element(Edit, Edit Wiki Page, %s/wikiedit?name=%T,
   g.zTop, zPageName);
}

rid is the ... whatever this is:

rid = db_int(0,
  SELECT rid FROM tagxref
   WHERE tagid=(SELECT tagid FROM tag WHERE tagname=%Q)
   ORDER BY mtime DESC, zTag
);

which i assume has a valid value for any valid tag.

i.e. this looks okay to me. Have you got the latest fossil?

In the json branch there's a way to check your permissions: do a /json/cap
request.

-- 
- stephan beal
http://wanderinghorse.net/home/stephan/
___
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] Ticket editing problems

2011-09-16 Thread Stephan Beal
On Fri, Sep 16, 2011 at 4:29 PM, Stephan Beal sgb...@googlemail.com wrote:

 On Fri, Sep 16, 2011 at 4:24 PM, Jousef Lofstrom jou...@netscape.netwrote:

 Here is the permission string bcfjkmnrtw.


 According to the sources, permission k==write wiki and:


sorry, thought-error on my part - i mis-read ticket as wiki...

-- 
- stephan beal
http://wanderinghorse.net/home/stephan/
___
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] Ticket editing problems

2011-09-16 Thread Stephan Beal
On Fri, Sep 16, 2011 at 4:30 PM, Stephan Beal sgb...@googlemail.com wrote:

 On Fri, Sep 16, 2011 at 4:29 PM, Stephan Beal sgb...@googlemail.comwrote:

 On Fri, Sep 16, 2011 at 4:24 PM, Jousef Lofstrom jou...@netscape.netwrote:

 Here is the permission string bcfjkmnrtw.


 According to the sources, permission k==write wiki and:


 sorry, thought-error on my part - i mis-read ticket as wiki...


And now for the real code:

   if( g.perm.WrTkt || g.perm.ApndTkt ){
style_submenu_element(Edit, Edit The Ticket, %s/tktedit?name=%T,
g.zTop, PD(name,));
  }

WrTkt=w, ApndTkt=c, i.e. you have all the permissions. Can you please try
with the latest trunk?


-- 
- stephan beal
http://wanderinghorse.net/home/stephan/
___
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] Windows build of json branch?

2011-09-16 Thread Richard Hipp
On Fri, Sep 16, 2011 at 10:24 AM, Stephan Beal sgb...@googlemail.comwrote:

  i'm hoping that outputing raw UTF8 to a FILE handle is portable.


If by FILE handle you mean one that is connected via TCP/IP to a client on
the other end, then yes, you should be OK.  But any input/output from the
the console will give problems.  So as long as the JSON stuff is pure
client/server you are OK.  But the minute you start doing JSON via the
command-line you'll run into trouble.


-- 
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] Windows build of json branch?

2011-09-16 Thread Stephan Beal
On Fri, Sep 16, 2011 at 4:33 PM, Richard Hipp d...@sqlite.org wrote:

 If by FILE handle you mean one that is connected via TCP/IP to a client on
 the other end, then yes, you should be OK.


g.httpOut, for example. In HTTP mode i'm using that handle. In CLI mode i'm
using stdout. For POST data i'm reading from g.httpIn (FILE*). Aside from
that, the JSON bits don't do any i/o, dealing only with strings
(ASCII/UTF8/UTF16 input and UTF8 output).


 But any input/output from the the console will give problems.  So as long
 as the JSON stuff is pure client/server you are OK.  But the minute you
 start doing JSON via the command-line you'll run into trouble.


i'll keep that in mind, thank you for the head's up. But since JSON is UTF8
by specification, i'm not sure if i can do much about that. That said, i
honestly don't expect people to use the CLI interface - it's mainly there
because it's easier to test.

-- 
- stephan beal
http://wanderinghorse.net/home/stephan/
___
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] Windows build of json branch?

2011-09-16 Thread Stephan Beal
On Fri, Sep 16, 2011 at 4:36 PM, Stephan Beal sgb...@googlemail.com wrote:

 On Fri, Sep 16, 2011 at 4:33 PM, Richard Hipp d...@sqlite.org wrote:

 If by FILE handle you mean one that is connected via TCP/IP to a client on
 the other end, then yes, you should be OK.


 g.httpOut, for example. In HTTP mode i'm using that handle. In CLI mode i'm
 using stdout. For POST data i'm reading from g.httpIn (FILE*).


On second thought, that's not entirely true - in HTTP mode i stuff the JSON
in a Blob and let cgi_reply() do the output.

-- 
- stephan beal
http://wanderinghorse.net/home/stephan/
___
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] Ticket editing problems

2011-09-16 Thread Jousef Lofstrom
Stephan Beal sgbeal@... writes:

...

I cloned http://www.fossil-scm.org/ and built on 32 bit CentOS 5 and now have 
...

Fossil version 1.19 [9f5c40cbe7] 2011-09-16 11:19:08.

Alas, with the same result.

/Jousef


___
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] Ticket editing problems

2011-09-16 Thread Stephan Beal
On Fri, Sep 16, 2011 at 4:55 PM, Jousef Lofstrom jou...@netscape.netwrote:

 Stephan Beal sgbeal@... writes:
 I cloned http://www.fossil-scm.org/ and built on 32 bit CentOS 5 and now
 have ...

 Fossil version 1.19 [9f5c40cbe7] 2011-09-16 11:19:08.

 Alas, with the same result.


i can't explain that but i have one thing we can try:

fossil co json

make

and then visit your repo with these paths:

/json/login?n=yournamep=yourpassword

the response should NOT contain the string: resultCode:...anything
If it does _not_ contain that then the login worked.

And then please try: /json/stat

and post the results of the second request. If that doesn't match up with
your permissions then maybe i can find where the disconnect is.

-- 
- stephan beal
http://wanderinghorse.net/home/stephan/
___
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] Ticket editing problems

2011-09-16 Thread Stephan Beal
On Fri, Sep 16, 2011 at 4:59 PM, Stephan Beal sgb...@googlemail.com wrote:

 And then please try: /json/stat


sorry: /json/cap
not /json/stat (that's the repo stats)

-- 
- stephan beal
http://wanderinghorse.net/home/stephan/
___
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] Ticket editing problems

2011-09-16 Thread Jousef Lofstrom
Stephan Beal sgbeal@... writes:

...

http://localhost:8080/tvo/json/login?n=usernamep=password ==

{
fossil:afd36e987ca1f2841bd2d819e64804c1f1a9f971,
timestamp:1316185867,
resultCode:FOSSIL-1002,
resultText:Unknown Command
}
HTTP/1.0 200 OK
Date: Fri, 16 Sep 2011 15:11:07 GMT
Connection: close
X-Frame-Options: SAMEORIGIN
Cache-control: no-cache, no-store
Content-Type: application/json; charset=utf-8; charset=utf-8
Content-Length: 0

http://localhost:8080/tvo/json/stat ==

{
fossil:afd36e987ca1f2841bd2d819e64804c1f1a9f971,
timestamp:1316186057,
resultCode:FOSSIL-1002,
resultText:Unknown Command
}
HTTP/1.0 200 OK
Date: Fri, 16 Sep 2011 15:14:17 GMT
Connection: close
X-Frame-Options: SAMEORIGIN
Cache-control: no-cache, no-store
Content-Type: application/json; charset=utf-8; charset=utf-8
Content-Length: 0

/Jousef


___
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] Ticket editing problems

2011-09-16 Thread Stephan Beal
On Fri, Sep 16, 2011 at 5:20 PM, Stephan Beal sgb...@googlemail.com wrote:

 aha - that's because of the /tvo part. i don't yet handle sub-repositories.
 Damn. i need to figure out how to do that (i've never used sub-repos
 before).


Doh - i'm also seeing this now without the prefix, so i've apparently broken
something horribly. i hope to have this resolved in the next hour or two.

-- 
- stephan beal
http://wanderinghorse.net/home/stephan/
___
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] Ticket editing problems

2011-09-16 Thread Stephan Beal
On Fri, Sep 16, 2011 at 5:39 PM, Stephan Beal sgb...@googlemail.com wrote:

 On Fri, Sep 16, 2011 at 5:20 PM, Stephan Beal sgb...@googlemail.comwrote:

 aha - that's because of the /tvo part. i don't yet handle
 sub-repositories. Damn. i need to figure out how to do that (i've never used
 sub-repos before).


 Doh - i'm also seeing this now without the prefix, so i've apparently
 broken something horribly. i hope to have this resolved in the next hour or
 two.


LOL! This was a usage error on my part:

~ f ui

the problem is that f is an alias for ~/bin/fossil, which isn't the binary i
want to test. When i use ./fossil ... it works as expected. i'm fixing the
/pathprefix problem right now - the current code won't dispatch properly
with that (and i'm not 100% certain it will after my fix!).

In any case, the headers are being output as part of the body (again) and
that's a bug.

-- 
- stephan beal
http://wanderinghorse.net/home/stephan/
___
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] Ticket editing problems

2011-09-16 Thread Stephan Beal
On Fri, Sep 16, 2011 at 5:51 PM, Stephan Beal sgb...@googlemail.com wrote:

 the problem is that f is an alias for ~/bin/fossil, which isn't the binary
 i want to test. When i use ./fossil ... it works as expected. i'm fixing the
 /pathprefix problem right now - the current code won't dispatch properly
 with that (and i'm not 100% certain it will after my fix!).

 In any case, the headers are being output as part of the body (again) and
 that's a bug.


The problem is that server mode isn't identical to CGI mode (i thought it
was), and thus JSON mode is misbehaving (halfway thinking it's in CLI mode).
e.g. server mode doesn't have the PATH_INFO env var, which the JSON bits
currently use to dispatch to the proper place. i'll need to replace those
bits with fossil's way of handling the path.

-- 
- stephan beal
http://wanderinghorse.net/home/stephan/
___
fossil-users mailing list
fossil-users@lists.fossil-scm.org
http://lists.fossil-scm.org:8080/cgi-bin/mailman/listinfo/fossil-users


[fossil-users] how to get path part of request in server mode?

2011-09-16 Thread Stephan Beal
Hi, all!

When fossil server is running i'm not seeing the path, query string via
getenv(). Looking at cgi_http_server() and friends, it's not clear how i can
get the path bits. i'm specifically looking for what CGI mode sets as
PATH_INFO.

-- 
- stephan beal
http://wanderinghorse.net/home/stephan/
___
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] how to get path part of request in server mode?

2011-09-16 Thread Richard Hipp
On Fri, Sep 16, 2011 at 12:12 PM, Stephan Beal sgb...@googlemail.comwrote:

 Hi, all!

 When fossil server is running i'm not seeing the path, query string via
 getenv(). Looking at cgi_http_server() and friends, it's not clear how i can
 get the path bits. i'm specifically looking for what CGI mode sets as
 PATH_INFO.


Using fossil server, the PATH_INFO should be getting set by this line:
http://www.fossil-scm.org/fossil/artifact/a133e1ba?ln=1025



 --
 - stephan beal
 http://wanderinghorse.net/home/stephan/

 ___
 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] Ticket editing problems

2011-09-16 Thread Stephan Beal
On Fri, Sep 16, 2011 at 5:18 PM, Jousef Lofstrom jou...@netscape.netwrote:

resultCode:FOSSIL-1002


That should be fixed now in server and CGI modes. The bug was in a
mismatch between server mode and CGI mode. i have added code to accommodate
the optional /prefix path part (everything up to the first instance of
json is consider a prefix), but i don't have a setup to test that with, so
there might still be an outstanding bug here. Could you please update and
try:

/json/login?n=...p=...

then /json/stat

?

-- 
- stephan beal
http://wanderinghorse.net/home/stephan/
___
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] Ticket editing problems

2011-09-16 Thread Stephan Beal
On Fri, Sep 16, 2011 at 7:28 PM, Stephan Beal sgb...@googlemail.com wrote:

 then /json/stat


i just can't get this right today: /json/cap, not /json/stat

-- 
- stephan beal
http://wanderinghorse.net/home/stephan/
___
fossil-users mailing list
fossil-users@lists.fossil-scm.org
http://lists.fossil-scm.org:8080/cgi-bin/mailman/listinfo/fossil-users


[fossil-users] fossil code style question...

2011-09-16 Thread Stephan Beal
Hi!

Which of these is more correct for fossil's code style for if/else's which
have only a single expression:

if( ... ) continue;
else break;

or

if( ... ){
  continue;
}else{
  break;
}

(hypothetical example)

The question only applies to single-expression if/else/for/while/etc. For
others it's clear.

To be clear: i'm not going to argue either way, i just want to conform.

-- 
- stephan beal
http://wanderinghorse.net/home/stephan/
___
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] fossil code style question...

2011-09-16 Thread Richard Hipp
On Fri, Sep 16, 2011 at 2:26 PM, Stephan Beal sgb...@googlemail.com wrote:

 Hi!

 Which of these is more correct for fossil's code style for if/else's which
 have only a single expression:

 if( ... ) continue;
 else break;

 or

 if( ... ){
   continue;
 }else{
   break;
 }


The second is correct.  The one with {}




 (hypothetical example)

 The question only applies to single-expression if/else/for/while/etc. For
 others it's clear.

 To be clear: i'm not going to argue either way, i just want to conform.

 --
 - stephan beal
 http://wanderinghorse.net/home/stephan/

 ___
 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] fossil code style question...

2011-09-16 Thread Martin S. Weber

On 09/16/11 14:26, Stephan Beal wrote:

To be clear: i'm not going to argue either way, i just want to conform.


Which reminds me, try building your code with either c89 as compiler or pass 
-ansi to gcc. There's still a fix necessary for fossil's sha1 computation (see 
previous thread starting at 
http://www.mail-archive.com/fossil-users@lists.fossil-scm.org/msg05772.html )


-Martin
___
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] fossil code style question...

2011-09-16 Thread Stephan Beal
On Fri, Sep 16, 2011 at 8:32 PM, Martin S. Weber martin.we...@nist.govwrote:

 Which reminds me, try building your code with either c89 as compiler or
 pass -ansi to gcc. There's still a fix necessary for fossil's sha1
 computation (see previous thread starting at http://www.mail-archive.com/*
 *fossil-users@lists.fossil-scm.**org/msg05772.htmlhttp://www.mail-archive.com/fossil-users@lists.fossil-scm.org/msg05772.html)


The core json bits (imported lib independent of fossil) are _always_ built
with -pedantic -std=c89 -Wall -Werror, so if i miss any compatibility
problems there it's gcc's fault ;). (Yes, that has happened before! gcc
allows a static const int as an array size specifier when it shouldn't is
strict mode.)

src/shell.c doesn't compile in -std=c89 mode and sqlite3.c fails in strict
c89 mode because it uses long long.

Try:

  ./configure --prefix=$HOME CFLAGS=-Wall -std=c89 -pedantic

There's a c89 incompatibility in main.c as well (and probably other places
cgi_printf() spits out large strings):

In file included from ./bld/main_.c:187:
./bld/page_index.h:471: warning: string length '762' is greater than the
length '509' ISO C90 compilers are required to support

repeated many times for different strings.

-- 
- stephan beal
http://wanderinghorse.net/home/stephan/
___
fossil-users mailing list
fossil-users@lists.fossil-scm.org
http://lists.fossil-scm.org:8080/cgi-bin/mailman/listinfo/fossil-users


[fossil-users] a fix wish for the configure guru(s)...

2011-09-16 Thread Stephan Beal
This is mostly for Steve (configure guy),

in blob.c readlink() is used, but according to my man pages (and compiler),
we need:

#define _POSIX_C_SOURCE 200112L

(or some greater value - i don't know all the legal values)

before including unistd.h (which is included in config.h).

Assuming that won't break anything else, could i ask you to add that (or
show me how) to the config.h for *nix platforms? readlink() isn't used on
Windows, so we don't need it there.

As it is now, it actually builds fine but complains about implicit
declaration (because missing _POSIX_C_SOURCE), and then just happens to link
because readlink() really is in libc. In -Werror/-pedantic modes it fails,
of course.

:-?

-- 
- stephan beal
http://wanderinghorse.net/home/stephan/
___
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] is there a fossil/sqlite3 routine to get a Unix Epoch GMT int (current time)?

2011-09-16 Thread Stephan Beal
On Fri, Sep 16, 2011 at 9:16 PM, Richard Hipp d...@sqlite.org wrote:

 db_int64(0, SELECT strftime('%%s','now'));


i forgot to mention (well, forgot period), that i'm doing this at a point
which might be called before the db is opened, e.g. to report a db-opening
error or some error which happens before the db is opened. (The timestamp is
part of the JSON response envelope.)

i've got:

cson_int_t jsTime;
time_t const t = (time_t)time(0);
struct tm gt = *gmtime(t);
gt.tm_isdst = -1;
jsTime = (cson_int_t)mktime(gt);

but i'm not 100% certain whether that's correct. i'm 95% certain, but not
100%.

-- 
- stephan beal
http://wanderinghorse.net/home/stephan/
___
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] is there a fossil/sqlite3 routine to get a Unix Epoch GMT int (current time)?

2011-09-16 Thread Richard Hipp
On Fri, Sep 16, 2011 at 3:21 PM, Stephan Beal sgb...@googlemail.com wrote:

 On Fri, Sep 16, 2011 at 9:16 PM, Richard Hipp d...@sqlite.org wrote:

 db_int64(0, SELECT strftime('%%s','now'));


 i forgot to mention (well, forgot period), that i'm doing this at a point
 which might be called before the db is opened, e.g. to report a db-opening
 error or some error which happens before the db is opened. (The timestamp is
 part of the JSON response envelope.)

 i've got:

 cson_int_t jsTime;
 time_t const t = (time_t)time(0);


time(0) should give you UTC directly.  No need to convert.



 struct tm gt = *gmtime(t);
 gt.tm_isdst = -1;
 jsTime = (cson_int_t)mktime(gt);

 but i'm not 100% certain whether that's correct. i'm 95% certain, but not
 100%.

 --
 - stephan beal
 http://wanderinghorse.net/home/stephan/

 ___
 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] is there a fossil/sqlite3 routine to get a Unix Epoch GMT int (current time)?

2011-09-16 Thread Gé Weijers



On Fri, 16 Sep 2011, Richard Hipp wrote:


time(0) should give you UTC directly.  No need to convert.


This is the common implementation, but not required by any standard. Most 
OSes do it this way, but POSIX and C99 do only require that time_t be an 
integer or real type (so it could be a double) and the epoch is not 
specified.


So if you want to write utterly portable code:

- get the time_t value
- use gmtime() to get a 'struct tm' value representing UTC
- calculate the # of seconds since 1970-01-01T00:00+0:00 from this
  representation, which except for counting leap years is simple enough.

The downside is that this code is not reentrant.

Using strftime(%s, ...) does not work either, %s is non-standard (it's 
not even part of POSIX).


Isn't writing fully portable C code wonderful?

BTW: I would not blame anyone for ignoring this issue

Gé
___
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] is there a fossil/sqlite3 routine to get a Unix Epoch GMT int (current time)?

2011-09-16 Thread Stephan Beal
On Fri, Sep 16, 2011 at 10:20 PM, Gé Weijers g...@weijers.org wrote:

 - get the time_t value
 - use gmtime() to get a 'struct tm' value representing UTC

- calculate the # of seconds since 1970-01-01T00:00+0:00 from this
  representation, which except for counting leap years is simple enough.

 The downside is that this code is not reentrant.


That's not a concern for this particular case.


 Using strftime(%s, ...) does not work either, %s is non-standard (it's
 not even part of POSIX).

 Isn't writing fully portable C code wonderful?

 BTW: I would not blame anyone for ignoring this issue


Actually, i've fought with this in another tree, and the gmtime-using code i
posted a couple mails back seems to work, but i had to google high and low
before i found the is_dst=-1 bit. i _really_ want GMT time, so i'm willing
to put in a bit of effort for it.

-- 
- stephan beal
http://wanderinghorse.net/home/stephan/
___
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] new fossil docs: is the wiki or embedded docs preferred?

2011-09-16 Thread Stephan Beal
On Fri, Sep 16, 2011 at 9:39 PM, Paul Ruizendaal p...@planet.nl wrote:

 Hmmm…

 If Fossil was created today, with the knowledge of today, would it still
 have wiki pages? Would it make Fossil a simpler, but equally powerful tool
 if it just had (web editable) embedded documentation?


Good question. When is started using fossil, two features really impressed
me: CGI and the wiki (because i document insane amounts). For me, at least,
it was one of the things that got me hooked.

-- 
- stephan beal
http://wanderinghorse.net/home/stephan/
___
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] a fix wish for the configure guru(s)...

2011-09-16 Thread Dmitry Chestnykh

 in blob.c readlink() is used, but according to my man pages (and compiler), 
 we need:
 
 #define _POSIX_C_SOURCE 200112L

Is this Linux with glibc from 2006? :-)

According to `man feature_test_macros`:

   If no feature test macros are explicitly defined, then the following 
feature
   test macros are defined by default:  _BSD_SOURCE, _SVID_SOURCE, 
_POSIX_SOURCE,
   and _POSIX_C_SOURCE=200809L (200112L in glibc versions before 2.10; 
199506L in
   glibc versions before 2.4; 199309L in glibc versions before 2.1).

--
Dmitry Chestnykh

___
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] new fossil docs: is the wiki or embedded docs preferred?

2011-09-16 Thread Dmitry Chestnykh
On Sep 16, 2011, at 9:39 PM, Paul Ruizendaal wrote:

 Hmmm…
 
 If Fossil was created today, with the knowledge of today, would it still have 
 wiki pages? Would it make Fossil a simpler, but equally powerful tool if it 
 just had (web editable) embedded documentation?

Embedded documentation is versioned along with files, so no, I don't think it 
would be better.
I, for one, wouldn't want to frequently merge my working copy with changes to 
embedded docs made from web interface. Plus, this would create unwanted forks. 
Also, having a separate wiki allows for more granular access control.

--
Dmitry Chestnykh


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


[fossil-users] JSON login/logout/permissions demo

2011-09-16 Thread Stephan Beal
Hi, all!

http://fossil.wanderinghorse.net/repos/fossil-sgb/json/

Quick demo:

1) Click the 'cap' button and note the output in the bottom textarea.

2) Enter:
User: json-demo
Password: json-demo

click the login button

3) Repeat step (1)

4) Click the logout button

5) Repeat step (1)

With that in place, we've got the hardest bits out of the way, i think.

-- 
- stephan beal
http://wanderinghorse.net/home/stephan/
___
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] is there a fossil/sqlite3 routine to get a Unix Epoch GMT int (current time)?

2011-09-16 Thread Gé Weijers

Stephan,

'mktime' converts localtime, it's not designed to do what you want it to 
do. Setting is_dst just sets the assumption about whether DST is in 
effect. Setting it to -1 makes the routine look it up. I don't know what 
happens in that one 'ambiguous' hour each year.


   http://pubs.opengroup.org/onlinepubs/7908799/xsh/mktime.html

(FreeBSD added a 'timegm' routine to their library, but it's not 
portable.)


This may work:

long UnixTime(time_t now)
{
 struct tm *p = gmtime(now);
 int y = p-tm_year+1900;
 long days = 365l * y + y/4 - y/100 + y/400 + p-tm_yday - 719527l;
 return (((days*24) + p-tm_hour) * 60 + p-tm_min) * 60 + p-tm_sec;
}

There's an alternative formula here:

http://pubs.opengroup.org/onlinepubs/007904875/basedefs/xbd_chap04.html#tag_04_14

long UnixTime(time_t now)
{
 struct tm *p = gmtime(now);
 return p-tm_sec + p-tm_min*60l + p-tm_hour*3600l + p-tm_yday*86400l
  + (p-tm_year-70)*31536000l + ((p-tm_year-69)/4)*86400l
  - ((p-tm_year-1)/100)*86400l + ((p-tm_year+299)/400)*86400l;
}


Gé___
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] is there a fossil/sqlite3 routine to get a Unix Epoch GMT int (current time)?

2011-09-16 Thread Stephan Beal
On Sat, Sep 17, 2011 at 12:25 AM, Gé Weijers g...@weijers.org wrote:

 'mktime' converts localtime, it's not designed to do what you want it to
 do. Setting is_dst just sets the assumption about


i was always under the impression (apparently wrong) that time() returned
localtime. My man pages say seconds since the epoch but does not specify a
TZ, so i guess i always assumed local.

whether DST is in effect. Setting it to -1 makes the routine look it up.


That was my understanding.


 I don't know what happens in that one 'ambiguous' hour each year.

   
 http://pubs.opengroup.org/**onlinepubs/7908799/xsh/mktime.**htmlhttp://pubs.opengroup.org/onlinepubs/7908799/xsh/mktime.html


i'm not much worried about an off-by-1-day for 60 minutes a year. :)

This may work:


Thank you! i'll give those a try.


-- 
- stephan beal
http://wanderinghorse.net/home/stephan/
___
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] is there a fossil/sqlite3 routine to get a Unix Epoch GMT int (current time)?

2011-09-16 Thread Stephan Beal
On Sat, Sep 17, 2011 at 12:25 AM, Gé Weijers g...@weijers.org wrote:

 long UnixTime(time_t now)
 {
 struct tm *p = gmtime(now);


but now the question: if time(0) returns time in either GMT or local TZ, how
can i know which value to pass to UnixTime()?

-- 
- stephan beal
http://wanderinghorse.net/home/stephan/
___
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] is there a fossil/sqlite3 routine to get a Unix Epoch GMT int (current time)?

2011-09-16 Thread Gé Weijers


time(0) returns the current time in whatever representation your system 
uses. 'gmtime' is supposed to be able to convert whatever the system uses 
into a representation based on UTC. So UnixTime(time(0)) will return the 
number of seconds passed since 1970-01-01T00:00+0:00 (the Unix epoch).


That's assuming your clock's in sync :-).

BTW: look at mkgmtime in cgi.c. The assumption that time_t is seconds 
after the Unix Epoch is assumed there. Trying to write a fully portable 
implementation of that thing will only give you grief.


You should probably ignore all my rambling and directly use the result of 
time(0). It doubt there's a system out there that can compile Fossil _and_ 
uses a different representation of time.


Gé

On Sat, 17 Sep 2011, Stephan Beal wrote:


On Sat, Sep 17, 2011 at 12:25 AM, Gé Weijers g...@weijers.org wrote:
  long UnixTime(time_t now)
  {
      struct tm *p = gmtime(now);


but now the question: if time(0) returns time in either GMT or local TZ, how 
can i know which value to pass to UnixTime()?

--
- stephan beal
http://wanderinghorse.net/home/stephan/

___
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] is there a fossil/sqlite3 routine to get a Unix Epoch GMT int (current time)?

2011-09-16 Thread Stephan Beal
On Sat, Sep 17, 2011 at 2:47 AM, Gé Weijers g...@weijers.org wrote:

 BTW: look at mkgmtime in cgi.c. The assumption that time_t is seconds after
 the Unix Epoch is assumed there. Trying to write a fully portable
 implementation of that thing will only give you grief.



That mkgmtime() requires a populated (tm *), which is what i don't have
until i call gmtime() (at which point i have everything i need).



 You should probably ignore all my rambling and directly use the result of
 time(0).


Nonetheless, you have enlightened me a great deal on the topic. Thank you
:). i'm going to try simply using time(0) and see if that does what i want.

-- 
- stephan beal
http://wanderinghorse.net/home/stephan/
___
fossil-users mailing list
fossil-users@lists.fossil-scm.org
http://lists.fossil-scm.org:8080/cgi-bin/mailman/listinfo/fossil-users