mailing list of musl libc
 help / color / mirror / code / Atom feed
* Simple testing task - string functions
@ 2011-04-10  4:45 Rich Felker
  2011-04-10 12:08 ` Luka Marčetić
                   ` (2 more replies)
  0 siblings, 3 replies; 24+ messages in thread
From: Rich Felker @ 2011-04-10  4:45 UTC (permalink / raw)
  To: musl

Here's a testing task (particularly for Luka who's applied for SoC)
I'd like to see written. It's based on a recent bug that turned up in
strchr. The interfaces to be tested are strlen, strchr, strcspn,
strspn, memchr, etc. - any string/memory function that scans a range
of memory and needs to stop when it hits a byte matching certain
conditions. We're looking to detect invalid memory access past the end
of the object, and tests should go something like:

1. Allocate two pages of memory with mmap and make the second one
unreadable and unwritable using mprotect.

2. Arrange for the byte that stops the scan to be either the last byte
of the first page, or one of the previous 7 bytes (try them all). Note
that for some interfaces, there are more than one way the scan can be
terminated (e.g. either a matching character of a null terminator) in
which case you want to test both.

3. For each choice of terminator location and type in 2, you want to
test every possible length and alignment leading up to it. You should
test starting the scan exactly at the terminator, one byte before it,
2 bytes before it, ... all the way back to the beginning of the page.

4. Make sure you test both with high and low bytes (8th bit on or off)
as both the non-terminating and terminating bytes, in order to also
catch any errors due to signedness of char.

A signal handler for SIGSEGV, along with siglongjmp to exit the signal
handler, may be convenient for allowing the tests to continue in the
event of a failure or at least reporting which test the failure
occurred in.

Please don't spend time developing any fancy framework for this. It
should take just a few hours to get something working, and most of the
code can be in main() for all I care as long as it works. Part of the
criterion for working is that it should detect the strchr misaligned
read bug in 0.7.6 that was fixed in 0.7.7, and the signedness bug in
0.7.5 that was fixed in 0.7.6.


Rich


^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: Simple testing task - string functions
  2011-04-10  4:45 Simple testing task - string functions Rich Felker
@ 2011-04-10 12:08 ` Luka Marčetić
  2011-04-10 15:25 ` JIghtuse
  2011-04-14 17:59 ` Simple testing task - string functions Luka Marčetić
  2 siblings, 0 replies; 24+ messages in thread
From: Luka Marčetić @ 2011-04-10 12:08 UTC (permalink / raw)
  To: musl

On 04/10/2011 06:45 AM, Rich Felker wrote:
> Here's a testing task (particularly for Luka who's applied for SoC)
> I'd like to see written. It's based on a recent bug that turned up in
> strchr. The interfaces to be tested are strlen, strchr, strcspn,
> strspn, memchr, etc. - any string/memory function that scans a range
> of memory and needs to stop when it hits a byte matching certain
> conditions. We're looking to detect invalid memory access past the end
> of the object, and tests should go something like: [...]
>    

I like the task, it should be interesting. I have some work to do next 
week (monday especially), but I'll definitely finish it before the 15th. 
I'll make sure to keep the framework out of the picture for now as you 
and Alexander both suggested.
Thanks Rich,
-Luka Marčetić


^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: Simple testing task - string functions
  2011-04-10  4:45 Simple testing task - string functions Rich Felker
  2011-04-10 12:08 ` Luka Marčetić
@ 2011-04-10 15:25 ` JIghtuse
  2011-04-10 15:34   ` Rich Felker
  2011-04-10 15:46   ` keep discussion threads separate (was: Simple testing task - string functions) Solar Designer
  2011-04-14 17:59 ` Simple testing task - string functions Luka Marčetić
  2 siblings, 2 replies; 24+ messages in thread
From: JIghtuse @ 2011-04-10 15:25 UTC (permalink / raw)
  To: musl

I have some questions about my task. I've written a program to test 
malloc() function of musl. But..
1. Can I use standart rand() and srand() functions to generate random 
size of allocated memory chunks, or I must to write another one random 
number generator?
2.

Write a program which loops many times allocating and freeing memory

So, when my program must to free memory? If it freeing just after its 
allocating, it always gets one chunk of memory. And how to define 
maximum size of memory chunk? I define it as MAX_SIZE / 1000, where 
MAX_SIZE is a maximum total allocated amount (about 8 * 10^8). Is it 
correctly?
3. I decided to generate a fragmentation diagram as a .dat file for 
plotting by gnuplot. Are you satisfied with it, or maybe write it as a 
simple text file with pseudo-graphic diagram?
Thanks. I await your reply.

-- 
Sincerely yours, JIghtuse.



