Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

uv.h: add EPERM to errno map to fix regression #297

Closed
wants to merge 1 commit into
from

Conversation

Projects
None yet
2 participants
Contributor

philips commented Jan 25, 2012

EPERM isn't mapped in so chown returns an unknown error. This is a
regression from 0.4.12.

philips:node/ (master*) $ cat chown.js
var fs = require('fs')
fs.chown("/tmp/foobar", 100, 100, function(er){ console.log(er);})

philips:node/ (master*) $ ls -la /tmp/foobar
total 0
drwxr-xr-x 2 root wheel 68 Jan 24 17:21 .

0.4

philips:node/ (master*) $ /usr/local/Cellar/node/0.4.12/bin/node chown.js
{ stack: [Getter/Setter],
arguments: undefined,
type: undefined,
message: 'EPERM, Operation not permitted '/tmp/foobar'',
errno: 1,
code: 'EPERM',
path: '/tmp/foobar' }

master

philips:node/ (master*) $ ./node chown.js
{ [Error: UNKNOWN, unknown error '/tmp/foobar'] errno: -1, code: 'UNKNOWN', path: '/tmp/foobar' }

AFTER

philips:node/ (master*) $ ./node chown.js
{ [Error: EPERM, operation not permitted '/tmp/foobar'] errno: 49, code: 'EPERM', path: '/tmp/foobar' }

This is also needed to fix isaacs/npm#2080 under 0.6 and make npm work on nfs squashed filesystems.

Contributor

philips commented Jan 25, 2012

The test is probably completely bogus. But I don't know how to guarantee an EPERM under all circumstances.

Member

isaacs commented Jan 27, 2012

I'm +1 on this. UNKNOWN error codes are a pain, and this is a very common one.

@igorzi @piscisaureus Should something to into src/win/error.c as well?

Member

isaacs commented Jan 27, 2012

@philips Can you please sign the CLA? http://nodejs.org/cla.html

Thanks.

Contributor

philips commented Jan 27, 2012

Signed..For both my personal and Rackspace email.

On 13:26 Fri 27 Jan 2012, Isaac Z. Schlueter wrote:

@philips Can you please sign the CLA? http://nodejs.org/cla.html

Thanks.


Reply to this email directly or view it on GitHub:
#297 (comment)

Member

isaacs commented Jan 27, 2012

Great. 0.6.9 is just about wrapping up, but we'll try to get this in the next one.

Can you rebase onto the latest v0.6 branch?

uv.h: add EPERM to errno map to fix regression
EPERM isn't mapped in so chown returns an unknown error. This is a
regression from 0.4.12.

philips:node/ (master*) $ cat chown.js
var fs = require('fs')
fs.chown("/tmp/foobar", 100, 100, function(er){ console.log(er);})

philips:node/ (master*) $ ls -la /tmp/foobar
total 0
drwxr-xr-x   2 root  wheel   68 Jan 24 17:21 .

0.4
---

philips:node/ (master*) $ /usr/local/Cellar/node/0.4.12/bin/node chown.js
{ stack: [Getter/Setter],
  arguments: undefined,
  type: undefined,
  message: 'EPERM, Operation not permitted \'/tmp/foobar\'',
  errno: 1,
  code: 'EPERM',
  path: '/tmp/foobar' }

master
------

philips:node/ (master*) $ ./node chown.js
{ [Error: UNKNOWN, unknown error '/tmp/foobar'] errno: -1, code: 'UNKNOWN', path: '/tmp/foobar' }

AFTER
-----

philips:node/ (master*) $ ./node chown.js
{ [Error: EPERM, operation not permitted '/tmp/foobar'] errno: 49, code: 'EPERM', path: '/tmp/foobar' }
Contributor

philips commented Jan 27, 2012

Sorry it took a couple of pushes to get right. My v0.6 was out of date. Should be good on top of v0.6 now.

Contributor

philips commented Jan 27, 2012

Here it is against master since ENAMETOOLONG was added too... https://github.com/philips/libuv/tree/add-eperm-to-errno-map-master

Member

isaacs commented Feb 1, 2012

Landed on 4cfda74. Thanks!

@isaacs isaacs closed this Feb 1, 2012

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment