Skip to content

Conversation

@simevo
Copy link

@simevo simevo commented Apr 27, 2018

TODO:

  • move platform-specfic code to the right place
  • test
  • doc

Copy link
Contributor

@cjihrig cjihrig left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is missing Windows pieces, tests, and docs.

include/uv.h Outdated
uv_uid_t uid,
uv_gid_t gid,
uv_fs_cb cb);
UV_EXTERN int uv_ls_chown(uv_loop_t* loop,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

uv_fs_lchown()?

src/unix/fs.c Outdated

int uv_fs_lchown(uv_loop_t* loop,
uv_fs_t* req,
uv_os_fd_t file,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The signature doesn't match up.

src/unix/fs.c Outdated
uv_gid_t gid,
uv_fs_cb cb) {
INIT(LCHOWN);
req->file = file;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This doesn't seem correct to me.

@simevo
Copy link
Author

simevo commented Apr 29, 2018

the existing chown and fchown functions "are not implemented on Windows":
http://docs.libuv.org/en/v1.x/fs.html#c.uv_fs_chown
so neither should be these ones I believe.

there's a TODO in the tests because I have not though yet about how to check that lchown really does not change the linked-to file

also:

not ok 45 - fs_chown
# exit code 6
# Output from process `fs_chown`:
# Assertion failed in ../test/test-fs.c on line 1561: r == 0

@cjihrig
Copy link
Contributor

cjihrig commented Apr 29, 2018

the existing chown and fchown functions "are not implemented on Windows":

There are still stubs in the code -

int uv_fs_fchown(uv_loop_t* loop, uv_fs_t* req, uv_file fd, uv_uid_t uid,
.

@simevo
Copy link
Author

simevo commented Apr 30, 2018

Now it seems to compile and generate the library fine on windows with VS 2015.

There's still the test failing and the missing test (see TODO in test/test-fs.c).
I wonder what user id -1 stands for, on my system:

grep UID /etc/login.defs 
UID_MIN                  1000
UID_MAX                 60000
...

@simevo
Copy link
Author

simevo commented May 22, 2018

Hi what else can I do to get this PR into libuv ? Thanks

include/uv.h Outdated
uv_gid_t gid,
uv_fs_cb cb);
UV_EXTERN int uv_fs_lchown(uv_loop_t* loop,
uv_fs_t* req,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you line all of these arguments up with the uv_loop_t on the previous line.

src/unix/fs.c Outdated


int uv_fs_lchown(uv_loop_t* loop,
uv_fs_t* req,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please line the arguments up.

test/test-fs.c Outdated
static void lchown_cb(uv_fs_t* req) {
ASSERT(req->fs_type == UV_FS_LCHOWN);
ASSERT(req->result == 0);
chown_cb_count++;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be lchown_cb_count?

static int fchmod_cb_count;
static int chown_cb_count;
static int fchown_cb_count;
static int lchown_cb_count;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This variable isn't asserted on anywhere.

uv_fs_req_cleanup(req);
}

static void lchown_cb(uv_fs_t* req) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This isn't called.

@cjihrig
Copy link
Contributor

cjihrig commented May 22, 2018

@bnoordhuis do you have the historical context on why these functions just return 0 on Windows instead of ENOSYS?

@bnoordhuis
Copy link
Member

Not sure what you mean. What does "these functions" refer to?

@cjihrig
Copy link
Contributor

cjihrig commented May 23, 2018

Sorry, "these functions" refers to the chown family of functions.

@bnoordhuis
Copy link
Member

It's because there is no meaningful way to implement them, user/group/other isn't a thing on Windows.

I don't think it was a deliberate decision to quietly ignore instead of returning ENOSYS, just something that was deemed Good Enough at the time and made node's test suite pass. :-)

@cjihrig
Copy link
Contributor

cjihrig commented May 23, 2018

I don't think it was a deliberate decision to quietly ignore instead of returning ENOSYS, just something that was deemed Good Enough at the time and made node's test suite pass.

That's what I was looking for. Thanks!

Paolo Greppi added 3 commits May 24, 2018 11:11
- increment lchown_cb_count counter

- also test async lchown and thereby assert on lchown_cb_count and call lchown_cb

- use gid = -1, as per [1] the corresponding ID of the file will not be changed

- on cleanup, also remove test_file_link

[1] http://pubs.opengroup.org/onlinepubs/9699919799//functions/chown.html
@cjihrig
Copy link
Contributor

cjihrig commented May 26, 2018

@simevo
Copy link
Author

simevo commented May 26, 2018

all CI failures seem unrelated to me:

https://ci.nodejs.org/job/libuv-test-commit-linux/910/nodes=debian7-docker-armv7/

ERROR: Error cloning remote repo 'origin'

https://ci.nodejs.org/job/libuv-test-commit-linux/910/nodes=alpine-last-latest-x64/
https://ci.nodejs.org/job/libuv-test-commit-linux/910/nodes=alpine-latest-x64/

not ok 20 - connect_unspecified
# exit code 134
# Output from process `connect_unspecified`:
# Assertion failed in test/test-connect-unspecified.c on line 56: uv_tcp_connect(&connect6, &socket6, (const struct sockaddr*) &addr6, connect_6) == 0

https://ci.nodejs.org/job/libuv-test-commit-linux/910/nodes=centos6-64/
https://ci.nodejs.org/job/libuv-test-commit-linux/910/nodes=centos6-64-gcc44/
https://ci.nodejs.org/job/libuv-test-commit-linux/910/nodes=ubuntu1404-gyp-64/

not ok 103 - getaddrinfo_fail_sync
# timeout
# Output from process `getaddrinfo_fail_sync`: (no output)

https://ci.nodejs.org/job/libuv-test-commit-aix/879/nodes=aix61-ppc64/

not ok 250 - tcp_ping_pong
# exit code 393222
# Output from process `tcp_ping_pong`: (no output)
Output from process `tcp_ping_pong`:
# Assertion failed in test/test-ping-pong.c on line 144: status == 0
...
not ok 256 - tcp_ref3
# exit code 393222
# Output from process `tcp_ref3`: (no output)
Output from process `tcp_ref3`:
# Assertion failed in test/test-ref.c on line 96: status == 0
...
not ok 262 - tcp_write_fail
# exit code 393222
# Output from process `tcp_write_fail`: (no output)
Output from process `tcp_write_fail`:
# Assertion failed in test/test-tcp-write-fail.c on line 77: status == 0

https://ci.nodejs.org/job/libuv-test-commit-zos/724/nodes=zos-s390x/

not ok 309 - udp_multicast_join6
# exit code 3
# Output from process `udp_multicast_join6`:
# Assertion failed in ../test/test-udp-multicast-join6.c on line 136: r == 0
# CEE5207E The signal SIGABRT was received.

Copy link
Contributor

@cjihrig cjihrig left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure if targeting master vs. v1.x is necessary, but LGTM.

cjihrig pushed a commit that referenced this pull request Jun 19, 2018
Fixes: #1790
PR-URL: #1826
Reviewed-By: Colin Ihrig <[email protected]>
@cjihrig
Copy link
Contributor

cjihrig commented Jun 19, 2018

Landed on master in 33b6db3. Thanks!

I'm going to look into backporting this to v1.x as well.

@cjihrig cjihrig closed this Jun 19, 2018
cjihrig pushed a commit to cjihrig/libuv that referenced this pull request Jun 19, 2018
Fixes: libuv#1790
PR-URL: libuv#1826
Reviewed-By: Colin Ihrig <[email protected]>
@cjihrig
Copy link
Contributor

cjihrig commented Jun 19, 2018

Landed on v1.x in aa28f7d.

Here is a CI run of that commit with no related failures: https://ci.nodejs.org/view/libuv/job/libuv-test-commit/940/

cjihrig added a commit to cjihrig/node that referenced this pull request Jun 25, 2018
Notable changes:

- Building via cmake is now supported.
  PR-URL: libuv/libuv#1850
- Stricter checks have been added to prevent watching the same
  file descriptor multiple times.
  PR-URL: libuv/libuv#1851
  Refs: nodejs#3604
- An IPC deadlock on Windows has been fixed.
  PR-URL: libuv/libuv#1843
  Fixes: nodejs#9706
  Fixes: nodejs#7657
- uv_fs_lchown() has been added.
  PR-URL: libuv/libuv#1826
  Refs: nodejs#19868
- uv_fs_copyfile() sets errno on error.
  PR-URL: libuv/libuv#1881
  Fixes: nodejs#21329
- uv_fs_fchmod() supports -A files on Windows.
  PR-URL: libuv/libuv#1819
  Refs: nodejs#12803

PR-URL: nodejs#21466
Reviewed-By: Anna Henningsen <[email protected]>
Reviewed-By: Ben Noordhuis <[email protected]>
Reviewed-By: Santiago Gimeno <[email protected]>
Reviewed-By: James M Snell <[email protected]>
targos pushed a commit to nodejs/node that referenced this pull request Jun 25, 2018
Notable changes:

- Building via cmake is now supported.
  PR-URL: libuv/libuv#1850
- Stricter checks have been added to prevent watching the same
  file descriptor multiple times.
  PR-URL: libuv/libuv#1851
  Refs: #3604
- An IPC deadlock on Windows has been fixed.
  PR-URL: libuv/libuv#1843
  Fixes: #9706
  Fixes: #7657
- uv_fs_lchown() has been added.
  PR-URL: libuv/libuv#1826
  Refs: #19868
- uv_fs_copyfile() sets errno on error.
  PR-URL: libuv/libuv#1881
  Fixes: #21329
- uv_fs_fchmod() supports -A files on Windows.
  PR-URL: libuv/libuv#1819
  Refs: #12803

PR-URL: #21466
Reviewed-By: Anna Henningsen <[email protected]>
Reviewed-By: Ben Noordhuis <[email protected]>
Reviewed-By: Santiago Gimeno <[email protected]>
Reviewed-By: James M Snell <[email protected]>
MylesBorins pushed a commit to MylesBorins/node that referenced this pull request Nov 5, 2018
Notable changes:

- Building via cmake is now supported.
  PR-URL: libuv/libuv#1850
- Stricter checks have been added to prevent watching the same
  file descriptor multiple times.
  PR-URL: libuv/libuv#1851
  Refs: nodejs#3604
- An IPC deadlock on Windows has been fixed.
  PR-URL: libuv/libuv#1843
  Fixes: nodejs#9706
  Fixes: nodejs#7657
- uv_fs_lchown() has been added.
  PR-URL: libuv/libuv#1826
  Refs: nodejs#19868
- uv_fs_copyfile() sets errno on error.
  PR-URL: libuv/libuv#1881
  Fixes: nodejs#21329
- uv_fs_fchmod() supports -A files on Windows.
  PR-URL: libuv/libuv#1819
  Refs: nodejs#12803

PR-URL: nodejs#21466
Reviewed-By: Anna Henningsen <[email protected]>
Reviewed-By: Ben Noordhuis <[email protected]>
Reviewed-By: Santiago Gimeno <[email protected]>
Reviewed-By: James M Snell <[email protected]>
MylesBorins pushed a commit to nodejs/node that referenced this pull request Nov 11, 2018
Notable changes:

- Building via cmake is now supported.
  PR-URL: libuv/libuv#1850
- Stricter checks have been added to prevent watching the same
  file descriptor multiple times.
  PR-URL: libuv/libuv#1851
  Refs: #3604
- An IPC deadlock on Windows has been fixed.
  PR-URL: libuv/libuv#1843
  Fixes: #9706
  Fixes: #7657
- uv_fs_lchown() has been added.
  PR-URL: libuv/libuv#1826
  Refs: #19868
- uv_fs_copyfile() sets errno on error.
  PR-URL: libuv/libuv#1881
  Fixes: #21329
- uv_fs_fchmod() supports -A files on Windows.
  PR-URL: libuv/libuv#1819
  Refs: #12803

Backport-PR-URL: #24103
PR-URL: #21466
Reviewed-By: Anna Henningsen <[email protected]>
Reviewed-By: Ben Noordhuis <[email protected]>
Reviewed-By: Santiago Gimeno <[email protected]>
Reviewed-By: James M Snell <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants