* Re: issues with recent doprnt-related changes
[not found] ` <E1QHYkc-0008Ip-Tq@fencepost.gnu.org>
@ 2011-05-04 14:56 ` Paul Eggert
2011-05-05 20:36 ` Eli Zaretskii
0 siblings, 1 reply; 9+ messages in thread
From: Paul Eggert @ 2011-05-04 14:56 UTC (permalink / raw)
To: Eli Zaretskii; +Cc: 8545, Emacs Development
On 05/04/11 02:52, Eli Zaretskii wrote:
>> It seems from that discussion that strings can contain MOST_POSITIVE_FIXNUM bytes.
> I think the conclusion was that it can contain MOST_POSITIVE_FIXNUM
> _including_the_terminating_null_.
Hmm, that's not how I read
<http://lists.gnu.org/archive/html/emacs-devel/2011-04/msg00923.html>.
I understood the argument to be that a buffer must contain at most
MOST_POSITIVE_FIXNUM - 1 bytes due to other reasons, but it's OK
to have "a string whose length is MOST_POSITIVE_FIXNUM", i.e.,
(= (length STRING) most-positive-fixnum), because we already check
buffer sizes before inserting strings. If you
count the trailing byte, the length of the underlying C character
array would be MOST_POSITIVE_FIXNUM + 1.
I'll CC: this to emacs-devel just in case I misinterpreted that.
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: issues with recent doprnt-related changes
2011-05-04 14:56 ` issues with recent doprnt-related changes Paul Eggert
@ 2011-05-05 20:36 ` Eli Zaretskii
2011-05-06 13:33 ` Stefan Monnier
0 siblings, 1 reply; 9+ messages in thread
From: Eli Zaretskii @ 2011-05-05 20:36 UTC (permalink / raw)
To: Paul Eggert, Stefan Monnier; +Cc: 8545, emacs-devel
> Date: Wed, 04 May 2011 07:56:43 -0700
> From: Paul Eggert <eggert@cs.ucla.edu>
> CC: 8545@debbugs.gnu.org, Emacs Development <emacs-devel@gnu.org>
>
> On 05/04/11 02:52, Eli Zaretskii wrote:
> >> It seems from that discussion that strings can contain MOST_POSITIVE_FIXNUM bytes.
> > I think the conclusion was that it can contain MOST_POSITIVE_FIXNUM
> > _including_the_terminating_null_.
>
> Hmm, that's not how I read
> <http://lists.gnu.org/archive/html/emacs-devel/2011-04/msg00923.html>.
>
> I understood the argument to be that a buffer must contain at most
> MOST_POSITIVE_FIXNUM - 1 bytes due to other reasons, but it's OK
> to have "a string whose length is MOST_POSITIVE_FIXNUM", i.e.,
> (= (length STRING) most-positive-fixnum), because we already check
> buffer sizes before inserting strings. If you
> count the trailing byte, the length of the underlying C character
> array would be MOST_POSITIVE_FIXNUM + 1.
Stefan, could you please chime in?
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: issues with recent doprnt-related changes
2011-05-05 20:36 ` Eli Zaretskii
@ 2011-05-06 13:33 ` Stefan Monnier
2011-05-06 14:41 ` Paul Eggert
2011-05-06 15:03 ` Eli Zaretskii
0 siblings, 2 replies; 9+ messages in thread
From: Stefan Monnier @ 2011-05-06 13:33 UTC (permalink / raw)
To: Eli Zaretskii; +Cc: 8545, Paul Eggert, emacs-devel
>> >> It seems from that discussion that strings can contain
>> >> MOST_POSITIVE_FIXNUM bytes.
>> > I think the conclusion was that it can contain MOST_POSITIVE_FIXNUM
>> > _including_the_terminating_null_.
>>
>> Hmm, that's not how I read
>> <http://lists.gnu.org/archive/html/emacs-devel/2011-04/msg00923.html>.
>>
>> I understood the argument to be that a buffer must contain at most
>> MOST_POSITIVE_FIXNUM - 1 bytes due to other reasons, but it's OK
>> to have "a string whose length is MOST_POSITIVE_FIXNUM", i.e.,
>> (= (length STRING) most-positive-fixnum), because we already check
>> buffer sizes before inserting strings. If you
>> count the trailing byte, the length of the underlying C character
>> array would be MOST_POSITIVE_FIXNUM + 1.
> Stefan, could you please chime in?
I'm not sure I understand the details more than you do. AFAIK the
MOST_POSITIVE_FIXNUM limit only comes into play when the number goes
through Lisp_Object somewhere. And we never show "length, including
terminating nul-byte" to Elisp, so the nul-byte shouldn't matter: while
the C array will have size MOST_POSITIVE_FIXNUM + 1, this will only be
represented in EMACS_INT which can accommodate it just fine.
Stefan
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: issues with recent doprnt-related changes
2011-05-06 13:33 ` Stefan Monnier
@ 2011-05-06 14:41 ` Paul Eggert
2011-05-06 15:03 ` Eli Zaretskii
1 sibling, 0 replies; 9+ messages in thread
From: Paul Eggert @ 2011-05-06 14:41 UTC (permalink / raw)
To: Stefan Monnier; +Cc: Eli Zaretskii, 8545, emacs-devel
On 05/06/11 06:33, Stefan Monnier wrote:
> I'm not sure I understand the details more than you do. AFAIK the
> MOST_POSITIVE_FIXNUM limit only comes into play when the number goes
> through Lisp_Object somewhere. And we never show "length, including
> terminating nul-byte" to Elisp, so the nul-byte shouldn't matter: while
> the C array will have size MOST_POSITIVE_FIXNUM + 1, this will only be
> represented in EMACS_INT which can accommodate it just fine.
First, you say you're not sure you understand the details;
then, you explain the situation perfectly! :-)
Thanks.
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: issues with recent doprnt-related changes
2011-05-06 13:33 ` Stefan Monnier
2011-05-06 14:41 ` Paul Eggert
@ 2011-05-06 15:03 ` Eli Zaretskii
2011-05-06 17:13 ` Stefan Monnier
1 sibling, 1 reply; 9+ messages in thread
From: Eli Zaretskii @ 2011-05-06 15:03 UTC (permalink / raw)
To: Stefan Monnier; +Cc: 8545, eggert, emacs-devel
> From: Stefan Monnier <monnier@iro.umontreal.ca>
> Cc: Paul Eggert <eggert@cs.ucla.edu>, 8545@debbugs.gnu.org, emacs-devel@gnu.org
> Date: Fri, 06 May 2011 10:33:21 -0300
>
> And we never show "length, including
> terminating nul-byte" to Elisp, so the nul-byte shouldn't matter
If you are sure of that, then I agree it's fine to use
MOST_POSITIVE_FIXNUM+1. I wasn't sure. I do see in C variables that
explicitly use the string position of the null byte; I was afraid that
they could somehow leak to Lisp.
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: issues with recent doprnt-related changes
2011-05-06 15:03 ` Eli Zaretskii
@ 2011-05-06 17:13 ` Stefan Monnier
2011-05-06 19:57 ` Eli Zaretskii
0 siblings, 1 reply; 9+ messages in thread
From: Stefan Monnier @ 2011-05-06 17:13 UTC (permalink / raw)
To: Eli Zaretskii; +Cc: 8545, eggert, emacs-devel
>> And we never show "length, including
>> terminating nul-byte" to Elisp, so the nul-byte shouldn't matter
> If you are sure of that, then I agree it's fine to use
> MOST_POSITIVE_FIXNUM+1. I wasn't sure. I do see in C variables that
> explicitly use the string position of the null byte; I was afraid that
> they could somehow leak to Lisp.
I don't know enough to guarantee you that they can never leak to Lisp,
but I can't think of any reason why they should. And note that "the
position of the nul byte" is the same as "the length of the list", so
it's still <= MOST_POSITIVE_FIXNUM. It's only the position after the
nul byte that would overflow.
Stefan
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: issues with recent doprnt-related changes
2011-05-06 17:13 ` Stefan Monnier
@ 2011-05-06 19:57 ` Eli Zaretskii
2011-05-07 3:18 ` Stefan Monnier
0 siblings, 1 reply; 9+ messages in thread
From: Eli Zaretskii @ 2011-05-06 19:57 UTC (permalink / raw)
To: Stefan Monnier; +Cc: 8545, eggert, emacs-devel
> From: Stefan Monnier <monnier@iro.umontreal.ca>
> Cc: eggert@cs.ucla.edu, 8545@debbugs.gnu.org, emacs-devel@gnu.org
> Date: Fri, 06 May 2011 14:13:06 -0300
>
> note that "the position of the nul byte" is the same as "the length
> of the list", so it's still <= MOST_POSITIVE_FIXNUM. It's only the
> position after the nul byte that would overflow.
But what about this code and its commentary (from
next_element_from_c_string):
/* IT's position can be greater IT->string_nchars in case a field
width or precision has been specified when the iterator was
initialized. */
if (IT_CHARPOS (*it) >= it->end_charpos)
{
/* End of the game. */
...
This happens when the iterator is initialized by reseat_to_string.
Admittedly, it's not very practical to have such huge strings that are
padded to an even larger width...
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: issues with recent doprnt-related changes
2011-05-06 19:57 ` Eli Zaretskii
@ 2011-05-07 3:18 ` Stefan Monnier
2011-05-07 7:55 ` Eli Zaretskii
0 siblings, 1 reply; 9+ messages in thread
From: Stefan Monnier @ 2011-05-07 3:18 UTC (permalink / raw)
To: Eli Zaretskii; +Cc: 8545, eggert, emacs-devel
>> note that "the position of the nul byte" is the same as "the length
>> of the list", so it's still <= MOST_POSITIVE_FIXNUM. It's only the
>> position after the nul byte that would overflow.
> But what about this code and its commentary (from
> next_element_from_c_string):
> /* IT's position can be greater IT->string_nchars in case a field
> width or precision has been specified when the iterator was
> initialized. */
> if (IT_CHARPOS (*it) >= it->end_charpos)
> {
> /* End of the game. */
> ...
Do these ever make it into a Lisp_Object?
Stefan
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: issues with recent doprnt-related changes
2011-05-07 3:18 ` Stefan Monnier
@ 2011-05-07 7:55 ` Eli Zaretskii
0 siblings, 0 replies; 9+ messages in thread
From: Eli Zaretskii @ 2011-05-07 7:55 UTC (permalink / raw)
To: Stefan Monnier; +Cc: 8545, eggert, emacs-devel
> From: Stefan Monnier <monnier@iro.umontreal.ca>
> Cc: eggert@cs.ucla.edu, 8545@debbugs.gnu.org, emacs-devel@gnu.org
> Date: Sat, 07 May 2011 00:18:47 -0300
>
> >> note that "the position of the nul byte" is the same as "the length
> >> of the list", so it's still <= MOST_POSITIVE_FIXNUM. It's only the
> >> position after the nul byte that would overflow.
>
> > But what about this code and its commentary (from
> > next_element_from_c_string):
>
> > /* IT's position can be greater IT->string_nchars in case a field
> > width or precision has been specified when the iterator was
> > initialized. */
> > if (IT_CHARPOS (*it) >= it->end_charpos)
> > {
> > /* End of the game. */
> > ...
>
> Do these ever make it into a Lisp_Object?
Well, the resulting string can be returned by format-mode-line, for
example.
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2011-05-07 7:55 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <4DB50AB9.6060100@cs.ucla.edu>
[not found] ` <83tydmaeo3.fsf@gnu.org>
[not found] ` <4DB65FF1.5010003@cs.ucla.edu>
[not found] ` <83aafb8p4a.fsf@gnu.org>
[not found] ` <4DB8ABEA.3080503@cs.ucla.edu>
[not found] ` <E1QFK7p-0000de-I3@fencepost.gnu.org>
[not found] ` <4DB9146D.2040702@cs.ucla.edu>
[not found] ` <E1QFQVO-0004Dq-6o@fencepost.gnu.org>
[not found] ` <4DB9E5FF.9020506@cs.ucla.edu>
[not found] ` <83d3k571ee.fsf@gnu.org>
[not found] ` <4DC10012.8020809@cs.ucla.edu>
[not found] ` <E1QHYkc-0008Ip-Tq@fencepost.gnu.org>
2011-05-04 14:56 ` issues with recent doprnt-related changes Paul Eggert
2011-05-05 20:36 ` Eli Zaretskii
2011-05-06 13:33 ` Stefan Monnier
2011-05-06 14:41 ` Paul Eggert
2011-05-06 15:03 ` Eli Zaretskii
2011-05-06 17:13 ` Stefan Monnier
2011-05-06 19:57 ` Eli Zaretskii
2011-05-07 3:18 ` Stefan Monnier
2011-05-07 7:55 ` Eli Zaretskii
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
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 read-only IMAP folder(s) and NNTP newsgroup(s).