On Wed, Feb 11, 2015 at 08:29:06AM +0800, Qu Wenruo wrote:

-------- Original Message --------
Subject: Re: [PATCH] btrfs-progs: fsck-test: Add check_sudo to check
valid root/sudo privilege
From: David Sterba <dste...@suse.cz>
To: Qu Wenruo <quwen...@cn.fujitsu.com>
Date: 2015年02月10日 21:30
On Mon, Feb 09, 2015 at 02:11:52PM +0800, Qu Wenruo wrote:
Although fsck-test/012 uses sudo, it uses 'sudo -n', which won't prompt
user to input password and will return 1 if no valid credential is
found.

And this makes test result quite annoying since it fails to mount and
still continue, which will always fail.

This patch introduced the new check_sudo() to check sudo before calling
$sudo. This function will check "sudo -v -n" to get the credential.
And if it fails, then the test will not be run.
This logic is fine, but the setup fails for me even if typing the
password is not required. I think the 'sudo -v' check is wrong as it
tries to refresh the credentials.

    $ sudo -v -n
    sudo: a password is required

while

    $ sudo -n /bin/true

works.
Err, this seems strange.
I think the bug is in sudo itself.

Or the the way sudo is configured in /etc/sudoers.

BTW, what's the version of your sudo?
Mine works fine even no need for password:
$ sudo -v -n
No error....

My sudo version is 1.8.11p2

1.8.10p3

I don't know how to fix it so it works for both of us.

Hmm, what about using the following priority to setup sudo in setup_root_helper()?

UID==0
"sudo -v -n" if it works << For newer sudo
"sudo -n" if it works << For your version or older

Thanks,
Qu
--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to