[Tarantool-patches] [PATCH 11/12] popen: clarify popen_read_timeout error message

Alexander Turenko alexander.turenko at tarantool.org
Thu Apr 16 00:45:36 MSK 2020


On Wed, Apr 15, 2020 at 10:39:30AM +0300, Cyrill Gorcunov wrote:
> On Wed, Apr 15, 2020 at 07:21:36AM +0300, Alexander Turenko wrote:
> > >  
> > >  	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.
> 
> I think better "popen: neither stdout nor stderr is set", but no
> strong preferences here (except there is no such word as 'choosen')

Strictly speaking ...FD_STD{OUT,ERR} can be set, they are flags. But
stdout / stderr are not flags, it is a stream on which a user want to do
an operaton. It is requested, askec, chosen.

However options in the Lua API names exactly as 'stdin', 'stdout',
'stderr': so 'set' is meaningful for the Lua API.

Anyway, I guess 'stdout is set' is handy shortcut for formal 'asked to
operate on stdout'. So I'll just use 'set' here.

Thanks for the advice!

----

The incremental diff:

diff --git a/src/lib/core/popen.c b/src/lib/core/popen.c
index d33efbb18..ee16da28b 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: stdin is not choosen.
+ *   - flags: stdin is not set.
  *   - handle: handle does not support the requested IO operation.
  * - SocketError: an IO error occurs at write().
  * - TimedOut: @a timeout quota is exceeded.
@@ -322,7 +322,7 @@ popen_write_timeout(struct popen_handle *handle, const void *buf,
 	}
 
 	if (!(flags & POPEN_FLAG_FD_STDIN)) {
-		diag_set(IllegalParams, "popen: stdin is not choosen");
+		diag_set(IllegalParams, "popen: stdin is not set");
 		return -1;
 	}
 
@@ -359,7 +359,7 @@ popen_write_timeout(struct popen_handle *handle, const void *buf,
  *
  * - IllegalParams: a parameter check fails:
  *   - count: buffer is too big.
- *   - flags: stdout and stdrr are both choosen or both missed
+ *   - flags: stdout and stdrr are both set 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,7 +379,7 @@ popen_read_timeout(struct popen_handle *handle, void *buf,
 
 	if (!(flags & (POPEN_FLAG_FD_STDOUT | POPEN_FLAG_FD_STDERR))) {
 		diag_set(IllegalParams,
-			 "popen: neither stdout nor stderr is choosen");
+			 "popen: neither stdout nor stderr is set");
 		return -1;
 	}
 


More information about the Tarantool-patches mailing list