[Tarantool-patches] [PATCH luajit 2/2] Fix io.close() error message.

Sergey Kaplun skaplun at tarantool.org
Thu Jul 14 10:54:52 MSK 2022


Hi, Sergos!

Thanks for the review!

On 13.07.22, sergos wrote:
> Hi!
> 
> Thanks for the patch!
> 
> Just minor comments.

I've updated commit message to the following:

===================================================================
Fix io.close() error message.

Reported by François Perrad.

When an `io.close()` is called without arguments on an already closed
default output, the returned error message is `LJ_ERR_IOSTDCL`
("standard file is closed") instead of `LJ_ERR_IOCLFL` ("attempt to use
a closed file"). It is never a "real" standard file, because trying to
close a standard throws an error ("cannot close standard file"). Also,
this is inconsistent with PUC Lua.

This patch adds the corresponding check and a code branch for this
corner case.

Sergey Kaplun:
* added the description and the test for the problem

Part of tarantool/tarantool#7230
===================================================================

> 
> LGTM
> Sergos
> 
> 
> > On 18 May 2022, at 11:58, Sergey Kaplun <skaplun at tarantool.org> wrote:
> > 
> > From: Mike Pall <mike>
> > 
> > Reported by François Perrad.
> > 
> > When `io.close()` is called without arguments on already closed default
>       an                                          an 
> 
> > output the error message is `LJ_ERR_IOSTDCL` ("standard file is closed”)
>                        returned
> 
> > instead of `LJ_ERR_IOCLFL` ("attempt to use a closed file").  It is
> > never a "real" standard file, because trying to close a standard throws
> > an error ("cannot close standard file"). Also, this is inconsistent with
> > PUC Lua.
> > 
> > This patch adds the corresponding check and code branch for this corner
>                                              a
> 
> > case.
> > 
> > Sergey Kaplun:
> > * added the description and the test for the problem
> > ---
> > src/lib_io.c                                           | 10 ++++++++--
> > .../lj-735-io-close-on-closed-file.test.lua            |  5 +++--
> > 2 files changed, 11 insertions(+), 4 deletions(-)

<snipped>

> > 
> 

-- 
Best regards,
Sergey Kaplun


More information about the Tarantool-patches mailing list