openzfsonosx / zfs

OpenZFS on OS X
https://openzfsonosx.org/
Other
823 stars 72 forks source link

zfs bookmark command throws "unknown error" when not run privileged #364

Open JMoVS opened 9 years ago

JMoVS commented 9 years ago

I am running the 1.4.0 version provided by @ilovezfs and it shows me an "unknown error" when I try to make sth like:

zfs bookmark tank@abc tank#abc

it quits with "cannot create bookmark 'tank#abc': unknown error"

when I execute it with sudo, it works fine.

brendonhumphrey commented 9 years ago

Are you claiming that zfs snapshot should run without root privilege?

The test suite says otherwise...see (https://github.com/openzfsonosx/zfs-test/blob/master/test/zfs-tests/tests/functional/cli_user/misc/zfs_snapshot_001_neg.ksh)

(ah oops. I saw bookmark and looked at the snapshot test - sorry).

JMoVS commented 9 years ago

sry, I was inprecise. The error message thrown is "unknown error" whereas in the case of snapshot command run without sudo, it is permission denied

Aside from that, in the test:

if datasetexists $TESTPOOL/$TESTFS@usersnap1
then
    log_fail "Snapshot $TESTPOOL/$TESTFS@usersnap1 was taken !"
fi

log_pass "zfs snapshot returns an error when run as a user"

doesn't the log_pass outside of the if statement mean that it will always no matter what log_pass "zfs snapshot returns an error when run as user"?

brendonhumphrey commented 9 years ago

log_fail terminates the test

On 25 Aug 2015, at 5:47 PM, JMoVS notifications@github.com wrote:

sry, I was inprecise. The error message thrown is "unknown error" whereas in the case of snapshot command run without sudo, it is permission denied`

Aside from that, in the test:

if datasetexists $TESTPOOL/$TESTFS@usersnap1 then log_fail "Snapshot $TESTPOOL/$TESTFS@usersnap1 was taken !" fi

log_pass "zfs snapshot returns an error when run as a user" doesn't the log_pass outside of the if statement mean that it will always no matter what log_pass "zfs snapshot returns an error when run as user"?

— Reply to this email directly or view it on GitHub https://github.com/openzfsonosx/zfs/issues/364#issuecomment-134513071.

JMoVS commented 9 years ago

ah ok. Do you consider the "unknown error" instead of he "permission denied" error message a bug?

brendonhumphrey commented 9 years ago

Not sure! Admittedly it is not a nice error message and inconsistent with the snapshot output. We should compare with the output of iIlumos, that is our standard guide.

Brendon

On 25 Aug 2015, at 5:50 PM, JMoVS notifications@github.com wrote:

ah ok. Do you consider the "unknown error" instead of he "permission denied" error message a bug?

— Reply to this email directly or view it on GitHub https://github.com/openzfsonosx/zfs/issues/364#issuecomment-134513606.

JMoVS commented 9 years ago

I am not competent to check that myself, will you do that?

brendonhumphrey commented 9 years ago

yes.

On 25 Aug 2015, at 6:02 PM, JMoVS notifications@github.com wrote:

I am not competent to check that myself, will you do that?

— Reply to this email directly or view it on GitHub https://github.com/openzfsonosx/zfs/issues/364#issuecomment-134515670.

ilovezfs commented 9 years ago

I think it's an illumos "bug" because there's no specific handling for EPERM or EACCES: https://github.com/openzfsonosx/zfs/blob/master/cmd/zfs/zfs_main.c#L6864-L6883

One way to fix this would be to call zfs_standard_error, as is done here: https://github.com/openzfsonosx/zfs/blob/master/cmd/zfs/zfs_main.c#L1350-L1351

This is not the sort of thing we would usually unilaterally change.