GNU bug report logs - #15370
weirdness w/ uniform-vector-read! compat

Previous Next

Package: guile;

Reported by: Thien-Thi Nguyen <ttn <at> gnu.org>

Date: Fri, 13 Sep 2013 15:57:03 UTC

Severity: normal

Done: Ian Price <ianprice90 <at> googlemail.com>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 15370 in the body.
You can then email your comments to 15370 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-guile <at> gnu.org:
bug#15370; Package guile. (Fri, 13 Sep 2013 15:57:03 GMT) Full text and rfc822 format available.

Acknowledgement sent to Thien-Thi Nguyen <ttn <at> gnu.org>:
New bug report received and forwarded. Copy sent to bug-guile <at> gnu.org. (Fri, 13 Sep 2013 15:57:03 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Thien-Thi Nguyen <ttn <at> gnu.org>
To: bug-guile <at> gnu.org
Subject: weirdness w/ uniform-vector-read! compat
Date: Fri, 13 Sep 2013 17:49:56 +0200
[Message part 1 (text/plain, inline)]
Proc ‘uniform-vector-read!’ is deprecated (ugh), and its implementation
rebased onto ‘(rnrs io ports) get-bytevector-n!’.  Unfortunately, there
seems to be a glitch in the arg shuffling.  Here is /tmp/foo.scm:

[foo.scm (application/x-scheme, attachment)]
[Message part 3 (text/plain, inline)]
and here is a series of invocations that demonstrate the discrepency
between ‘get-bytevector-n!’ (ok) and ‘uniform-vector-read!’ (ko):

[badness (text/plain, inline)]
set -x ; guile --version ; guile -s foo.scm ; guile -s foo.scm ok ; guile -s foo.scm ko
+ guile --version
guile (GNU Guile) 2.0.9
Copyright (C) 2013 Free Software Foundation, Inc.

License LGPLv3+: GNU LGPL 3 or later <http://gnu.org/licenses/lgpl.html>.
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
+ guile -s foo.scm
uve: #s16(0) (2)
uve: #s16(0)
+ guile -s foo.scm ok
uve: #s16(0) (2)
uve: #s16(10794)
+ guile -s foo.scm ko
uve: #s16(0) (2)
`uniform-vector-read!' is deprecated. Use `get-bytevector-n!' from
`(rnrs io ports)' instead.
Backtrace:
In ice-9/boot-9.scm:
 157: 11 [catch #t #<catch-closure 8347f30> ...]
In unknown file:
   ?: 10 [apply-smob/1 #<catch-closure 8347f30>]
In ice-9/boot-9.scm:
  63: 9 [call-with-prompt prompt0 ...]
In ice-9/eval.scm:
 432: 8 [eval # #]
In ice-9/boot-9.scm:
2320: 7 [save-module-excursion #<procedure 8275ea0 at ice-9/boot-9.scm:3961:3 ()>]
3968: 6 [#<procedure 8275ea0 at ice-9/boot-9.scm:3961:3 ()>]
1645: 5 [%start-stack load-stack ...]
1650: 4 [#<procedure 83489c0 ()>]
In unknown file:
   ?: 3 [primitive-load "/tmp/foo.scm"]
   ?: 2 [call-with-input-string "****" ...]
In ice-9/eval.scm:
 432: 1 [eval # #]
In unknown file:
   ?: 0 [uniform-vector-read! #s16(0) #<input: string 8263d20> ...]

ERROR: In procedure uniform-vector-read!:
ERROR: In procedure get-bytevector-n!: Value out of range: 4
[Message part 5 (text/plain, inline)]
FWIW, Guile 1.8.8 produces same output as ‘ok’ on a similar (sans the
‘use-modules’ and ‘uniform-vector-element-size’ noise) input, so i think
this situation is a regression.  Am i missing something?

-- 
Thien-Thi Nguyen
   GPG key: 4C807502
   (if you're human and you know it)
      read my lisp: (responsep (questions 'technical)
                               (not (via 'mailing-list)))
                     => nil
[Message part 6 (application/pgp-signature, inline)]

Information forwarded to bug-guile <at> gnu.org:
bug#15370; Package guile. (Sun, 20 Oct 2013 09:00:03 GMT) Full text and rfc822 format available.

Message #8 received at 15370 <at> debbugs.gnu.org (full text, mbox):

From: Ian Price <ianprice90 <at> googlemail.com>
To: Thien-Thi Nguyen <ttn <at> gnu.org>
Cc: 15370 <at> debbugs.gnu.org
Subject: Re: bug#15370: weirdness w/ uniform-vector-read! compat
Date: Sun, 20 Oct 2013 09:59:26 +0100
Thien-Thi Nguyen <ttn <at> gnu.org> writes:

> ERROR: In procedure uniform-vector-read!:
> ERROR: In procedure get-bytevector-n!: Value out of range: 4
>
> FWIW, Guile 1.8.8 produces same output as ‘ok’ on a similar (sans the
> ‘use-modules’ and ‘uniform-vector-element-size’ noise) input, so i think
> this situation is a regression.  Am i missing something?

You'll notice that if you supply the parameters directly
e.g. (uniform-vector-read! uve port 0 1), it succeeds. That's enough to
pin it down to the lines

  c_end = SCM_UNBNDP (end) ? SCM_BYTEVECTOR_LENGTH (uvec) : scm_to_size_t (end);
  c_end *= c_width;

in scm_uniform_vector_read_x in libguile/deprecated.c 

Bytevector length returns the number of bytes, but end specifies the
index. We should only be multiplying the latter, not the former. Simple
fix is to fold the multiplication into the else branch of the
conditional.

Since this procedure is marked deprecated, I'd like to know how long it
has left before I patch it. Little point fixing it if it's soon...

Cheers
-- 
Ian Price -- shift-reset.com

"Programming is like pinball. The reward for doing it well is
the opportunity to do it again" - from "The Wizardy Compiled"




Information forwarded to bug-guile <at> gnu.org:
bug#15370; Package guile. (Sun, 20 Oct 2013 14:38:02 GMT) Full text and rfc822 format available.

Message #11 received at 15370 <at> debbugs.gnu.org (full text, mbox):

From: Ian Price <ianprice90 <at> googlemail.com>
To: Thien-Thi Nguyen <ttn <at> gnuvola.org>
Cc: 15370 <at> debbugs.gnu.org
Subject: Re: bug#15370: weirdness w/ uniform-vector-read! compat
Date: Sun, 20 Oct 2013 15:36:59 +0100
Thien-Thi Nguyen <ttn <at> gnuvola.org> writes:

> I think it is good to fix it regardless of the remaining time.  Leaving
> it in a known-bad state sends a message tinged w/ coercion -- Not Cool.

There has been talk of making the next version the first release of the
next major version. If the next version was the major version it would
likely mean removing deprecations. _That_ is the scenario I am concerned
about, not lording it over you to update your programs. A fix that never
gets released isn't a fix.

-- 
Ian Price -- shift-reset.com

"Programming is like pinball. The reward for doing it well is
the opportunity to do it again" - from "The Wizardy Compiled"




Information forwarded to bug-guile <at> gnu.org:
bug#15370; Package guile. (Sun, 20 Oct 2013 17:21:02 GMT) Full text and rfc822 format available.

Message #14 received at 15370 <at> debbugs.gnu.org (full text, mbox):

From: Mark H Weaver <mhw <at> netris.org>
To: Ian Price <ianprice90 <at> googlemail.com>
Cc: Thien-Thi Nguyen <ttn <at> gnu.org>, 15370 <at> debbugs.gnu.org
Subject: Re: bug#15370: weirdness w/ uniform-vector-read! compat
Date: Sun, 20 Oct 2013 13:18:54 -0400
Hi Ian,

Ian Price <ianprice90 <at> googlemail.com> writes:

> Thien-Thi Nguyen <ttn <at> gnu.org> writes:
>
>> ERROR: In procedure uniform-vector-read!:
>> ERROR: In procedure get-bytevector-n!: Value out of range: 4
>>
>> FWIW, Guile 1.8.8 produces same output as ‘ok’ on a similar (sans the
>> ‘use-modules’ and ‘uniform-vector-element-size’ noise) input, so i think
>> this situation is a regression.  Am i missing something?
>
> You'll notice that if you supply the parameters directly
> e.g. (uniform-vector-read! uve port 0 1), it succeeds. That's enough to
> pin it down to the lines
>
>   c_end = SCM_UNBNDP (end) ? SCM_BYTEVECTOR_LENGTH (uvec) : scm_to_size_t (end);
>   c_end *= c_width;
>
> in scm_uniform_vector_read_x in libguile/deprecated.c 
>
> Bytevector length returns the number of bytes, but end specifies the
> index. We should only be multiplying the latter, not the former. Simple
> fix is to fold the multiplication into the else branch of the
> conditional.

Indeed!

> Since this procedure is marked deprecated, I'd like to know how long it
> has left before I patch it. Little point fixing it if it's soon...

It will certainly not be removed in the 2.0.x release series, which will
remain in use for at least another year or so.  Therefore, this should
definitely be fixed.  Would you like to do it?

In any case, thanks for investigating!

     Mark




Reply sent to Ian Price <ianprice90 <at> googlemail.com>:
You have taken responsibility. (Sun, 20 Oct 2013 19:32:02 GMT) Full text and rfc822 format available.

Notification sent to Thien-Thi Nguyen <ttn <at> gnu.org>:
bug acknowledged by developer. (Sun, 20 Oct 2013 19:32:03 GMT) Full text and rfc822 format available.

Message #19 received at 15370-done <at> debbugs.gnu.org (full text, mbox):

From: Ian Price <ianprice90 <at> googlemail.com>
To: Mark H Weaver <mhw <at> netris.org>
Cc: Thien-Thi Nguyen <ttn <at> gnu.org>, 15370-done <at> debbugs.gnu.org
Subject: Re: bug#15370: weirdness w/ uniform-vector-read! compat
Date: Sun, 20 Oct 2013 20:30:58 +0100
Mark H Weaver <mhw <at> netris.org> writes:

> It will certainly not be removed in the 2.0.x release series, which will
> remain in use for at least another year or so.  Therefore, this should
> definitely be fixed.  Would you like to do it?

As long as it wasn't _next_ release, I am happy to fix it.

Patch pushed. Closing.

Cheers ttn
-- 
Ian Price -- shift-reset.com

"Programming is like pinball. The reward for doing it well is
the opportunity to do it again" - from "The Wizardy Compiled"




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Mon, 18 Nov 2013 12:24:05 GMT) Full text and rfc822 format available.

This bug report was last modified 10 years and 155 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.