^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: Simple testing task - string functions
  2011-04-10 15:25 ` JIghtuse
@ 2011-04-10 15:34   ` Rich Felker
  2011-04-10 15:46   ` keep discussion threads separate (was: Simple testing task - string functions) Solar Designer
  1 sibling, 0 replies; 24+ messages in thread
From: Rich Felker @ 2011-04-10 15:34 UTC (permalink / raw)
  To: musl

On Sun, Apr 10, 2011 at 10:25:59PM +0700, JIghtuse wrote:
> I have some questions about my task. I've written a program to test
> malloc() function of musl. But..
> 1. Can I use standart rand() and srand() functions to generate
> random size of allocated memory chunks, or I must to write another
> one random number generator?

I don't mind if you use them as long as you make the default behavior
deterministic, i.e. don't seed it with time or something where we
might get a failure and then not be able to reproduce it. Or you could
use time as a seed by default if you print it so it's not lost on
failure. This is all stuff that could be changed later anyway. I just
don't want to have a situation where we saw one failure but can't
reproduce it without trying all 2billion possible seeds. :)

> Write a program which loops many times allocating and freeing memory
> 
> So, when my program must to free memory? If it freeing just after
> its allocating, it always gets one chunk of memory. And how to

If you just allocate chunk X and then free chunk X, it won't affect
fragmentation at all. You'll need to do some shuffling. There's some
code in libc-bench (see musl gitweb server) which attempts to do the
sort of random allocation patterns I have in mind, but I haven't
evaluated how good a job it actually does at fragmenting memory. You
could use it as an idea or starting point.

Or if you want to do it from scratch, read up on how hard disks get
fragmented and apply the same principles to memory.

If you're stuck, I also just thought of a simple algorithmic way to
generate fragmentation which I could explain.

> 3. I decided to generate a fragmentation diagram as a .dat file for
> plotting by gnuplot. Are you satisfied with it, or maybe write it as
> a simple text file with pseudo-graphic diagram?

Either or both would be fine.

Rich


^ permalink raw reply	[flat|nested] 24+ messages in thread

* keep discussion threads separate (was: Simple testing task - string functions)
  2011-04-10 15:25 ` JIghtuse
  2011-04-10 15:34   ` Rich Felker
@ 2011-04-10 15:46   ` Solar Designer
  1 sibling, 0 replies; 24+ messages in thread
From: Solar Designer @ 2011-04-10 15:46 UTC (permalink / raw)
  To: musl

JIghtuse -

On Sun, Apr 10, 2011 at 10:25:59PM +0700, JIghtuse wrote:
> I have some questions about my task. I've written a program to test 
> malloc() function of musl. But..

That's great, but why are you posting to the thread about "string
functions" (a task for Luka)?  Please be careful to post to the proper
thread.  I suggest that you re-post your message to the proper thread
now (by replying to Rich's message with your task definition), quoting
some relevant context, and any replies should be posted to that other
message (in the proper thread).  Otherwise, we'll mix the two threads up
badly.

Please note that threading typically works based on Message-ID,
In-Reply-To, and References headers, not on Subjects (although this is
sometimes done as well).  So simply setting the Subject to match that of
the right thread won't be enough.  Please actually locate Rich's message
that you want to reply to, and use the reply feature of your MUA on it.
That message was:

Date: Fri, 8 Apr 2011 19:34:02 -0400
To: musl@lists.openwall.com
From: Rich Felker <dalias@aerifal.cx>
Subject: Re: [musl] GSoC

You may optionally change the Subject to "malloc testing (was: GSoC)"
(notice how the previous Subject is preserved after "was:").

To learn on what context to quote and how, please refer to:

http://www.complang.tuwien.ac.at/anton/mail-news-errors.html
http://www.netmeister.org/news/learn2quote.html

Thanks,

Alexander


^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: Simple testing task - string functions
  2011-04-10  4:45 Simple testing task - string functions Rich Felker
  2011-04-10 12:08 ` Luka Marčetić
  2011-04-10 15:25 ` JIghtuse
@ 2011-04-14 17:59 ` Luka Marčetić
  2011-04-14 23:11   ` Rich Felker
  2 siblings, 1 reply; 24+ messages in thread
From: Luka Marčetić @ 2011-04-14 17:59 UTC (permalink / raw)
  To: musl

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: multipart/mixed;, Size: 5545 bytes --]

This is a multi-part message in MIME format.
--------------080500010007030902050509
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit

Hello again.
Attached is the solution to the task. The program seems to preform as 
expected, but may still need double-checking.
The tests therein fail where expected when linked with various old 
versions of musl. Note that although the program is designed to allow 
tests to fail gracefully as suggested, this does not happen due to bugs 
in function implementations in said old versions that the program 
depends on. Rich and Chris have confirmed a bug in 0.7.6 that causes a 
segfault in the siglongjmp (longjmp to be exact). I'm still waiting for 
confirmation of inability of version 0.7.5 to dispose the same signal to 
a specified handler properly.
Thanks.
Luka Marčetić

--------------080500010007030902050509
Content-Type: text/x-csrc;
 name="memory_access.c"
Content-Transfer-Encoding: 8bit
Content-Disposition: attachment;
 filename="memory_access.c"

#include <signal.h>
#include <stdio.h>
#include <sys/mman.h>
#include <unistd.h>
#include <string.h>
#include <fcntl.h>
#include <setjmp.h>

/**
 ** \file depends: sysconf, mmap, mprotect, open, signal, sigsetjmp, siglongjmp, fprintf
 ** \author Luka Marčetić, 2011
 **/

//necessary to detect errors, and resume afterwards:
int next; ///< number of the currently executing test, or greater on failure
sigjmp_buf env; ///< will store the signal mask and stack context/environment

void bridge_sig_jmp(int sig);
void print_result(int done, char *name);

/**
 **	Tests string/memory functions for invalid memory access
 ** and for correctnes when handling 'high' vs 'low' bytes.
 **
 ** tests: strchr, strlen, strspn, strcspn, memchr
 **/
int main()
{
	int i, j, k, fd, tmpi, pg_size=sysconf(_SC_PAGESIZE);
	char *tmp, *m;
	char low=' ', high=128+low, string[]="\x20\x40\x60\x80\xA0\xC0\xE0";
	
	fd = open("/dev/zero", O_RDWR);
	m = mmap(NULL, pg_size*2, PROT_READ|PROT_WRITE, MAP_PRIVATE, fd, 0);
	mprotect(m+pg_size, pg_size, PROT_NONE);
	
	
	signal(SIGSEGV, bridge_sig_jmp);
	next=0;
	switch (sigsetjmp(env, 1))
	{
		case 0:
//strchr:
			fprintf(stdout, " strchr\n");
			for (i=0; i<pg_size; ++i)
				m[i]=low;
			for (i=1; i<=8; ++i)
			{
				m[pg_size-i] = high;
				for (j=i; j<=pg_size; ++j)
				{
					tmp = strchr(&m[pg_size-j], high);
					if (tmp != &m[pg_size-i])
						bridge_sig_jmp(0);
				}
				m[pg_size-i] = low;
			}
		case 1:
			print_result(0, "stopping at a 'high' character");
			
			
			
			for (i=0; i<pg_size; ++i)
				m[i]=high;
			for (i=1; i<=8; ++i)
			{
				m[pg_size-i] = low;
				for (j=i; j<=pg_size; ++j)
				{
					tmp = strchr(&m[pg_size-j], low);
					if (tmp != &m[pg_size-i])
						bridge_sig_jmp(0);
				}
				m[pg_size-i] = high;
			}
		case 2:
			print_result(1, "stopping at a 'low' character");
			
			
			for (i=0; i<pg_size; ++i)
				m[i]=128;
			for (i=1; i<=8; ++i)
			{
				m[pg_size-i] = '\0';
				for (j=i; j<=pg_size; ++j)
				{
					tmp = strchr(&m[pg_size-j], low);
					if (tmp != NULL)
						bridge_sig_jmp(0);
				}
				m[pg_size-i] = 128;
			}
		case 3:
			print_result(2, "stopping at a '\\0' character");
		
			
//strlen:
			fprintf(stdout, " strlen\n");
			//still filled with 128s
			for (i=1; i<=8; ++i)
			{
				m[pg_size-i] = '\0';
				for (j=i; j<=pg_size; ++j)
				{
					tmpi = strlen(&m[pg_size-j]);
					if (tmpi != (pg_size-i)-(pg_size-j))
						bridge_sig_jmp(0);
				}
				m[pg_size-i] = 128;
			}
		case 4:
			print_result(3, "stopping at a '\\0' character");
			
			
//memchr:
			fprintf(stdout, " memchr\n");
			for (i=0; i<pg_size; ++i)
				m[i]=low; //128 would cause an error per standard itself
			for (i=1; i<=8; ++i)
			{
				m[pg_size-i] = '\0';
				for (j=i; j<=pg_size; ++j)
					tmp = memchr(&m[pg_size-j], '\0', pg_size+1);
				m[pg_size-i] = low;
			}
		case 5:
			print_result(4, "stopping at a '\\0' character");
			
			
//strspn:
			fprintf(stdout, " strspn\n");
			for (i=0; i<pg_size; ++i)
				m[i]=string[i%7]; //'high' and 'low' chars
			for (i=1; i<=8; ++i)
			{
				m[pg_size-i] = '\0';
				for (j=i; j<=pg_size; ++j)
				{
					tmpi = strspn(&m[pg_size-j], string);
					if (tmpi != (pg_size-i)-(pg_size-j))
						bridge_sig_jmp(0);
				}
				m[pg_size-i] = string[(pg_size-i)%7];
			}
		case 6:
			print_result(5, "stopping at a character not found in the set");
			
			
//strcspn:
			fprintf(stdout, " strcspn\n");
			//still filled with 'high' and 'low' chars
			for (k=0; k<3; ++k)
			{
				m[pg_size-i] = '\0';
				for (j=i; j<=pg_size; ++j)
				{
					tmpi = strcspn(&m[pg_size-j], "\x21\0\x21\0\0\x22");
					if (tmpi != (pg_size-i)-(pg_size-j))
						bridge_sig_jmp(0);
				}
				m[pg_size-i] = string[(pg_size-i)%7];
			}
		case 7:
			print_result(6, "stopping at any character from the set");
			
			
			
		break;
	}
	
	
	return 0;
}

/**
 ** A bridge function to be passed to signal(), to call siglongjmp().
 ** A call to this function means that the current test has failed.
 **/
void bridge_sig_jmp(int sig)
{
	++next;///< indication that there was an error (see print_result)
	siglongjmp(env, next);
	return;
}

/**
 ** Prints a success/failure message
 ** \param done number of the last test executed.
 ** \param name name of the last test executed.
 **/
void print_result(int done, char *name)
{
	
	if (next > done)
		fprintf (stderr, "   %s: Failure\n", name);
	else
	{
		fprintf (stdout, "   %s: Success\n", name);
		next = done+1;
	}
	return;
}

--------------080500010007030902050509--


^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: Simple testing task - string functions
  2011-04-14 17:59 ` Simple testing task - string functions Luka Marčetić
@ 2011-04-14 23:11   ` Rich Felker
  2011-04-18 12:20     ` Luka Marčetić
  2011-04-25 19:34     ` Unit tests Luka Marčetić
  0 siblings, 2 replies; 24+ messages in thread
From: Rich Felker @ 2011-04-14 23:11 UTC (permalink / raw)
  To: musl

On Thu, Apr 14, 2011 at 07:59:33PM +0200, Luka Marčetić wrote:
> Hello again.
> Attached is the solution to the task. The program seems to preform
> as expected, but may still need double-checking.
> The tests therein fail where expected when linked with various old
> versions of musl. Note that although the program is designed to
> allow tests to fail gracefully as suggested, this does not happen
> due to bugs in function implementations in said old versions that
> the program depends on. Rich and Chris have confirmed a bug in 0.7.6
> that causes a segfault in the siglongjmp (longjmp to be exact). I'm
> still waiting for confirmation of inability of version 0.7.5 to
> dispose the same signal to a specified handler properly.

Here's an idea for avoiding the sigsetjmp/siglongjmp bug: just use
setjmp/longjmp, and use sigaction with SA_NODEFER to install the
signal handler. Actually sigaction should always be used to install
signal handlers, since signal is under-specified and you can't be sure
how it will behave.

Rich


^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: Simple testing task - string functions
  2011-04-14 23:11   ` Rich Felker
@ 2011-04-18 12:20     ` Luka Marčetić
  2011-04-25 19:34     ` Unit tests Luka Marčetić
  1 sibling, 0 replies; 24+ messages in thread
From: Luka Marčetić @ 2011-04-18 12:20 UTC (permalink / raw)
  To: musl

On 04/15/2011 01:11 AM, Rich Felker wrote:
> On Thu, Apr 14, 2011 at 07:59:33PM +0200, Luka Marčetić wrote:
>> Hello again.
>> Attached is the solution to the task. The program seems to preform
>> as expected, but may still need double-checking.
>> The tests therein fail where expected when linked with various old
>> versions of musl. Note that although the program is designed to
>> allow tests to fail gracefully as suggested, this does not happen
>> due to bugs in function implementations in said old versions that
>> the program depends on. Rich and Chris have confirmed a bug in 0.7.6
>> that causes a segfault in the siglongjmp (longjmp to be exact). I'm
>> still waiting for confirmation of inability of version 0.7.5 to
>> dispose the same signal to a specified handler properly.
> Here's an idea for avoiding the sigsetjmp/siglongjmp bug: just use
> setjmp/longjmp, and use sigaction with SA_NODEFER to install the
> signal handler. Actually sigaction should always be used to install
> signal handlers, since signal is under-specified and you can't be sure
> how it will behave.
>
> Rich
Hey.
I've been away (I'll explain why in #musl). Anyway, thanks for the 
critique. I'll take your word and use sigaction further on. I may 
correct these tests too for GSoC if you think they'll prove useful.
Anyway, we'll talk. It's now up to you guys to accept/reject my proposal 
if I'm not mistaken.
Thanks
-Luka



^ permalink raw reply	[flat|nested] 24+ messages in thread

* Unit tests
  2011-04-14 23:11   ` Rich Felker
  2011-04-18 12:20     ` Luka Marčetić
@ 2011-04-25 19:34     ` Luka Marčetić
  2011-04-26 19:14       ` Solar Designer
  2011-04-27  0:42       ` Rich Felker
  1 sibling, 2 replies; 24+ messages in thread
From: Luka Marčetić @ 2011-04-25 19:34 UTC (permalink / raw)
  To: musl

Thanks for giving me the opportunity and accepting my application to the 
project!
I won't let you down.
-Luka


^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: Unit tests
  2011-04-25 19:34     ` Unit tests Luka Marčetić
@ 2011-04-26 19:14       ` Solar Designer
  2011-04-27  0:32         ` Rich Felker
  2011-04-27  0:42       ` Rich Felker
  1 sibling, 1 reply; 24+ messages in thread
From: Solar Designer @ 2011-04-26 19:14 UTC (permalink / raw)
  To: musl

Luka -

On Mon, Apr 25, 2011 at 09:34:37PM +0200, Luka Mar??eti?? wrote:
> Thanks for giving me the opportunity and accepting my application to the 
> project!
> I won't let you down.

