Age | Commit message (Collapse) | Author |
|
|
|
filelib_SUITE:find_source/1 would fail when running the tests
with STDLIB cover-compiled.
|
|
This moves, extends and exports functionality that previously existed only
internally in filename:find_src/1/2, adding the ability to automatically
substitute file suffixes and use different rules for different suffixes.
|
|
|
|
|
|
While we are it, also re-ident the files.
|
|
|
|
Either rely on the default 30 minutes timetrap, or set the timeout
using the supported methods in common_test.
|
|
As a first step to removing the test_server application as
as its own separate application, change the inclusion of
test_server.hrl to an inclusion of ct.hrl and remove the
inclusion of test_server_line.hrl.
|
|
|
|
|
|
* siri/filename-join-2/OTP-12158:
Fix handling of single dot in filename:join/2
|
|
* capflam/filelib_wildcard_fix:
Fix filelib:wildcard/2 when 'Cwd' ends with a dot
|
|
The reference manual says that filename:join(A,B) is equivalent to
filename:join([A,B]). In some rare cases this turns out not to be
true:
1> filename:join("/a/.","b").
"/a/./b"
2> filename:join(["/a/.","b"]).
"/a/b"
In general, filename:join/1,2 removes single dots from the resulting
path, except dots that occur at the beginning or end of the path. The
problem above occurs when the first argument to join/2 ends with a
dot, then it is not removed even if the second argument differs from
an empty string and thus the dot ends up in "the middle" of the path.
This commit corrects this problem. A single dot is now only kept if it
occurs at the very beginning or the very end of the resulting path.
Test of filename:join/1,2 are added in filename_SUITE. In addition,
filelib_SUITE is updated with more tests of filelib:wildcard/2 since
this failed when the given current directory (second argument) ended
with a dot.
|
|
In such case, filelib:wildcard/2 returned truncated results:
1> file:set_cwd("/usr/lib/erlang/lib").
ok
2> filelib:wildcard("stdlib-*/ebin/*.app", filename:absname(".")).
["dlib-2.1/ebin/stdlib.app"]
|
|
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) -> []
|
|
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
|
|
filelib:wildcard("broken_symlink") would return an empty list if
"broken_symlink" is a symlink that does not point to an existing
file.
|
|
filelib:wildcard() will no longer support "raw filenames", so it
makes no sense for it to accept a binary Cwd argument.
|
|
|
|
|
|
Two adjacent * used as a single pattern will match
all files and zero or more directories and subdirectories.
|
|
filelib:wildcard("some/relative/path/*.beam", Path) would fail to
match any file. That is, filelib:wildcard/2 would not work if the
first component of the pattern did not contain any wildcard
characters.
Noticed-by: Samuel Rivas
|
|
* dev:
Fix a couple of minor bugs with hook priority
Update to reflect addition of CTH priority addition
Update CTH priority default to be 0
Update to reflect new cth callback api
Update the return from init/2 to be {ok, NewState} or {ok,NewState,Priority} instead of NewState.
Add priority functionality and tests for ct hooks
Update internal hooks state to use a record instead of tuples
Improve and correct types and specifications in Kernel and STDLIB
|
|
Running Dialyzer on the test suites revealed a few type errors.
|
|
This commit is a preparation for introducing location information
(filename/line number) in stacktraces in exceptions. Currently
a stack trace looks like:
[{Mod1,Function1,Arity1},
.
.
.
{ModN,FunctionN,ArityN}]
Add a forth element to each tuple that can be used indication
the filename and line number of the source file:
[{Mod1,Function1,Arity1,Location1},
.
.
.
{ModN,FunctionN,ArityN,LocationN}]
In this commit, the fourth element will just be an empty list,
and we will change all code that look at or manipulate stacktraces.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
* ta/ensure_dir_eexist:
filelib_SUITE: strenghten tests of filelib:ensure_dir/1
Don't return a false {error,eexist} in filelib:ensure_dir/1
OTP-8389 Because of a race condition, using filelib:ensure_dir/1 from
multiple processes to create the same path or parts of the same
directory structure, filelib:ensure_dir/1 could return a
meaningless {error,eexist}. That race condition has been
eliminated, and {error,eexist} will now be returned only if there
exists a regular file, device file, or some other non-directory
file with the same name. (Thanks to Tuncer Ayaz.)
|
|
Test that filelib:ensure_dir/1 returns {error,eexist} if
there already exists a regular file with the name as
a directory that should be created.
While at it, slightly strenghten the otp_5960/1 test case
by repeating each call to filelib:ensure_dir/1.
|
|
|