It has been reported that for SharePoint connections mapped as a drive,
uv_fs_scandir() returns "." and ".." entries when the expectation is
that they should be filtered out.
After some investigation it looks like the driver returns ".\0" and
"..\0" for those entries, that is, it includes the zero byte in the
filename length. Rewrite the filter to catch those entries as well.
Fixes: https://github.com/nodejs/node/issues/4002
PR-URL: https://github.com/libuv/libuv/pull/636
Reviewed-By: Alexis Campailla <orangemocha@nodejs.org>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
Originally intended workaround is especially needed for Android <4.4.
However it fails to compare errno collected from pthread_sigmask.
This has been fixed separately in JXcore. See issue:
https://github.com/jxcore/jxcore-cordova/issues/55
PR-URL: https://github.com/libuv/libuv/pull/833
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
It was reported that some node.js tests fail on AIX because the exit
event sometimes comes before the final stdio output of a child process.
Work around that by deferring the signal watcher that is used for
process management until after the dispatch of regular i/o watchers.
Fixes: https://github.com/libuv/libuv/issues/610
PR-URL: https://github.com/libuv/libuv/pull/611
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
Remove unused variables and code. Also remove some code duplication. End
result is code is cleaner, readable and easier to step through when
debugging.
PR-URL: https://github.com/libuv/libuv/pull/825
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Return an error instead of aborting when /proc/stat doesn't have the
expected format.
PR-URL: https://github.com/libuv/libuv/pull/822
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
'futimens' is only implemented on AIX 7.1. Other functions like
'utimes' and 'utimes' are merely stub functions that return ENOSYS
on AIX 6.1 and below. Skip test fs_futime for AIX versions below 7.1.
PR-URL: https://github.com/libuv/libuv/pull/811
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Currently, the tests assert that the home directory doesn't end
in a slash. However, if the home directory is / or something like
C:\, then this assertion is incorrect. This commit adds special
handling for these cases.
Fixes: https://github.com/libuv/libuv/issues/812
PR-URL: https://github.com/libuv/libuv/pull/813
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
The comment removed by this commit is no longer relevant, as
the function's return type changed from int to void.
PR-URL: https://github.com/libuv/libuv/pull/804
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
Find the real name of the tty using ttyname_r(3) instead of
opening "/dev/tty" which causes trouble if the fd doesn't point to the
controlling terminal.
PR-URL: https://github.com/libuv/libuv/pull/779
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
Use `uv__close__nocheckstdio` instead of `close`.
PR-URL: https://github.com/libuv/libuv/pull/798
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
We only need the absolute path to create our .mon file under /aha. So
only duplicate the passed string. This keeps behaviour similar to other
platforms.
Fixes test fs_event_getpath.
PR-URL: https://github.com/libuv/libuv/pull/776
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
uv__makedir_p was not processing all directories in passed string. Now
if a directory already exists (EEXIST) it simply moves onto the next
directory in the provided string.
Fixed bogus assert in uv__ahafs_event.
PR-URL: https://github.com/libuv/libuv/pull/776
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
The uid and gid fields in uv_passwd_t are of type long so use %ld for
printing them. Fixes two -Wformat compiler warnings.
PR-URL: https://github.com/libuv/libuv/pull/797
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
It can happen that the `parent` end of the `signal_pipe` is given a
STDIO file descriptor, so closing it using `uv__close` fails.
This problem is happening when running the `spawn_closed_process_io`
test in `SmartOS`. The reason being that when creating a socketpair in
`uv__process_init_stdio`, the `Illumos` implementation uses 3 sockets:
one is used as a listener, and the other 2 represent both ends of the
pipe. The listener socket is closed once the pipe is created. In the
test, the listener socket is assigned to the `0` fd, as it is the
first free fd in the system. So the fd `0` remained free after the call
to `socketpair`. Afterwards, when creating the `signal_pipe`, the fd `0`
is being assigned again, so closing it with `uv__close` made the test
fail. This issue is not happening in the other unixes because
`socketpair` doesn't use 3 fd's, but only 2.
To solve the issue, a new `uv__close__nocheckstdio()` function has been
added and used.
PR-URL: https://github.com/libuv/libuv/pull/796
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
This commit adds the copyright header to the two tests that
were missing it.
PR-URL: https://github.com/libuv/libuv/pull/782
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
wcslen() returns a size_t, not an int.
Add bounds checking to dirlen to avoid undefined if dirlen is 0.
Cache relpath size calculation to replace redundant (- 1 + 1)
expression while still showing workings.
Change uv_relative_path return type to void and remove dead code which
branched on the return value.
PR-URL: https://github.com/libuv/libuv/pull/699
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
When converting an absolute path to a relative path on Windows,
uv_relative_path assumed that the relative path could be no longer than
MAX_PATH characters, and would allocate a buffer of MAX_PATH characters
for the relative path.
However, where a recursive watch is started for a directory using a UNC
path, and where events within that directory occur for pathnames longer
than MAX_PATH, it is possible for the relative path to exceed MAX_PATH
characters and overflow the buffer.
This commit fixes uv_relative_path to allocate a buffer for the exact
number of characters counted in the relative path.
Fixes: https://github.com/libuv/libuv/issues/693
PR-URL: https://github.com/libuv/libuv/pull/699
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
Make explicit that handles and requests should be closed before calling
uv_loop_close().
Fixes: https://github.com/libuv/libuv/issues/765
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
fs__realpath_handle() removes the UNC prefixes \\?\ and \\?\UNC\
from paths returned by GetFinalPathNameByHandle, but doesn't
update the string length before sending it to fs__wide_to_utf8.
Fix that by decrement the correct size from the string length.
PR-URL: https://github.com/libuv/libuv/pull/733
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
uv__open_cloexec returns either the fd or a libuv error, which is -errno
on Unix, not -1.
PR-URL: https://github.com/libuv/libuv/pull/760
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Fedor Indutny <fedor@indutny.com>
When compiling with bionic, st_atime_nsec (and the other nsec members)
canot be found.
In order to compile uv with both NDK and bionic, tv_nsec should be
accessed from st_atimensec (and the others nsec members).
See "Compatibility with glibc" in stat.h from bionic.
Signed-off-by: Robert Chiras <robert.chiras@intel.com>
PR-URL: https://github.com/libuv/libuv/pull/746
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
Commit 6798876 ("linux: fix cpu count") switched the /proc/stat parser
to fdopen(). Use fclose() to close the file descriptor to avoid leaking
resources associated with the FILE struct.
PR-URL: https://github.com/libuv/libuv/pull/747
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
'getsockname' does not handle UNIX domain sockets on AIX[1], it does not
fail but simply returns an empty structure with length 0.
If 'getsockname' does not fail (i.e. does not return -1) and the length
is 0 we know, on AIX, that the type is AF_UNIX.
This fixes test pipe_sendmsg.
[1] https://goo.gl/ozqcmS
PR-URL: https://github.com/libuv/libuv/pull/748
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
When libuv is running inside container - eg. lxc container, cpu number
is not obvious. Linux control groups (cgroups) may limit numer of cpus.
As a result of different number cpu cores inside container and
outside container, libuv is crashing.
sysconf(_SC_NPROCESSORS_ONLN) - returns num of host cpus (eg. 32)
`/proc/stat` - sees only cpus limited by cgroups (eg. 4)
When libuv is trying to operate at both numbers and they're different
it's crashing with current test:
run-tests: ../src/unix/linux-core.c:766: read_times: Assertion `num ==
numcpus' failed.
Count the number of cpus based on `/proc/stat` instead.
PR-URL: https://github.com/libuv/libuv/pull/735
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>