Thanks for posting this.  Yes, we put some trust in you, and we hope
you'll earn it.  We had fewer slots than proposals we wanted to accept,
so the accepted students are in a sense in debt to those other great
students who we did not accept.  You should make full use of this
opportunity - no worse than another student would.

I am going to send out an announcement of the accepted projects,
including of this one.  I'll include a link to:
http://openwall.info/wiki/musl/unit-tests

Rich -

You could want to define the coding style for the project, perhaps to
match musl's.  For example, in Owl we're using a coding style similar to
that achieved with the following "indent" program options:

indent -kr -i8 -nlp -nbbo -l79 -lc79

(these are given in Owl/doc/CONVENTIONS).

Alexander


^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: Unit tests
  2011-04-26 19:14       ` Solar Designer
@ 2011-04-27  0:32         ` Rich Felker
  0 siblings, 0 replies; 24+ messages in thread
From: Rich Felker @ 2011-04-27  0:32 UTC (permalink / raw)
  To: musl

On Tue, Apr 26, 2011 at 11:14:30PM +0400, Solar Designer wrote:
> Rich -
> 
> You could want to define the coding style for the project, perhaps to
> match musl's.  For example, in Owl we're using a coding style similar to
> that achieved with the following "indent" program options:
> 
> indent -kr -i8 -nlp -nbbo -l79 -lc79
> 
> (these are given in Owl/doc/CONVENTIONS).


musl's indention style is pretty close to k&r, basically the
following. i'd be happy if the unit tests project can do similar:

- use tabs for indention levels; set them to show up at whatever width
  you prefer in your editor.

- avoid using so many indention levels (assuming 8-space tabs) that
  you have to exceed 79 chars or break up lines too often.

- use spaces for alignment, i.e. if you want to extend past the
  indention level to line up continued lines, data tables, comments.

- put braces on new line only for function bodies, otherwise on the
  same line as the loop/conditional statement. braces before and after
  else statements should be on the same line as the else. within a
  single if/else if/else construct, be consistent - use braces for all
  of them or none of them.

- uses spaces after conditional/loop keywords, but not after the
  function name in declarations/calls.

- otherwise, there is no strict rule for spaces, but avoid excessive
  spaces and try to use them to highlight operator precedence as
  alternatives to inserting redundant parentheses. (i find nested
  parentheses hard to track visually, guess that's why i never liked
  lisp... ;-)


rich


^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: Unit tests
  2011-04-25 19:34     ` Unit tests Luka Marčetić
  2011-04-26 19:14       ` Solar Designer
@ 2011-04-27  0:42       ` Rich Felker
  2011-04-27  6:29         ` Luka Marčetić
  1 sibling, 1 reply; 24+ messages in thread
From: Rich Felker @ 2011-04-27  0:42 UTC (permalink / raw)
  To: musl

Congratulations Luka! I'm looking forward to the project, especially
as thorough testing is critical to the development timeline I have in
mind for musl leading up to 1.0. I know Solar and the Openwall team
are also eagar to see their GSoC slot put to good use.

By the way, something to think about between now and when development
gets started - a name for the unit tests project? "Libc unit tests" is
fine but rather boring, so maybe we can come up with a cool name to
publicize it as (for example, in the bug reports it generates for
other implementations ;-).

Cheers,

Rich


On Mon, Apr 25, 2011 at 09:34:37PM +0200, Luka Marčetić wrote:
> Thanks for giving me the opportunity and accepting my application to
> the project!
> I won't let you down.
> -Luka


^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: Unit tests
  2011-04-27  0:42       ` Rich Felker
@ 2011-04-27  6:29         ` Luka Marčetić
  2011-04-29  5:36           ` Solar Designer
  0 siblings, 1 reply; 24+ messages in thread
From: Luka Marčetić @ 2011-04-27  6:29 UTC (permalink / raw)
  To: musl

On 04/27/2011 02:42 AM, Rich Felker wrote:
> Congratulations Luka! I'm looking forward to the project, especially
> as thorough testing is critical to the development timeline I have in
> mind for musl leading up to 1.0. I know Solar and the Openwall team
> are also eagar to see their GSoC slot put to good use.
>
> By the way, something to think about between now and when development
> gets started - a name for the unit tests project? "Libc unit tests" is
> fine but rather boring, so maybe we can come up with a cool name to
> publicize it as (for example, in the bug reports it generates for
> other implementations ;-).
>
> Cheers,
>
> Rich

I've come up with "C Library Unit Test Suite" - cluts, which sounds like 
"klutz" (besides being klutzy of itself).
Regarding the coding style, I try to practice most of it already, except 
opening brackets in-line with if/else/etc. But I think it's about time I 
tried that, so can do.
Anyway, Thanks again. To Alexander especially.
-Luka


^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: Unit tests
  2011-04-27  6:29         ` Luka Marčetić
@ 2011-04-29  5:36           ` Solar Designer
  2011-04-29 11:54             ` Christian Neukirchen
  0 siblings, 1 reply; 24+ messages in thread
From: Solar Designer @ 2011-04-29  5:36 UTC (permalink / raw)
  To: musl

