Re: [fossil-users] "fossil http" doubts

2017-06-08 Thread Stephan Beal
On Thu, Jun 8, 2017 at 10:43 PM, Ross Berteig  wrote:

> For building tools to generally interact with a repo, take a look at the
> JSON support. It's (still) not compiled in by default, but builds easily if
> requested by ./configure --json.


Trivia: the reason it's not compiled in by default is the lack of test
coverage. Richard told me, way back when (2012, maybe?), that we could
enable it if it had complete test coverage, including fuzz tests (making
sure that random/garbage inputs/attacks don't break the repo, allow DoS,
butter-overrun attacks, and similar). i  never got around to doing
that  and am now physically incapable of doing so. Thus... if it's
going to happen, someone else will have to do it :/.

-- 
- stephan beal
http://wanderinghorse.net/home/stephan/
"Freedom is sloppy. But since tyranny's the only guaranteed byproduct of
those who insist on a perfect world, freedom will have to do." -- Bigby Wolf
___
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] Improvements to the /reports page

2017-06-08 Thread Andy Bradford
Thus said Roy Keene on Wed, 07 Jun 2017 10:45:27 -0500:

> I would benefit  from some improvements to the /reports  page, such as
> the ability  to restrict the dates  upon which are being  reported and
> the ability to restrict the report to certain tags.

That  sounds like  it would  be useful  to others.  Currently, the  only
report that allows restricting the date  is the By Week report. It looks
like this  particular change  would also restrict  all results  by those
boundaries.

It looks like if I give it an  endpoint (a or b) that doesn't resolve to
something it defaults to returning the entire range of data. Intended?

I don't see why improvements would  not be merged, though you might find
more interest in such changes on the fossil-users mailing list.

Andy
-- 
TAI64 timestamp: 4000593a0e76


___
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 http" doubts

2017-06-08 Thread Ross Berteig



On 6/7/2017 6:42 AM, Johan Kuuse wrote:

Thanks for the input.
"fossil test-http" did the trick:

webpage=/setup
printf "GET $webpage HTTP/1.0\n\n" | fossil test-http

My purposes for parsing the built-in web pages are basically two:

1. I want to hack the Fossil code:
 a. I parse and save the HTML from the builtin pages (excluding
pages where the output makes no sense, for example /zip)
 b. I modify the source code (related to one or more web pages)
 c. I parse the same pages again to check that I have changed only
the web page output I intended to change. A kind of self test before
committing.

This WoW is obviously only helpful for a developer changing the Fossil
source code of one single (official) commit.
It does not make sense to save the output for later use and compare it
between commits, as the content/structure may change.


Take a look at the test harness in the test folder of the repository. 
It's in Tcl, and has pretty good coverage of the internals despite a 
lack of dedicated test developers. Most of the tests drive the CLI. Even 
the tests for fossil json largely drive the CLI instead of /json URLs 
via HTTP, but there are examples in there.


Naturally, I'd love to see the test suite expand to further coverage of 
the web face. So if you have thoughts about that, chime in here, or on 
the fossil-dev list where chatter about things like test harnesses won't 
distract the end users.


For building tools to generally interact with a repo, take a look at the 
JSON support. It's (still) not compiled in by default, but builds easily 
if requested by ./configure --json.



2. I want to validate the web pages: Validate the HTML, check for
broken links, etc, using for example the W3C validation tools.

This kind of validation could be used both to find existing, and to
avoid introducing new invalid HTML.
Could possibly be useful both for programmers and for skin-makers.


A test case that validates all of the HTML output would be great. That 
should be content agnostic, of course, so that it can be maintained 
without requiring a lot of work for new versions.



--
Ross Berteig   r...@cheshireeng.com
Cheshire Engineering Corp.   http://www.CheshireEng.com/
+1 626 303 1602

___
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] Patch for setup.c - Was: "fossil http" doubts

2017-06-08 Thread Richard Hipp
Thanks.  Alternative fix checked in.

On 6/8/17, Johan Kuuse  wrote:
> Found another one in tkt.c
>
> BR,
> Johan
>
> On Thu, Jun 8, 2017 at 7:10 PM, Richard Hipp  wrote:
>> On 6/8/17, Johan Kuuse  wrote:
>>> Hi,
>>>
>>> Playing around with 'fossil test-http' I found an error in the
>>> /setup_adunit output.
>>> Patch attached,
>>>
>>
>> Good catch.  Fix is checked in.
>> --
>> D. Richard Hipp
>> d...@sqlite.org
>


-- 
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] Patch for setup.c - Was: "fossil http" doubts

2017-06-08 Thread Johan Kuuse
Found another one in tkt.c

BR,
Johan

