ruby-core@ruby-lang.org archive (unofficial mirror)
 help / color / mirror / Atom feed
* [ruby-core:83062] [Ruby trunk Bug#13952] String#succ not updating code range
       [not found] <redmine.issue-13952.20170929134654@ruby-lang.org>
@ 2017-09-29 13:46 ` ruby
  2017-12-24 19:14 ` [ruby-core:84432] " nagachika00
  2018-01-31 13:30 ` [ruby-core:85304] " usa
  2 siblings, 0 replies; 3+ messages in thread
From: ruby @ 2017-09-29 13:46 UTC (permalink / raw
  To: ruby-core

Issue #13952 has been reported by nirvdrum (Kevin Menard).

----------------------------------------
Bug #13952: String#succ not updating code range
https://bugs.ruby-lang.org/issues/13952

* Author: nirvdrum (Kevin Menard)
* Status: Open
* Priority: Normal
* Assignee: 
* Target version: 
* ruby -v: ruby 2.4.2p198 (2017-09-14 revision 59899) [x86_64-linux]
* Backport: 2.3: UNKNOWN, 2.4: UNKNOWN
----------------------------------------
I'm seeing some strange behavior with `String#succ` and updating code ranges. I haven't yet traced the code to see what the culprit is, but I'm reproducing my findings here so they don't get lost (and maybe someone has a better idea of what's going on.)

This sequence of calls produces the expected output.

```
x = "\xFF".force_encoding("binary")
y = x.succ
z = String.new
z << 0x01 << 0x00

puts "x ASCII-only?: #{x.ascii_only?}"
puts "y ASCII-only?: #{y.ascii_only?}"
puts "z ASCII-only?: #{z.ascii_only?}"
puts "y Encoding: #{y.encoding}"
puts "y Bytes: #{y.bytes}"
puts "z Encoding: #{z.encoding}"
puts "z Bytes: #{z.bytes}"

```

The output is:

```
x ASCII-only?: false
y ASCII-only?: true
z ASCII-only?: true
y Encoding: ASCII-8BIT
y Bytes: [1, 0]
z Encoding: ASCII-8BIT
z Bytes: [1, 0]
```

However, by inserting a call that would force `x` to calculate its code range prior to the `String#succ` call, we get a different set of results:

```
x = "\xFF".force_encoding("binary")
x.ascii_only?
y = x.succ
z = String.new
z << 0x01 << 0x00

puts "x ASCII-only?: #{x.ascii_only?}"
puts "y ASCII-only?: #{y.ascii_only?}"
puts "z ASCII-only?: #{z.ascii_only?}"
puts "y Encoding: #{y.encoding}"
puts "y Bytes: #{y.bytes}"
puts "z Encoding: #{z.encoding}"
puts "z Bytes: #{z.bytes}"
```

Now we see that `y` isn't considered to be ASCII-only, even though it has the exact same encoding and byte sequence as `z` (and as `y` in the previous call sequence that did work):

```
x ASCII-only?: false
y ASCII-only?: false
z ASCII-only?: true
y Encoding: ASCII-8BIT
y Bytes: [1, 0]
z Encoding: ASCII-8BIT
z Bytes: [1, 0]
```

Having not looked at it, it looks like the code range isn't updated and we only get the correct result if `CR_UNKNOWN` hasn't been replaced by some other call that needs the code range.






-- 
https://bugs.ruby-lang.org/

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

* [ruby-core:84432] [Ruby trunk Bug#13952] String#succ not updating code range
       [not found] <redmine.issue-13952.20170929134654@ruby-lang.org>
  2017-09-29 13:46 ` [ruby-core:83062] [Ruby trunk Bug#13952] String#succ not updating code range ruby
@ 2017-12-24 19:14 ` nagachika00
  2018-01-31 13:30 ` [ruby-core:85304] " usa
  2 siblings, 0 replies; 3+ messages in thread
From: nagachika00 @ 2017-12-24 19:14 UTC (permalink / raw
  To: ruby-core

Issue #13952 has been updated by nagachika (Tomoyuki Chikanaga).

Backport changed from 2.3: REQUIRED, 2.4: REQUIRED to 2.3: REQUIRED, 2.4: DONE

ruby_2_4 r61455 merged revision(s) 60066.

----------------------------------------
Bug #13952: String#succ not updating code range
https://bugs.ruby-lang.org/issues/13952#change-68627

* Author: nirvdrum (Kevin Menard)
* Status: Closed
* Priority: Normal
* Assignee: 
* Target version: 
* ruby -v: ruby 2.4.2p198 (2017-09-14 revision 59899) [x86_64-linux]
* Backport: 2.3: REQUIRED, 2.4: DONE
----------------------------------------
I'm seeing some strange behavior with `String#succ` and updating code ranges. I haven't yet traced the code to see what the culprit is, but I'm reproducing my findings here so they don't get lost (and maybe someone has a better idea of what's going on.)

This sequence of calls produces the expected output.

```
x = "\xFF".force_encoding("binary")
y = x.succ
z = String.new
z << 0x01 << 0x00

puts "x ASCII-only?: #{x.ascii_only?}"
puts "y ASCII-only?: #{y.ascii_only?}"
puts "z ASCII-only?: #{z.ascii_only?}"
puts "y Encoding: #{y.encoding}"
puts "y Bytes: #{y.bytes}"
puts "z Encoding: #{z.encoding}"
puts "z Bytes: #{z.bytes}"

```

The output is:

```
x ASCII-only?: false
y ASCII-only?: true
z ASCII-only?: true
y Encoding: ASCII-8BIT
y Bytes: [1, 0]
z Encoding: ASCII-8BIT
z Bytes: [1, 0]
```

However, by inserting a call that would force `x` to calculate its code range prior to the `String#succ` call, we get a different set of results:

```
x = "\xFF".force_encoding("binary")
x.ascii_only?
y = x.succ
z = String.new
z << 0x01 << 0x00

puts "x ASCII-only?: #{x.ascii_only?}"
puts "y ASCII-only?: #{y.ascii_only?}"
puts "z ASCII-only?: #{z.ascii_only?}"
puts "y Encoding: #{y.encoding}"
puts "y Bytes: #{y.bytes}"
puts "z Encoding: #{z.encoding}"
puts "z Bytes: #{z.bytes}"
```

Now we see that `y` isn't considered to be ASCII-only, even though it has the exact same encoding and byte sequence as `z` (and as `y` in the previous call sequence that did work):

```
x ASCII-only?: false
y ASCII-only?: false
z ASCII-only?: true
y Encoding: ASCII-8BIT
y Bytes: [1, 0]
z Encoding: ASCII-8BIT
z Bytes: [1, 0]
```

Having not looked at it, it looks like the code range isn't updated and we only get the correct result if `CR_UNKNOWN` hasn't been replaced by some other call that needs the code range.






-- 
https://bugs.ruby-lang.org/

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

* [ruby-core:85304] [Ruby trunk Bug#13952] String#succ not updating code range
       [not found] <redmine.issue-13952.20170929134654@ruby-lang.org>
  2017-09-29 13:46 ` [ruby-core:83062] [Ruby trunk Bug#13952] String#succ not updating code range ruby
  2017-12-24 19:14 ` [ruby-core:84432] " nagachika00
@ 2018-01-31 13:30 ` usa
  2 siblings, 0 replies; 3+ messages in thread
From: usa @ 2018-01-31 13:30 UTC (permalink / raw
  To: ruby-core

Issue #13952 has been updated by usa (Usaku NAKAMURA).

Backport changed from 2.3: REQUIRED, 2.4: DONE to 2.3: DONE, 2.4: DONE

ruby_2_3 r62139 merged revision(s) 60066.

----------------------------------------
Bug #13952: String#succ not updating code range
https://bugs.ruby-lang.org/issues/13952#change-70084

* Author: nirvdrum (Kevin Menard)
* Status: Closed
* Priority: Normal
* Assignee: 
* Target version: 
* ruby -v: ruby 2.4.2p198 (2017-09-14 revision 59899) [x86_64-linux]
* Backport: 2.3: DONE, 2.4: DONE
----------------------------------------
I'm seeing some strange behavior with `String#succ` and updating code ranges. I haven't yet traced the code to see what the culprit is, but I'm reproducing my findings here so they don't get lost (and maybe someone has a better idea of what's going on.)

This sequence of calls produces the expected output.

```
x = "\xFF".force_encoding("binary")
y = x.succ
z = String.new
z << 0x01 << 0x00

puts "x ASCII-only?: #{x.ascii_only?}"
puts "y ASCII-only?: #{y.ascii_only?}"
puts "z ASCII-only?: #{z.ascii_only?}"
puts "y Encoding: #{y.encoding}"
puts "y Bytes: #{y.bytes}"
puts "z Encoding: #{z.encoding}"
puts "z Bytes: #{z.bytes}"

```

The output is:

```
x ASCII-only?: false
y ASCII-only?: true
z ASCII-only?: true
y Encoding: ASCII-8BIT
y Bytes: [1, 0]
z Encoding: ASCII-8BIT
z Bytes: [1, 0]
```

However, by inserting a call that would force `x` to calculate its code range prior to the `String#succ` call, we get a different set of results:

```
x = "\xFF".force_encoding("binary")
x.ascii_only?
y = x.succ
z = String.new
z << 0x01 << 0x00

puts "x ASCII-only?: #{x.ascii_only?}"
puts "y ASCII-only?: #{y.ascii_only?}"
puts "z ASCII-only?: #{z.ascii_only?}"
puts "y Encoding: #{y.encoding}"
puts "y Bytes: #{y.bytes}"
puts "z Encoding: #{z.encoding}"
puts "z Bytes: #{z.bytes}"
```

Now we see that `y` isn't considered to be ASCII-only, even though it has the exact same encoding and byte sequence as `z` (and as `y` in the previous call sequence that did work):

```
x ASCII-only?: false
y ASCII-only?: false
z ASCII-only?: true
y Encoding: ASCII-8BIT
y Bytes: [1, 0]
z Encoding: ASCII-8BIT
z Bytes: [1, 0]
```

Having not looked at it, it looks like the code range isn't updated and we only get the correct result if `CR_UNKNOWN` hasn't been replaced by some other call that needs the code range.






-- 
https://bugs.ruby-lang.org/

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

end of thread, other threads:[~2018-01-31 13:30 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <redmine.issue-13952.20170929134654@ruby-lang.org>
2017-09-29 13:46 ` [ruby-core:83062] [Ruby trunk Bug#13952] String#succ not updating code range ruby
2017-12-24 19:14 ` [ruby-core:84432] " nagachika00
2018-01-31 13:30 ` [ruby-core:85304] " usa

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).