Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
home:Ledest:erlang:23
erlang
3021-beam_lib-Fix-allow_missing_chunks-for-name...
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File 3021-beam_lib-Fix-allow_missing_chunks-for-named-chunks.patch of Package erlang
From 6a49e3971e115aac6921bff555eaf36466bbf9ca Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?John=20H=C3=B6gberg?= <john@erlang.org> Date: Mon, 19 Oct 2020 14:32:19 +0200 Subject: [PATCH] beam_lib: Fix 'allow_missing_chunks' for named chunks --- lib/stdlib/src/beam_lib.erl | 3 +++ lib/stdlib/test/beam_lib_SUITE.erl | 7 +++++++ 2 files changed, 10 insertions(+) diff --git a/lib/stdlib/src/beam_lib.erl b/lib/stdlib/src/beam_lib.erl index 5632da803d..da41e717fe 100644 --- a/lib/stdlib/src/beam_lib.erl +++ b/lib/stdlib/src/beam_lib.erl @@ -700,6 +700,9 @@ chunks_to_data([{Id, Name} | CNs], Chunks, File, Cs, Module, Atoms, L) -> chunks_to_data([], _Chunks, _File, _Cs, Module, _Atoms, L) -> {ok, {Module, reverse(L)}}. +chunk_to_data(Id, missing_chunk, _File, _Cs, AtomTable, _Mod) -> + %% Missing chunk, only happens when 'allow_missing_chunks' is on. + {AtomTable, {Id, missing_chunk}}; chunk_to_data(attributes=Id, Chunk, File, _Cs, AtomTable, _Mod) -> try Term = binary_to_term(Chunk), diff --git a/lib/stdlib/test/beam_lib_SUITE.erl b/lib/stdlib/test/beam_lib_SUITE.erl index 9ef85a15e0..68d490ddef 100644 --- a/lib/stdlib/test/beam_lib_SUITE.erl +++ b/lib/stdlib/test/beam_lib_SUITE.erl @@ -145,6 +145,13 @@ do_normal(BeamFile, Opts) -> {{AtomBin, missing_chunk}, [no_utf8_atoms]} when is_binary(AtomBin) -> ok end, + %% 'allow_missing_chunks' should work for named chunks too. + {ok, {simple, StrippedBeam}} = beam_lib:strip(BeamFile), + {ok, {simple, MChunks}} = beam_lib:chunks(StrippedBeam, + [attributes, locals], + [allow_missing_chunks]), + [{attributes, missing_chunk}, {locals, missing_chunk}] = MChunks, + %% Make sure that reading the atom chunk works when the 'allow_missing_chunks' %% option is used. Some = ["Code",atoms,"ExpT","LitT"], -- 2.26.2
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor