Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
home:Ledest:erlang:23
erlang
0350-kernel-Correct-value-of-tag-head-of-disk_l...
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File 0350-kernel-Correct-value-of-tag-head-of-disk_log-info-1.patch of Package erlang
From 43f4852dab30296e8511f74b43fda0194e4ff3f7 Mon Sep 17 00:00:00 2001 From: Hans Bolinder <hasse@erlang.org> Date: Thu, 20 Aug 2020 13:05:04 +0200 Subject: [PATCH] kernel: Correct value of tag 'head' of disk_log:info/1 The value of the tag 'head' returned by disk_log:info/1 is corrected. It used to be {ok, Head}, now it is just Head. See also ERL-1313. --- lib/kernel/src/disk_log.erl | 10 +++++--- lib/kernel/test/disk_log_SUITE.erl | 39 +++++++++++++++++++++++++++--- 2 files changed, 42 insertions(+), 7 deletions(-) diff --git a/lib/kernel/src/disk_log.erl b/lib/kernel/src/disk_log.erl index 3e1d0a2224..6b3eb35f92 100644 --- a/lib/kernel/src/disk_log.erl +++ b/lib/kernel/src/disk_log.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 1997-2018. All Rights Reserved. +%% Copyright Ericsson AB 1997-2020. All Rights Reserved. %% %% Licensed under the Apache License, Version 2.0 (the "License"); %% you may not use this file except in compliance with the License. @@ -339,7 +339,7 @@ format_error(Error) -> | {node, Node :: node()} | {distributed, Dist :: local | [node()]} | {head, Head :: none - | {head, term()} + | {head, binary()} | (MFA :: {atom(), atom(), list()})} | {no_written_items, NoWrittenItems ::non_neg_integer()} | {full, Full :: boolean} @@ -1610,7 +1610,11 @@ do_info(L, Cnt) -> end, HeadL = case Mode of read_write -> - [{head, Head}]; + [{head, case Head of + {ok, H} -> H; + none -> Head; + {_M, _F, _A} -> Head + end}]; read_only -> [] end, diff --git a/lib/kernel/test/disk_log_SUITE.erl b/lib/kernel/test/disk_log_SUITE.erl index 99711bcf75..724bec17ed 100644 --- a/lib/kernel/test/disk_log_SUITE.erl +++ b/lib/kernel/test/disk_log_SUITE.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 1997-2019. All Rights Reserved. +%% Copyright Ericsson AB 1997-2020. All Rights Reserved. %% %% Licensed under the Apache License, Version 2.0 (the "License"); %% you may not use this file except in compliance with the License. @@ -89,7 +89,7 @@ dist_terminate/1, dist_accessible/1, dist_deadlock/1, dist_open2/1, other_groups/1, - otp_6278/1, otp_10131/1, otp_16768/1]). + otp_6278/1, otp_10131/1, otp_16768/1, otp_16809/1]). -export([head_fun/1, hf/0, lserv/1, measure/0, init_m/1, xx/0, head_exit/0, slow_header/1]). @@ -121,7 +121,8 @@ [halt_int, wrap_int, halt_ext, wrap_ext, read_mode, head, notif, new_idx_vsn, reopen, block, unblock, open, close, error, chunk, truncate, many_users, info, change_size, - change_attribute, distribution, otp_6278, otp_10131, otp_16768]). + change_attribute, distribution, otp_6278, otp_10131, otp_16768, + otp_16809]). %% These test cases should be skipped if the VxWorks card is %% configured without NFS cache. @@ -147,7 +148,7 @@ all() -> {group, open}, {group, close}, {group, error}, chunk, truncate, many_users, {group, info}, {group, change_size}, change_attribute, - {group, distribution}, otp_6278, otp_10131, otp_16768]. + {group, distribution}, otp_6278, otp_10131, otp_16768, otp_16809]. groups() -> [{halt_int, [], [halt_int_inf, {group, halt_int_sz}]}, @@ -4741,6 +4742,36 @@ head_count(Log, File, Header, Format, Expected) -> Expected = proplists:get_value(no_items, DiskLogInfo), ok = disk_log:close(Log). +otp_16809(Conf) when is_list(Conf) -> + Dir = ?privdir(Conf), + Log = otp_16809, + File = filename:join(Dir, lists:concat([Log, ".LOG"])), + {ok, Log} = disk_log:open([{name,Log},{file,File}]), + none = info(Log, head, undef), + ok = disk_log:change_header(Log, {head, none}), + none = info(Log, head, undef), + ok = disk_log:change_header(Log, {head, some_header}), + %% Notice: the head argument as a binary: + true = term_to_binary(some_header) =:= info(Log, head, undef), + HeadFunc = {?MODULE, head_fun, [{ok,a_header}]}, + ok = disk_log:change_header(Log, {head_func, HeadFunc}), + HeadFunc = info(Log, head, undef), + ok = disk_log:close(Log), + + {ok, Log} = disk_log:open([{name,Log}, + {file,File}, + {format,external}]), + none = info(Log, head, undef), + ok = disk_log:change_header(Log, {head, none}), + none = info(Log, head, undef), + ok = disk_log:change_header(Log, {head, "some header"}), + %% Notice: the head argument as a binary: + <<"some header">> = info(Log, head, undef), + HeadFunc2 = {?MODULE, head_fun, [{ok,"a header"}]}, + ok = disk_log:change_header(Log, {head_func, HeadFunc2}), + HeadFunc2 = info(Log, head, undef), + ok = disk_log:close(Log). + mark(FileName, What) -> {ok,Fd} = file:open(FileName, [raw, binary, read, write]), {ok,_} = file:position(Fd, 4), -- 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