File 0228-stdlib-fix-record-definitions-in-shell.patch of Package erlang

From 2706081378c52fedc804030c4c3c2823fdbdb37d Mon Sep 17 00:00:00 2001
From: Fredrik Frantzen <frazze@erlang.org>
Date: Fri, 14 Mar 2025 06:49:23 +0100
Subject: [PATCH 1/2] stdlib: fix record definitions in shell

allow "" in fields of record definitions in the shell
1> -record(a, {a=""}).

OTP-19533
---
 lib/stdlib/src/shell.erl        | 2 +-
 lib/stdlib/test/shell_SUITE.erl | 8 ++++----
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/lib/stdlib/src/shell.erl b/lib/stdlib/src/shell.erl
index 8075e658cd..ad0228f647 100644
--- a/lib/stdlib/src/shell.erl
+++ b/lib/stdlib/src/shell.erl
@@ -374,7 +374,7 @@ get_command(Prompt, Eval, Bs, RT, FT, Ds) ->
                                   SpecialCase = fun(LocalFunc) ->
                                                         FakeLine = begin
                                                                        case erl_parse:parse_form(Toks) of
-                                                                           {ok, Def} -> lists:flatten(erl_pp:form(Def));
+                                                                           {ok, Def} -> lists:flatten(escape_quotes(lists:flatten(erl_pp:form(Def))));
                                                                            E ->
                                                                             exit(E)
                                                                        end
diff --git a/lib/stdlib/test/shell_SUITE.erl b/lib/stdlib/test/shell_SUITE.erl
index 9b50f8cee3..86f7ce2fed 100644
--- a/lib/stdlib/test/shell_SUITE.erl
+++ b/lib/stdlib/test/shell_SUITE.erl
@@ -389,12 +389,12 @@ shell_attribute_test(Config) ->
       "-kernel","shell_history_drop","[\"init:stop().\"]"]),
     receive after 1000 -> ok end,
     rtnode:run(
-        [{putline, "-record(hej, {a = 0 :: integer()})."},
+        [{putline, "-record(hej, {a = \"\", b = 0 :: integer()})."},
          {expect, "ok"},
          {putline, "rl()."},
-         {expect, "\\Q-record(hej,{a = 0 :: integer()}).\\E"},
-         {putline, "#hej{a=1}."},
-         {expect, "\\Q#hej{a = 1}\\E"}
+         {expect, "\\Q-record(hej,{a = \"\", b = 0 :: integer()}).\\E"},
+         {putline, "#hej{a = \"hej\", b=1}."},
+         {expect, "\\Q#hej{a = \"hej\", b=1}\\E"}
         ],[],"", ["-kernel","shell_history","enabled",
         "-kernel","shell_history_path","\"" ++ Path ++ "\"",
         "-kernel","shell_history_drop","[\"init:stop().\"]"]),
-- 
2.43.0

openSUSE Build Service is sponsored by