Bug#545806: libgsl0-dev: GSL should deal with an uninitialised rng better

2009-09-11 Thread Dirk Eddelbuettel

Brian,

On 11 September 2009 at 16:54, Brian Gough wrote:
| At Thu, 10 Sep 2009 07:55:25 -0500,
| Dirk Eddelbuettel wrote:
| > Tough one. SEGV is bad. On the other hand, the GSL RMGs came in a 
'framework'
| > so there may be numerous entry points.
| > 
| > Brian, any thougths?
| 
| Hello,
| 
| By convention we've never checked whether pointers passed in by the
| user are actually non-NULL.

That was my gut feel. Thanks for confirming this.
| 
| This is mainly due to the amount of work in adding these checks
| everywhere.  
| 
| Also there would be a somewhat arbitrary distinction between functions
| where we would check, and those where we wouldn't because they would
| add too much overhead.

Matthew:  Ok if I close this bug report 'as it is a feature' ?

Dirk

| 
| -- 
| Brian Gough
| 
| Network Theory Ltd,
| Publishing Free Software Manuals --- http://www.network-theory.co.uk/
| 
| 

-- 
Three out of two people have difficulties with fractions.



-- 
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org



Bug#545806: libgsl0-dev: GSL should deal with an uninitialised rng better

2009-09-11 Thread Brian Gough
At Thu, 10 Sep 2009 07:55:25 -0500,
Dirk Eddelbuettel wrote:
> Tough one. SEGV is bad. On the other hand, the GSL RMGs came in a 'framework'
> so there may be numerous entry points.
> 
> Brian, any thougths?

Hello,

By convention we've never checked whether pointers passed in by the
user are actually non-NULL.

This is mainly due to the amount of work in adding these checks
everywhere.  

Also there would be a somewhat arbitrary distinction between functions
where we would check, and those where we wouldn't because they would
add too much overhead.

-- 
Brian Gough

Network Theory Ltd,
Publishing Free Software Manuals --- http://www.network-theory.co.uk/



-- 
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org



Bug#545806: libgsl0-dev: GSL should deal with an uninitialised rng better

2009-09-10 Thread Dirk Eddelbuettel

On 10 September 2009 at 12:48, Matthew Vernon wrote:
| Dirk Eddelbuettel wrote:
| 
| 
| 
| > Or do you claim that not-using 
| > 
| >gsl_rng_alloc (gsl_rng_default)
| > 
| > leading to a SEGV is a invalid behaviour?  I am much less convinced that 
that
| > is a valid bug report -- it's much like using un-alloc'ed pointer types in
| > my book.
| 
| That is my claim, yes; I'd content that a very simple 
| sanity-check-and-error message would be better behaviour from a library 
| in this case. I conceed that it's arguable, but IMAO gsl should emit an 
| error rather than SEGV on bad input to any of its functions, unless it's 
| unreasonably expensive to do the error-checking.

Tough one. SEGV is bad. On the other hand, the GSL RMGs came in a 'framework'
so there may be numerous entry points.

Brian, any thougths?

(Oh, and I missed gsl 1.13 by a day but it is in Debian unstable as of
yesterday eve.)

Dirk

| 
| Regards,
| 
| Matthew
| 
| -- 
| Matthew Vernon, Research Fellow
| Ecology and Epidemiology Group,
| University of Warwick
| http://blogs.warwick.ac.uk/mcvernon

-- 
Three out of two people have difficulties with fractions.



-- 
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org



Bug#545806: libgsl0-dev: GSL should deal with an uninitialised rng better

2009-09-10 Thread Matthew Vernon

Dirk Eddelbuettel wrote:



Or do you claim that not-using 


   gsl_rng_alloc (gsl_rng_default)

leading to a SEGV is a invalid behaviour?  I am much less convinced that that
is a valid bug report -- it's much like using un-alloc'ed pointer types in
my book.


That is my claim, yes; I'd content that a very simple 
sanity-check-and-error message would be better behaviour from a library 
in this case. I conceed that it's arguable, but IMAO gsl should emit an 
error rather than SEGV on bad input to any of its functions, unless it's 
unreasonably expensive to do the error-checking.