On Thu, Jun 8, 2017 at 7:10 PM, Richard Hipp  wrote:
> On 6/8/17, Johan Kuuse  wrote:
>> Hi,
>>
>> Playing around with 'fossil test-http' I found an error in the
>> /setup_adunit output.
>> Patch attached,
>>
>
> Good catch.  Fix is checked in.
> --
> D. Richard Hipp
> d...@sqlite.org
Index: src/tkt.c
==
--- src/tkt.c
+++ src/tkt.c
@@ -749,18 +749,18 @@
 cgi_redirectf("tktview?name=%T", zName);
   }
   style_header("Edit Ticket");
   if( zName==0 || (nName = strlen(zName))<4 || nName>UUID_SIZE
   || !validate16(zName,nName) ){
-@ Not a valid ticket id: \"%h(zName)\"
+@ Not a valid ticket id: %h(zName)
 style_footer();
 return;
   }
   nRec = db_int(0, "SELECT count(*) FROM ticket WHERE tkt_uuid GLOB '%q*'",
 zName);
   if( nRec==0 ){
-@ No such ticket: \"%h(zName)\"
+@ No such ticket: %h(zName)
 style_footer();
 return;
   }
   if( nRec>1 ){
 @ %d(nRec) tickets begin with:

___
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] Patch for setup.c - Was: "fossil http" doubts

2017-06-08 Thread Richard Hipp
On 6/8/17, Johan Kuuse  wrote:
> Hi,
>
> Playing around with 'fossil test-http' I found an error in the
> /setup_adunit output.
> Patch attached,
>

Good catch.  Fix is checked in.
-- 
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] Patch for setup.c - Was: "fossil http" doubts

2017-06-08 Thread Johan Kuuse
Hi,

Playing around with 'fossil test-http' I found an error in the
/setup_adunit output.
Patch attached,

BR,
Johan

On Wed, Jun 7, 2017 at 4:16 PM, Johan Kuuse  wrote:
> On Wed, Jun 7, 2017 at 3:50 PM, Warren Young  wrote:
>> On Jun 7, 2017, at 7:42 AM, Johan Kuuse  wrote:
>>>
>>> 2. I want to validate the web pages: Validate the HTML, check for
>>> broken links, etc, using for example the W3C validation tools.
>>
>> If you’re using something like curl or wget to pull the web pages, there’s 
>> typically a way to set up a “cookie jar” so that you can log in with one 
>> HTTP request, then make the remaining HTTP requests as that user, with the 
>> HTTP client automatically sending the necessary session cookie.
>
>
> Thanks for the suggestion, but I wanted to avoid both a running web
> server and the cookie jar setup.
> "fossil test-http" made my day.
> Get the HTML (including the HTTP Response header) from all Fossil
> built-in web pages, using the output from 'fossil help -w' as a list:
>
> mkdir -p fhtml && for w in `fossil help -w | xargs printf "%s\n"`; do
> printf "GET $w HTTP/1.0\n\n" | fossil test-http > fhtml/${w}.html;done
>
> BR,
> Johan
Index: src/setup.c
==
--- src/setup.c
+++ src/setup.c
@@ -1723,11 +1723,11 @@
   @ If the "Right-Column Ad-Unit" is blank, the "Banner Ad-Unit" is used on all pages.
   @ Suggested CSS changes:
   @ 
   @ div.adunit_banner {
   @   margin: auto;
-  @   width: 100%;
+  @   width: 100%%;
   @ }
   @ div.adunit_right {
   @   float: right;
   @ }
   @ div.adunit_right_container {

___
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] Bug? fossil_strndup is not added terminating null byte ('\0')

2017-06-08 Thread Richard Hipp
On 6/8/17, kowlsd3pw...@yahoo.co.jp  wrote:
>
>
> strndup is added terminating null byte.
> but Fossil_strndup behaves as strncpy.
> fossil_strndup not added terminating null byte ('\0') when len>=0

Good catch.  That is only used in one place in the code, but it is
significant.  A fix has been checked in.

-- 
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] Bug? fossil_strndup is not added terminating null byte ('\0')

2017-06-08 Thread kowlsd3pw23s


strndup is added terminating null byte.
but Fossil_strndup behaves as strncpy.
fossil_strndup not added terminating null byte ('\0') when len>=0

src/import.c : fossil_strndup
https://www.fossil-scm.org/index.html/artifact?ln=91=14ebf8376b92b944
    z[n] = '\0';


test code  

Insert the code somewhere in src/*.c and recompile.

make clean && make
./fossil test-fossil_strndup

result 
strlen(fossil_strndup("0123456789", 0)) : 2
assertion "strlen(p)==i" failed:

test code  

/*
** COMMAND: test-fossil_strndup
**
** Help text goes here.
*/
void test_fossil_strndup_cmd(void){
  for(int i=0; i<=5; i++){
    char *p = fossil_strndup("0123456789", i);
    if (strlen(p)!=i)
  printf("strlen(fossil_strndup(\"0123456789\", %d)) : %d\n",i,strlen(p));
    assert(strlen(p)==i);
    free(p);
  }
  printf("ok\n");
}___
fossil-users mailing list
fossil-users@lists.fossil-scm.org
http://lists.fossil-scm.org:8080/cgi-bin/mailman/listinfo/fossil-users