On Wed, Apr 27, 2011 at 08:29:31AM +0200, Luka Mar??eti?? wrote:
> I've come up with "C Library Unit Test Suite" - cluts, which sounds like 
> "klutz" (besides being klutzy of itself).

"cluts" sounds good to me.

What license is it going to be under?  I propose cut-down BSD (to the
point of being copyright only, with no restrictions):

This software is Copyright (c) YEAR YOUR NAME <your at e-mail.address>,
and it is hereby released to the general public under the following terms:

Redistribution and use in source and binary forms, with or without
modification, are permitted.

This should be compatible with any other Open Source license, which I
think is a plus.  We currently use this for contributions to JtR:

http://openwall.info/wiki/john/licensing

I see little reason to have GPL-like restrictions on the unit tests;
I think that would do more harm than good.

Alexander


^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: Unit tests
  2011-04-29  5:36           ` Solar Designer
@ 2011-04-29 11:54             ` Christian Neukirchen
  2011-05-01 19:36               ` Solar Designer
  0 siblings, 1 reply; 24+ messages in thread
From: Christian Neukirchen @ 2011-04-29 11:54 UTC (permalink / raw)
  To: musl

Solar Designer <solar@openwall.com> writes:

> On Wed, Apr 27, 2011 at 08:29:31AM +0200, Luka Mar??eti?? wrote:
>> I've come up with "C Library Unit Test Suite" - cluts, which sounds like 
>> "klutz" (besides being klutzy of itself).
>
> "cluts" sounds good to me.
>
> What license is it going to be under?  I propose cut-down BSD (to the
> point of being copyright only, with no restrictions):
>
> This software is Copyright (c) YEAR YOUR NAME <your at e-mail.address>,
> and it is hereby released to the general public under the following terms:
>
> Redistribution and use in source and binary forms, with or without
> modification, are permitted.
>
> This should be compatible with any other Open Source license, which I
> think is a plus.  We currently use this for contributions to JtR:
>
> http://openwall.info/wiki/john/licensing
>
> I see little reason to have GPL-like restrictions on the unit tests;
> I think that would do more harm than good.

A court-proven formulation of this is the
http://en.wikipedia.org/wiki/ISC_license I think.

> Alexander
-- 
Christian Neukirchen  <chneukirchen@gmail.com>  http://chneukirchen.org


^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: Unit tests
  2011-04-29 11:54             ` Christian Neukirchen
@ 2011-05-01 19:36               ` Solar Designer
  2011-05-02  8:51                 ` Christian Neukirchen
  0 siblings, 1 reply; 24+ messages in thread
From: Solar Designer @ 2011-05-01 19:36 UTC (permalink / raw)
  To: musl

On Fri, Apr 29, 2011 at 01:54:42PM +0200, Christian Neukirchen wrote:
> Solar Designer <solar@openwall.com> writes:
> 
> > What license is it going to be under?  I propose cut-down BSD (to the
> > point of being copyright only, with no restrictions):
> >
> > This software is Copyright (c) YEAR YOUR NAME <your at e-mail.address>,
> > and it is hereby released to the general public under the following terms:
> >
> > Redistribution and use in source and binary forms, with or without
> > modification, are permitted.
> >
> > This should be compatible with any other Open Source license, which I
> > think is a plus.  We currently use this for contributions to JtR:
> >
> > http://openwall.info/wiki/john/licensing
> >
> > I see little reason to have GPL-like restrictions on the unit tests;
> > I think that would do more harm than good.
> 
> A court-proven formulation of this is the
> http://en.wikipedia.org/wiki/ISC_license I think.

What do you mean by it being court-proven?  (There's probably something
I am not aware of, which is not surprising given that I'm not really
into licensing.)

I dislike the requirement "... provided that the above copyright notice
and this permission notice appear in all copies."  I am not a lawyer,
but I think this doesn't allow derived versions to be placed under
certain other licenses (that would not give the same rights).

Alexander


^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: Unit tests
  2011-05-01 19:36               ` Solar Designer
@ 2011-05-02  8:51                 ` Christian Neukirchen
  2011-05-02 12:49                   ` Solar Designer
  0 siblings, 1 reply; 24+ messages in thread
From: Christian Neukirchen @ 2011-05-02  8:51 UTC (permalink / raw)
  To: musl

Solar Designer <solar@openwall.com> writes:

> On Fri, Apr 29, 2011 at 01:54:42PM +0200, Christian Neukirchen wrote:
>> Solar Designer <solar@openwall.com> writes:
>> 
>> > What license is it going to be under?  I propose cut-down BSD (to the
>> > point of being copyright only, with no restrictions):
>> >
>> > This software is Copyright (c) YEAR YOUR NAME <your at e-mail.address>,
>> > and it is hereby released to the general public under the following terms:
>> >
>> > Redistribution and use in source and binary forms, with or without
>> > modification, are permitted.
>> >
>> > This should be compatible with any other Open Source license, which I
>> > think is a plus.  We currently use this for contributions to JtR:
>> >
>> > http://openwall.info/wiki/john/licensing
>> >
>> > I see little reason to have GPL-like restrictions on the unit tests;
>> > I think that would do more harm than good.
>> 
>> A court-proven formulation of this is the
>> http://en.wikipedia.org/wiki/ISC_license I think.
>
> What do you mean by it being court-proven?  (There's probably something
> I am not aware of, which is not surprising given that I'm not really
> into licensing.)
>
> I dislike the requirement "... provided that the above copyright notice
> and this permission notice appear in all copies."  I am not a lawyer,
> but I think this doesn't allow derived versions to be placed under
> certain other licenses (that would not give the same rights).

The ISC license is widely used (BIND, new OpenBSD stuff...) and thus a
lawyer has looked over it, which generally is not true for "own"
licenses.

> Alexander
-- 
Christian Neukirchen  <chneukirchen@gmail.com>  http://chneukirchen.org


^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: Unit tests
  2011-05-02  8:51                 ` Christian Neukirchen
