Skip to content
This repository has been archived by the owner on Apr 22, 2023. It is now read-only.

test/simple/test-fs-access.js fails most of the time #9033

Closed
misterdjules opened this issue Jan 15, 2015 · 3 comments
Closed

test/simple/test-fs-access.js fails most of the time #9033

misterdjules opened this issue Jan 15, 2015 · 3 comments
Assignees
Milestone

Comments

@misterdjules
Copy link

For instance: http://jenkins.nodejs.org/job/nodejs-v0.12/DESTCPU=ia32,label=ubuntu-12.04/lastBuild/tapTestReport/simple.tap-196/.

It seems it passes all the time on Windows, and sometimes passes on other platforms though.

@misterdjules
Copy link
Author

The problem is that when running test-fs-access.js, node runs as root on Jenkins agents, and thus fs.access(readOnlyFile, W_OK, ...) succeeds, instead of failing. When running test-fs-access.js as a non-root user, fs.access(readOnlyFile, W_OK, ...) always fails as expected and the test always succeeds.

I'm currently trying to think of some way to fix that cleanly.

misterdjules pushed a commit to misterdjules/node that referenced this issue Jan 16, 2015
On non-windows supported platforms, fs.access(readOnlyFile, W_OK, ...)
is expected to fail, but always succeeds if node runs as the super user,
which is often the case for tests running on our continuous integration
platform.

This change makes the test try to change its process user id to nobody
on non-windows platforms so that the above mentioned test can pass and
still perform the actual desired test. If changing the process user id
to a nobody is not possible, then the test checks that
fs.access(readOnlyFile, W_OK, ...) actually succeeds.

Fixes nodejs#9033.
@misterdjules
Copy link
Author

Fixed by #9039.

misterdjules pushed a commit to misterdjules/node that referenced this issue Jan 16, 2015
On non-windows supported platforms, fs.access(readOnlyFile, W_OK, ...)
is expected to fail, but always succeeds if node runs as the super user,
which is often the case for tests running on our continuous integration
platform.

This change makes the test try to change its process user id to nobody
on non-windows platforms so that the above mentioned test can pass and
still perform the actual desired test. If changing the process user id
to a nobody is not possible, then the test checks that
fs.access(readOnlyFile, W_OK, ...) actually succeeds.

Fixes nodejs#9033.
misterdjules pushed a commit to misterdjules/node that referenced this issue Jan 16, 2015
On non-windows supported platforms, fs.access(readOnlyFile, W_OK, ...)
is expected to fail, but always succeeds if node runs as the super user,
which is often the case for tests running on our continuous integration
platform.

This change makes the test try to change its process user id to nobody
on non-windows platforms so that the above mentioned test can pass and
still perform the actual desired test. If changing the process user id
to a nobody is not possible, then the test checks that
fs.access(readOnlyFile, W_OK, ...) actually succeeds.

Fixes nodejs#9033.

Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: Timothy J Fontaine <[email protected]>
@misterdjules
Copy link
Author

Landed fix in 28d0cbb.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants