All of lore.kernel.org
 help / color / mirror / Atom feed
From: Qu Wenruo <quwenruo@cn.fujitsu.com>
To: <dsterba@suse.cz>, <linux-btrfs@vger.kernel.org>
Subject: Re: [PATCH] btrfs-progs: fsck-test: Add check_sudo to check valid root/sudo privilege
Date: Mon, 2 Mar 2015 08:43:06 +0800	[thread overview]
Message-ID: <54F3B21A.8080602@cn.fujitsu.com> (raw)
In-Reply-To: <20150227161144.GE8720@twin.jikos.cz>

> 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 <dsterba@suse.cz>
>> To: Qu Wenruo <quwenruo@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

      reply	other threads:[~2015-03-02  0:43 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-02-09  6:11 [PATCH] btrfs-progs: fsck-test: Add check_sudo to check valid root/sudo privilege Qu Wenruo
2015-02-10 13:30 ` David Sterba
2015-02-11  0:29   ` Qu Wenruo
2015-02-27 16:11     ` David Sterba
2015-03-02  0:43       ` Qu Wenruo [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=54F3B21A.8080602@cn.fujitsu.com \
    --to=quwenruo@cn.fujitsu.com \
    --cc=dsterba@suse.cz \
    --cc=linux-btrfs@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.