@ 2011-05-02 12:49                   ` Solar Designer
  2011-05-02 13:02                     ` errno
  0 siblings, 1 reply; 24+ messages in thread
From: Solar Designer @ 2011-05-02 12:49 UTC (permalink / raw)
  To: musl

On Mon, May 02, 2011 at 10:51:34AM +0200, Christian Neukirchen wrote:
> The ISC license is widely used (BIND, new OpenBSD stuff...) and thus a
> lawyer has looked over it, which generally is not true for "own"
> licenses.

This makes sense, but I don't consider a BSD license with some clauses
removed an "own" license in this sense.  Merely removing some
restrictive clauses should not result in any problems - e.g., the BSD
license was shortened from 4 clauses (original) to 2 clauses (FreeBSD),
and I like to remove these remaining 2 clauses.

http://en.wikipedia.org/wiki/BSD_licenses#2-clause_license_.28.22Simplified_BSD_License.22_or_.22FreeBSD_License.22.29

Basically, I propose that we use this, but remove the words "provided
that the following conditions are met" and remove the two conditions.

We may achieve the same by starting with the ISC license text (the
"and/or" revision of it) and removing "provided that the above
copyright notice and this permission notice appear in all copies".

In either case, we'll be able to say that the text that remains is the
complete permission text of either the BSD license or the ISC license;
the only things removed are purely restrictions.

Alexander


^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: Unit tests
  2011-05-02 12:49                   ` Solar Designer
@ 2011-05-02 13:02                     ` errno
  2011-05-02 13:11                       ` Rich Felker
  2011-05-02 13:27                       ` Solar Designer
  0 siblings, 2 replies; 24+ messages in thread
From: errno @ 2011-05-02 13:02 UTC (permalink / raw)
  To: musl

On Monday, May 02, 2011 05:49:22 AM Solar Designer wrote:
> http://en.wikipedia.org/wiki/BSD_licenses#2-clause_license_.28.22Simplified
> _BSD_License.22_or_.22FreeBSD_License.22.29
> 
> Basically, I propose that we use this, but remove the words "provided
> that the following conditions are met" and remove the two conditions.
> 

Hello!

Have you considered cc0?

http://creativecommons.org/about/cc0



^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: Unit tests
  2011-05-02 13:02                     ` errno
@ 2011-05-02 13:11                       ` Rich Felker
  2011-05-02 13:30                         ` Solar Designer
  2011-05-02 13:27                       ` Solar Designer
  1 sibling, 1 reply; 24+ messages in thread
From: Rich Felker @ 2011-05-02 13:11 UTC (permalink / raw)
  To: musl

On Mon, May 02, 2011 at 06:02:15AM -0700, errno wrote:
> On Monday, May 02, 2011 05:49:22 AM Solar Designer wrote:
> > http://en.wikipedia.org/wiki/BSD_licenses#2-clause_license_.28.22Simplified
> > _BSD_License.22_or_.22FreeBSD_License.22.29
> > 
> > Basically, I propose that we use this, but remove the words "provided
> > that the following conditions are met" and remove the two conditions.
> > 
> 
> Hello!
> 
> Have you considered cc0?
> 
> http://creativecommons.org/about/cc0

Wow licenses are a much more popular discussion topic than
development...

Rich


^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: Unit tests
  2011-05-02 13:02                     ` errno
  2011-05-02 13:11                       ` Rich Felker
@ 2011-05-02 13:27                       ` Solar Designer
  1 sibling, 0 replies; 24+ messages in thread
From: Solar Designer @ 2011-05-02 13:27 UTC (permalink / raw)
  To: musl

On Mon, May 02, 2011 at 06:02:15AM -0700, errno wrote:
> Have you considered cc0?
> 
> http://creativecommons.org/about/cc0

Not really, although I had heard of it.  I just took a closer look, and
I think that it's a poor choice for software: an uncommon choice (CC0
specifically), lengthy full legal text (too long given the very simple
spirit and purpose), and might be tricky to apply when there are
multiple authors (and new ones joining development).

Summary:

http://creativecommons.org/publicdomain/zero/1.0/

(notice "the person", which we might need to edit when we have a second
contributor to the code).

Full text:

http://creativecommons.org/publicdomain/zero/1.0/legalcode

I did use public domain statements along with license fallback, which is
similar to CC0's approach, for some of my own works, e.g.:

http://openwall.info/wiki/people/solar/software/public-domain-source-code/md5

but this gets tricky when there are multiple authors, and lately I tend
to consider it an unneeded complication compared to going with copyright
and a purely-permissive license right away (my choice so far is cut-down
BSD, but cut-down ISC will work as well).

Alexander


^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: Unit tests
  2011-05-02 13:11                       ` Rich Felker
