From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp39.i.mail.ru (smtp39.i.mail.ru [94.100.177.99]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dev.tarantool.org (Postfix) with ESMTPS id AA7AE4696C4 for ; Wed, 15 Apr 2020 07:21:40 +0300 (MSK) Date: Wed, 15 Apr 2020 07:21:36 +0300 From: Alexander Turenko Message-ID: <20200415042136.p6udliisud4da2kf@tkn_work_nb> References: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: Subject: Re: [Tarantool-patches] [PATCH 11/12] popen: clarify popen_read_timeout error message List-Id: Tarantool development patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Cyrill Gorcunov Cc: tarantool-patches@dev.tarantool.org On Tue, Apr 14, 2020 at 02:38:20PM +0300, Alexander Turenko wrote: > Popen backend errors should be meaningful for a user of the popen Lua > API, because otherwise we'll need to map backend errors into Lua API > errors. This particular failure can't appear when the function is called > from the Lua API, but it is good to keep all error messages in one > style. > > Part of #4031 > --- > src/lib/core/popen.c | 6 +++--- > 1 file changed, 3 insertions(+), 3 deletions(-) > > diff --git a/src/lib/core/popen.c b/src/lib/core/popen.c > index 36cd7b07d..640dffc2b 100644 > --- a/src/lib/core/popen.c > +++ b/src/lib/core/popen.c > @@ -360,7 +360,7 @@ popen_write_timeout(struct popen_handle *handle, const void *buf, > * > * - IllegalParams: a parameter check fails: > * - count: buffer is too big. > - * - flags: POPEN_FLAG_FD_STD{OUT,ERR} are set or unset both. > + * - flags: stdout and stdrr are both choosen or both missed > * - handle: handle does not support the requested IO operation. > * - SocketError: an IO error occurs at read(). > * - TimedOut: @a timeout quota is exceeded. > @@ -379,8 +379,8 @@ popen_read_timeout(struct popen_handle *handle, void *buf, > } > > if (!(flags & (POPEN_FLAG_FD_STDOUT | POPEN_FLAG_FD_STDERR))) { > - diag_set(IllegalParams, "popen: POPEN_FLAG_FD_STD{OUT,ERR} are " > - "unset both"); > + diag_set(IllegalParams, > + "popen: neither stdout nor stderr is choosen"); > return -1; > } I was inattentive: there is an error message of the same style in popen_read_timeout(). Those functions should be changed both together. Incremental diff: diff --git a/src/lib/core/popen.c b/src/lib/core/popen.c index 640dffc2b..64711d737 100644 --- a/src/lib/core/popen.c +++ b/src/lib/core/popen.c @@ -297,7 +297,7 @@ stdX_str(unsigned int index) * * - IllegalParams: a parameter check fails: * - count: data is too big. - * - flags: POPEN_FLAG_FD_STDIN bit is unset. + * - flags: stdin is not choosen. * - handle: handle does not support the requested IO operation. * - SocketError: an IO error occurs at write(). * - TimedOut: @a timeout quota is exceeded. @@ -322,8 +322,7 @@ popen_write_timeout(struct popen_handle *handle, const void *buf, } if (!(flags & POPEN_FLAG_FD_STDIN)) { - diag_set(IllegalParams, - "popen: POPEN_FLAG_FD_STDIN bit is unset"); + diag_set(IllegalParams, "popen: stdin is not choosen"); return -1; } The new commit message: | popen: refine popen_{read,write}_timeout errors | | Popen backend errors should be meaningful for a user of the popen Lua | API, because otherwise we'll need to map backend errors into Lua API | errors. Those particular failures can't appear when the functions are | called from the Lua API, but it is good to keep all error messages in | one style. | | Part of #4031 Don't sure, however, that 'choosen' is the right word in this context.