From de2fb97f15ac98aa1d1c5533aacca378334f4778 Mon Sep 17 00:00:00 2001 From: Anthony Ramine Date: Tue, 1 Jul 2014 00:58:26 +0200 Subject: Fix handling of broken symlinks in filelib This fixes a bug introduced in f11aabdc9fec593c31e6c4f3fa25c1707e9c35df where filelib:eval_read_file_info/2 was made to use file:read_link_info/1 to never follow symlinks. This fixed wildcard/1 but broke every other function using eval_read_file_info/2. Reported-by: Louis-Philippe Gauthier Reported-by: Danil Zagoskin --- lib/kernel/src/erl_boot_server.erl | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'lib/kernel') diff --git a/lib/kernel/src/erl_boot_server.erl b/lib/kernel/src/erl_boot_server.erl index 9a49655a9f..ef09d86ca4 100644 --- a/lib/kernel/src/erl_boot_server.erl +++ b/lib/kernel/src/erl_boot_server.erl @@ -341,9 +341,13 @@ handle_command(S, PS, Msg) -> send_file_result(S, list_dir, Res), PS2; {read_file_info,File} -> - {Res, PS2} = erl_prim_loader:prim_read_file_info(PS, File), + {Res, PS2} = erl_prim_loader:prim_read_file_info(PS, File, true), send_file_result(S, read_file_info, Res), PS2; + {read_link_info,File} -> + {Res, PS2} = erl_prim_loader:prim_read_file_info(PS, File, false), + send_file_result(S, read_link_info, Res), + PS2; get_cwd -> {Res, PS2} = erl_prim_loader:prim_get_cwd(PS, []), send_file_result(S, get_cwd, Res), -- cgit v1.2.3 From 9dc807376b0dff43a19af5ef4301333f16cc11c1 Mon Sep 17 00:00:00 2001 From: Siri Hansen Date: Mon, 7 Jul 2014 15:45:36 +0200 Subject: Add tests of filelib and symlinks This commit complements 769996c0cd4cb68c157e39de725642f209ed7423 and adds tests for the following problems introduced by f11aabdc9fec593c31e6c4f3fa25c1707e9c35df: Given the symlink 'dirlink' pointing to an existing dir, then - filelib:is_regular("dirlink") -> false - filelib:is_dir("dirlink") -> false Given the symlink 'filelink' pointing to an existing file, then - filelib:is_regular("filelink") -> false - filelib:is_file("filelink") -> false - filelib:last_modified("filelink") and filelib:filesize("filelink") return the info of the link and not the file Given the symlink "broken_symlink" pointing to a non-existing file, then - filelib:wildcard("broken_symlink",File) -> [] --- lib/kernel/test/erl_prim_loader_SUITE.erl | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) (limited to 'lib/kernel') diff --git a/lib/kernel/test/erl_prim_loader_SUITE.erl b/lib/kernel/test/erl_prim_loader_SUITE.erl index b2ca3bdbc2..658c31c14d 100644 --- a/lib/kernel/test/erl_prim_loader_SUITE.erl +++ b/lib/kernel/test/erl_prim_loader_SUITE.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 1996-2013. All Rights Reserved. +%% Copyright Ericsson AB 1996-2014. All Rights Reserved. %% %% The contents of this file are subject to the Erlang Public License, %% Version 1.1, (the "License"); you may not use this file except in @@ -328,6 +328,30 @@ file_requests(Config) when is_list(Config) -> {ok,Info} = file:read_file_info(code:which(test_server)), ?line {ok,Info} = rpc:call(Node, erl_prim_loader, read_file_info, [code:which(test_server)]), + + PrivDir = ?config(priv_dir,Config), + Dir = filename:join(PrivDir,?MODULE_STRING++"_file_requests"), + ok = file:make_dir(Dir), + Alias = filename:join(Dir,"symlink"), + case file:make_symlink(code:which(test_server), Alias) of + {error, enotsup} -> + %% Links not supported on this platform + ok; + {error, eperm} -> + {win32,_} = os:type(), + %% Windows user not privileged to create symlinks" + ok; + ok -> + %% Reading file info for link should return file info for + %% link target + {ok,Info} = rpc:call(Node, erl_prim_loader, read_file_info, + [Alias]), + #file_info{type=regular} = Info, + {ok,#file_info{type=symlink}} = + rpc:call(Node, erl_prim_loader, read_link_info, + [Alias]) + end, + {ok,Cwd} = file:get_cwd(), ?line {ok,Cwd} = rpc:call(Node, erl_prim_loader, get_cwd, []), case file:get_cwd("C:") of -- cgit v1.2.3 From 4182a479c2ae47d097c2b4f18a6a2a47020a5bca Mon Sep 17 00:00:00 2001 From: Siri Hansen Date: Wed, 9 Jul 2014 15:15:48 +0200 Subject: Update runtime dependencies --- lib/kernel/src/kernel.app.src | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib/kernel') diff --git a/lib/kernel/src/kernel.app.src b/lib/kernel/src/kernel.app.src index 5658c6b6cf..9f6c0f4624 100644 --- a/lib/kernel/src/kernel.app.src +++ b/lib/kernel/src/kernel.app.src @@ -115,6 +115,6 @@ {applications, []}, {env, [{error_logger, tty}]}, {mod, {kernel, []}}, - {runtime_dependencies, ["erts-6.0", "stdlib-2.0", "sasl-2.4"]} + {runtime_dependencies, ["erts-6.1.2", "stdlib-2.0", "sasl-2.4"]} ] }. -- cgit v1.2.3 From 41d2dc56d5d2a3be1ba59c6999e1003360b1e308 Mon Sep 17 00:00:00 2001 From: Erlang/OTP Date: Thu, 10 Jul 2014 10:45:27 +0200 Subject: Prepare release --- lib/kernel/doc/src/notes.xml | 19 +++++++++++++++++++ lib/kernel/vsn.mk | 2 +- 2 files changed, 20 insertions(+), 1 deletion(-) (limited to 'lib/kernel') diff --git a/lib/kernel/doc/src/notes.xml b/lib/kernel/doc/src/notes.xml index 3a8de841d0..35889f9d11 100644 --- a/lib/kernel/doc/src/notes.xml +++ b/lib/kernel/doc/src/notes.xml @@ -30,6 +30,25 @@

This document describes the changes made to the Kernel application.

+
Kernel 3.0.2 + +
Fixed Bugs and Malfunctions + + +

+ OTP-11850 fixed filelib:wildcard/1 to work with broken + symlinks. This correction, however, introduced problems + since symlinks were no longer followed for functions like + filelib:ensure_dir/1, filelib:is_dir/1, + filelib:file_size/1, etc. This is now corrected.

+

+ Own Id: OTP-12054 Aux Id: seq12660

+
+
+
+ +
+
Kernel 3.0.1
Fixed Bugs and Malfunctions diff --git a/lib/kernel/vsn.mk b/lib/kernel/vsn.mk index aebe28655e..1ecfde190e 100644 --- a/lib/kernel/vsn.mk +++ b/lib/kernel/vsn.mk @@ -1 +1 @@ -KERNEL_VSN = 3.0.1 +KERNEL_VSN = 3.0.2 -- cgit v1.2.3