@ 2011-05-02 13:30                         ` Solar Designer
  2011-05-02 13:32                           ` Rich Felker
  0 siblings, 1 reply; 24+ messages in thread
From: Solar Designer @ 2011-05-02 13:30 UTC (permalink / raw)
  To: musl

On Mon, May 02, 2011 at 09:11:24AM -0400, Rich Felker wrote:
> Wow licenses are a much more popular discussion topic than
> development...

Sorry about that.  I should have posted the development related stuff I
told you on IRC yesterday to this mailing list instead.  I will do that
next time.  In fact... I'll post some of it in here now. :-)

Alexander


^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: Unit tests
  2011-05-02 13:30                         ` Solar Designer
@ 2011-05-02 13:32                           ` Rich Felker
  2011-05-02 13:52                             ` Solar Designer
  0 siblings, 1 reply; 24+ messages in thread
From: Rich Felker @ 2011-05-02 13:32 UTC (permalink / raw)
  To: musl

On Mon, May 02, 2011 at 05:30:28PM +0400, Solar Designer wrote:
> On Mon, May 02, 2011 at 09:11:24AM -0400, Rich Felker wrote:
> > Wow licenses are a much more popular discussion topic than
> > development...
> 
> Sorry about that.  I should have posted the development related stuff I
> told you on IRC yesterday to this mailing list instead.  I will do that
> next time.  In fact... I'll post some of it in here now. :-)

On mplayer, we called this kind of topic a bikeshed. ;-)

Rich


^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: Unit tests
  2011-05-02 13:32                           ` Rich Felker
@ 2011-05-02 13:52                             ` Solar Designer
  0 siblings, 0 replies; 24+ messages in thread
From: Solar Designer @ 2011-05-02 13:52 UTC (permalink / raw)
  To: musl

On Mon, May 02, 2011 at 09:32:57AM -0400, Rich Felker wrote:
> On Mon, May 02, 2011 at 05:30:28PM +0400, Solar Designer wrote:
> > On Mon, May 02, 2011 at 09:11:24AM -0400, Rich Felker wrote:
> > > Wow licenses are a much more popular discussion topic than
> > > development...
> > 
> > Sorry about that.  I should have posted the development related stuff I
> > told you on IRC yesterday to this mailing list instead.  I will do that
> > next time.  In fact... I'll post some of it in here now. :-)
> 
> On mplayer, we called this kind of topic a bikeshed. ;-)

Right.

http://www.freebsd.org/doc/en_US.ISO8859-1/articles/mailing-list-faq/bikeshed.html
http://en.wiktionary.org/wiki/bikeshed

Yet I think it is fairly important to decide on a license for the unit
tests suite.  Perhaps you can just make a determination?  I want to make
sure that whatever code Luka submits always has a suitable license on
it.  This is my responsibility as a GSoC org admin.

In fact, once we decide on a license to use (at least initially), I
think we should ask Luka to re-post the code he has already written with
the proper licensing statement on it.

Alexander


^ permalink raw reply	[flat|nested] 24+ messages in thread

end of thread, other threads:[~2011-05-02 13:52 UTC | newest]

Thread overview: 24+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-04-10  4:45 Simple testing task - string functions Rich Felker
2011-04-10 12:08 ` Luka Marčetić
2011-04-10 15:25 ` JIghtuse
2011-04-10 15:34   ` Rich Felker
2011-04-10 15:46   ` keep discussion threads separate (was: Simple testing task - string functions) Solar Designer
2011-04-14 17:59 ` Simple testing task - string functions Luka Marčetić
2011-04-14 23:11   ` Rich Felker
2011-04-18 12:20     ` Luka Marčetić
2011-04-25 19:34     ` Unit tests Luka Marčetić
2011-04-26 19:14       ` Solar Designer
2011-04-27  0:32         ` Rich Felker
2011-04-27  0:42       ` Rich Felker
2011-04-27  6:29         ` Luka Marčetić
2011-04-29  5:36           ` Solar Designer
2011-04-29 11:54             ` Christian Neukirchen
2011-05-01 19:36               ` Solar Designer
2011-05-02  8:51                 ` Christian Neukirchen
2011-05-02 12:49                   ` Solar Designer
2011-05-02 13:02                     ` errno
2011-05-02 13:11                       ` Rich Felker
2011-05-02 13:30                         ` Solar Designer
2011-05-02 13:32                           ` Rich Felker
2011-05-02 13:52                             ` Solar Designer
2011-05-02 13:27                       ` Solar Designer

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/musl/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).