Regards,

Matthew

--
Matthew Vernon, Research Fellow
Ecology and Epidemiology Group,
University of Warwick
http://blogs.warwick.ac.uk/mcvernon



--
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org



Bug#545806: libgsl0-dev: GSL should deal with an uninitialised rng better

2009-09-09 Thread Dirk Eddelbuettel

On 9 September 2009 at 10:27, Matthew Vernon wrote:
| Hi,
| 
| If you call any of the random-number functions in GSL and forget to 
| initialise the random number generator (or initialise it wrongly), GSL 
| SEGVs. This is poor - it should produce an error message. I deal with 
| queries from people this has confused surprisingly frequently.

Can you please supply a reproducible example?  If I bastardize an old example
of mine and comment-out 'gsl_rng_env_setup()' it still runs fine as shown below.

e...@ron:/tmp> cat test_gsl_rng.c

/* minimal gsl program from the info pages */

#include 
#include 

gsl_rng * r ;  /* global generator */

int
main ()
{
  /* gsl_rng_env_setup() ; */

  r = gsl_rng_alloc (gsl_rng_default);

  printf("generator type: %s\n", gsl_rng_name (r));
  printf("seed = %u\n", gsl_rng_default_seed);
  printf("first value = %u\n", gsl_rng_get (r)) ;
}

/*
 * Local variables:
 *  compile-command: "gcc -W test_gsl_rng.c -o test_gsl_rng -lblas -lgsl -lm"
 * End:
 */
e...@ron:/tmp> gcc -W test_gsl_rng.c -o test_gsl_rng -lblas -lgsl -lm
e...@ron:/tmp> ./test_gsl_rng
generator type: mt19937
seed = 0
first value = 4293858116
e...@ron:/tmp>


Or do you claim that not-using 

   gsl_rng_alloc (gsl_rng_default)

leading to a SEGV is a invalid behaviour?  I am much less convinced that that
is a valid bug report -- it's much like using un-alloc'ed pointer types in
my book.

Dirk

| 
| Regards,
| 
| Matthew
| 
| -- System Information:
| Debian Release: 5.0.3
|   APT prefers stable
|   APT policy: (500, 'stable')
| Architecture: amd64 (x86_64)
| 
| Kernel: Linux 2.6.20-2-macpro-amd64 (SMP w/4 CPU cores)
| Locale: LANG=en_GB.UTF-8, LC_CTYPE=en_GB.UTF-8 (charmap=UTF-8)
| Shell: /bin/sh linked to /bin/bash
| 
| Versions of packages libgsl0-dev depends on:
| ii  libgsl0ldbl  1.11+dfsg-1 GNU Scientific Library (GSL) -- 
li
| 
| libgsl0-dev recommends no packages.
| 
| libgsl0-dev suggests no packages.
| 
| -- no debconf information
| 
| 

-- 
Three out of two people have difficulties with fractions.



-- 
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org



Bug#545806: libgsl0-dev: GSL should deal with an uninitialised rng better

2009-09-09 Thread Matthew Vernon
Package: libgsl0-dev
Version: 1.11+dfsg-1
Severity: normal

Hi,

If you call any of the random-number functions in GSL and forget to 
initialise the random number generator (or initialise it wrongly), GSL 
SEGVs. This is poor - it should produce an error message. I deal with 
queries from people this has confused surprisingly frequently.

Regards,

Matthew

-- System Information:
Debian Release: 5.0.3
  APT prefers stable
  APT policy: (500, 'stable')
Architecture: amd64 (x86_64)

Kernel: Linux 2.6.20-2-macpro-amd64 (SMP w/4 CPU cores)
Locale: LANG=en_GB.UTF-8, LC_CTYPE=en_GB.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/bash

Versions of packages libgsl0-dev depends on:
ii  libgsl0ldbl  1.11+dfsg-1 GNU Scientific Library (GSL) -- li

libgsl0-dev recommends no packages.

libgsl0-dev suggests no packages.

-- no debconf information



-- 
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org