[#108771] [Ruby master Bug#18816] Ractor segfaulting MacOS 12.4 (aarch64 / M1 processor) — "brodock (Gabriel Mazetto)" <noreply@...>

Issue #18816 has been reported by brodock (Gabriel Mazetto).

8 messages 2022/06/05

[#108802] [Ruby master Feature#18821] Expose Pattern Matching interfaces in core classes — "baweaver (Brandon Weaver)" <noreply@...>

Issue #18821 has been reported by baweaver (Brandon Weaver).

9 messages 2022/06/08

[#108822] [Ruby master Feature#18822] Ruby lack a proper method to percent-encode strings for URIs (RFC 3986) — "byroot (Jean Boussier)" <noreply@...>

Issue #18822 has been reported by byroot (Jean Boussier).

18 messages 2022/06/09

[#108937] [Ruby master Bug#18832] Suspicious superclass mismatch — "fxn (Xavier Noria)" <noreply@...>

Issue #18832 has been reported by fxn (Xavier Noria).

16 messages 2022/06/15

[#108976] [Ruby master Misc#18836] DevMeeting-2022-07-21 — "mame (Yusuke Endoh)" <noreply@...>

Issue #18836 has been reported by mame (Yusuke Endoh).

12 messages 2022/06/17

[#109043] [Ruby master Bug#18876] OpenSSL is not available with `--with-openssl-dir` — "Gloomy_meng (Gloomy Meng)" <noreply@...>

Issue #18876 has been reported by Gloomy_meng (Gloomy Meng).

18 messages 2022/06/23

[#109052] [Ruby master Bug#18878] parse.y: Foo::Bar {} is inconsistently rejected — "qnighy (Masaki Hara)" <noreply@...>

Issue #18878 has been reported by qnighy (Masaki Hara).

9 messages 2022/06/26

[#109055] [Ruby master Bug#18881] IO#read_nonblock raises IOError when called following buffered character IO — "javanthropus (Jeremy Bopp)" <noreply@...>

Issue #18881 has been reported by javanthropus (Jeremy Bopp).

9 messages 2022/06/26

[#109063] [Ruby master Bug#18882] File.read cuts off a text file with special characters when reading it on MS Windows — magynhard <noreply@...>

Issue #18882 has been reported by magynhard (Matth辰us Johannes Beyrle).

15 messages 2022/06/27

[#109081] [Ruby master Feature#18885] Long lived fork advisory API (potential Copy on Write optimizations) — "byroot (Jean Boussier)" <noreply@...>

Issue #18885 has been reported by byroot (Jean Boussier).

23 messages 2022/06/28

[#109083] [Ruby master Bug#18886] Struct aref and aset don't trigger any tracepoints. — "ioquatix (Samuel Williams)" <noreply@...>

Issue #18886 has been reported by ioquatix (Samuel Williams).

8 messages 2022/06/29

[#109095] [Ruby master Misc#18888] Migrate ruby-lang.org mail services to Google Domains and Google Workspace — "shugo (Shugo Maeda)" <noreply@...>

Issue #18888 has been reported by shugo (Shugo Maeda).

16 messages 2022/06/30

[ruby-core:108769] [Ruby master Feature#18159] Integrate functionality of dead_end gem into Ruby

From: "schneems (Richard Schneeman)" <noreply@...>
Date: 2022-06-03 20:07:16 UTC
List: ruby-core #108769
Issue #18159 has been updated by schneems (Richard Schneeman).


Having `SyntaxError#file_path` would be hugely helpful, there are some non-trivial edge cases I have to handle when reading the file name from the message: https://github.com/zombocom/dead_end/blob/main/spec/unit/pathname_from_message_spec.rb.  It would be best to not have to guess. Handling escape codes makes it harder https://github.com/zombocom/dead_end/pull/147.

> The input from STDIN can be got from SCRIPT_LINES__ hash if it is set.

Interesting, thank you. I did not know about this interface. I see that you must enable it via setting a hash first:

```
$ cat foo.rb
SCRIPT_LINES__ = {} unless defined?(SCRIPT_LINES__)
$ echo 'puts 1; puts SCRIPT_LINES__' | ruby -r./foo.rb
1
{"-"=>["puts 1; puts SCRIPT_LINES__\n"]}
```

Then afterwards you can see all contents. 

I am worried about the memory implications for enabling this by default. Is that a valid concern? If we are storing the contents of all files parsed in memory and are loading many files that will cause extra memory use I think.

Perhaps there is a way to mitigate the memory problem, for example if we could detect somehow that code is being streamed to the ruby process we could enable it, and then disable it once the code finishes. However if someone is streaming code to something like a Rails application process it could still incur a large memory overhead.

Another problem is that even if that did work, the monkeypatch to `detailed_message` does not seem to fire for code that is streamed:

```
$ ruby -v
ruby 3.2.0preview1 (2022-04-03 master f801386f0c) [x86_64-darwin20]
$ cat monkeypatch.rb
SyntaxError.prepend Module.new {
  def detailed_message(highlight: nil, **)
    message = super
    message += "Monkeypatch worked\n"
    message
  end
}
$ echo "def bad" | ruby -rmonkeypatch -I.
-:1: syntax error, unexpected end-of-input
def bad
```

> Note that there is no "monkeypatch worked" in the output.

This seems similar to the issue I reported in this comment https://github.com/ruby/ruby/pull/5516#issuecomment-1134945989.

Overall the known compatibility issues with dead_end and Ruby 3.2 are currently:

- Does not work with streaming code from STDIN (i.e. `echo 'def bad' | ruby` )
  - Monkeypatch not working with SyntaxError w/ streaming
  - Possible memory bloat with enabling SCRIPT_LINES__ by default to obtain streaming contents?
- Does not work when executing a file directly (i.e. `ruby bad.rb`)
  - Monkeypatch not working with SyntaxError w/ direct file running
  - Cannot get source code
- Does not work with eval
  - Monkeypatch not working w/ eval
  - Cannot get source code
- Does not work with ruby `-e` command.
  - Monekeypatch does not work with `-e`
  - Cannot get source code


I think that it is not 100% critical to support all of these at the start. I view `dead_end` as a "progressive enhancement". When it fires it gives helpful context, otherwise it is no worse than prior existing error message. The more cases we can support I think the better it will be, however I don't have the ability to fix these listed issues.

----------------------------------------
Feature #18159: Integrate functionality of dead_end gem into Ruby
https://bugs.ruby-lang.org/issues/18159#change-97834

* Author: duerst (Martin D端rst)
* Status: Open
* Priority: Normal
* Assignee: matz (Yukihiro Matsumoto)
* Target version: 3.1
----------------------------------------
Missing 'end' errors are difficult to fix. We should integrate the functionality of the dead_end gem (https://github.com/zombocom/dead_end) into Ruby similar to how we integrated did_you_mean. It would greatly help programming Ruby, in particular for beginners.

See also Ruby Kaigi Takeout 2021 talk by Richard Schneeman https://rubykaigi.org/2021-takeout/presentations/schneems.html.



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

Unsubscribe: <mailto:ruby-core-request@ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>

In This Thread