From: Qu Wenruo <quwenruo.btrfs@gmx.com>
To: Hugo Mills <hugo@carfax.org.uk>, Marat Khalili <mkh@rqc.ru>,
Nikolay Borisov <nborisov@suse.com>,
"Misono, Tomohiro" <misono.tomohiro@jp.fujitsu.com>,
linux-btrfs@vger.kernel.org
Subject: Re: [PATCH] btrfs-progs: subvolume: outputs message only when operation succeeds
Date: Mon, 25 Sep 2017 22:33:16 +0800 [thread overview]
Message-ID: <d0e2c24a-c6c6-c154-c8ad-d37fdea669d5@gmx.com> (raw)
In-Reply-To: <20170925141951.GD25529@carfax.org.uk>
On 2017年09月25日 22:19, Hugo Mills wrote:
> On Mon, Sep 25, 2017 at 04:04:03PM +0800, Qu Wenruo wrote:
>>
>>
>> On 2017年09月25日 15:52, Hugo Mills wrote:
>>> On Mon, Sep 25, 2017 at 03:46:15PM +0800, Qu Wenruo wrote:
>>>>
>>>>
>>>> On 2017年09月25日 15:42, Marat Khalili wrote:
>>>>> On 25/09/17 10:30, Nikolay Borisov wrote:
>>>>>> On 19.09.2017 10:41, Misono, Tomohiro wrote:
>>>>>>> "btrfs subvolume create/delete" outputs the message of "Create/Delete
>>>>>>> subvolume ..." even when an operation fails.
>>>>>>> Since it is confusing, let's outputs the message only when an
>>>>>>> operation succeeds.
>>>>>> Please change the verb to past tense, more strongly signaling success -
>>>>>> i.e. "Created subvolume"
>>>>> What about recalling some UNIX standards and returning to NOT
>>>>> outputting any message when operation succeeds? My scripts are
>>>>> full of grep -v calls after each btrfs command, and this sucks
>>>>> (and I don't think I'm alone in this situation).
>>>>
>>>> Isn't the correct way to catch the return value instead of grepping
>>>> the output?
>>>
>>> It is, but if, for example, you're using the command in a cron
>>> script which is expected to work, you don't want it producing output
>>> because then you get a mail every time the script runs. So you have to
>>> grep -v on the "success" output to make the successful script silent.
>>
>> What about redirecting stdout to /dev/null and redirecting stderr to
>> mail if return value is not 0?
>> As for expected-to-work case, the stdout doesn't has much meaning
>> and return value should be good enough to judge the result.
>>
>>>
>>>> If it's some command not returning value properly, would you please
>>>> report it as a bug so we can fix it.
>>>
>>> It's not the return value that's problematic (although those used
>>> to be a real mess). It's the fact that a successful run of the command
>>> produces noise on stdout, which most commands don't.
>>
>> Yes, a lot of tried-and-true tools don't output anything for
>> successful run, but also a lot of other tools do output something by
>> default, especially for complex tools like LVM.
>
> btrfs sub create and btrfs sub delete, though, aren't complex.
> They're about as complex as mkdir and rmdir, from a user point of
> view. What's more, and like mkdir/rmdir, the effects of those commands
> show up in the filesystem at the path given, so manual verification
> could be as simple as "ls -d !$" or "ls !$/..". It's really, really
> not necessary to have this command unconditionally print "yes, I
> created a directory for you" to stdout.
>
> Yes, there's ways to deal with it in shell scripts, but wouldn't
> life be so much better if you didn't have to? Like you don't have to
> filter out success reports from mkdir.
>
>> Maybe we can introduce a global --quite option to silent some output.
>
> Or drop the spurious output unless it's asked for with --verbose.
> Because then it makes it so much easier to compose tools together into
> bigger and more complex things, which is, after all, one of the
> fundamental things that UNIX does right.
I think we need at least 4 levels of message: debug, info, warn, error.
And only show debug and higher for --verbose.
Default to show info, and warn/error always get show (stderr).
(And during the new framework, we can add support for translation)
And we also need to reassign all existing message to new message level.
It may be time consuming but we just need to do it since there is real
user demand here.
(Any in this case, anyone in the maillist can help review messages)
Thanks,
Qu
>
> Hugo.
>
>> Thanks,
>> Qu
>>>
>>> Hugo.
>>>> Thanks,
>>>> Qu
>>>>
>>>>> If you change the message a lot of scripts will have to be
>>>>> changed, at least make it worth it.
>>>>>
>>>>> --
>>>>>
>>>>> With Best Regards,
>>>>> Marat Khaliili
>>>>>
>>>
>
next prev parent reply other threads:[~2017-09-25 14:33 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-09-19 7:41 [PATCH] btrfs-progs: subvolume: outputs message only when operation succeeds Misono, Tomohiro
2017-09-20 2:32 ` Satoru Takeuchi
2017-09-25 7:30 ` Nikolay Borisov
2017-09-25 7:42 ` Marat Khalili
2017-09-25 7:43 ` Hugo Mills
2017-09-25 7:46 ` Qu Wenruo
2017-09-25 7:52 ` Hugo Mills
2017-09-25 8:04 ` Qu Wenruo
2017-09-25 8:08 ` Qu Wenruo
2017-09-25 9:27 ` Marat Khalili
2017-09-25 14:19 ` Hugo Mills
2017-09-25 14:33 ` Qu Wenruo [this message]
2017-09-25 15:17 ` Marat Khalili
2017-09-25 16:11 ` Wrong device? linux-btrfs
2017-09-26 7:31 ` Lukas Pirl
2017-09-27 14:06 ` Andrei Borzenkov
2017-09-26 8:06 ` Duncan
2017-09-27 8:26 ` Ari Saastamoinen
2017-09-25 9:11 ` [PATCH] btrfs-progs: subvolume: outputs message only when operation succeeds Marat Khalili
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=d0e2c24a-c6c6-c154-c8ad-d37fdea669d5@gmx.com \
--to=quwenruo.btrfs@gmx.com \
--cc=hugo@carfax.org.uk \
--cc=linux-btrfs@vger.kernel.org \
--cc=misono.tomohiro@jp.fujitsu.com \
--cc=mkh@rqc.ru \
--cc=nborisov@suse.com \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).