From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtpng3.m.smailru.net (smtpng3.m.smailru.net [94.100.177.149]) (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 A45774765E0 for ; Thu, 24 Dec 2020 19:00:35 +0300 (MSK) References: <54ef9ccd2a7bee1f5f53a811c7edea1ba034c4ca.1608159414.git.lvasiliev@tarantool.org> <8e66938a-e950-1b80-e664-13af405dfaeb@tarantool.org> <200e5cd6-6c8c-d784-42ae-0a941a7b9e1b@tarantool.org> From: Vladislav Shpilevoy Message-ID: <9af9fff1-81d7-f7ce-ca7e-171f551dfc72@tarantool.org> Date: Thu, 24 Dec 2020 17:00:31 +0100 MIME-Version: 1.0 In-Reply-To: <200e5cd6-6c8c-d784-42ae-0a941a7b9e1b@tarantool.org> Content-Type: text/plain; charset="utf-8" Content-Language: en-US Content-Transfer-Encoding: 8bit Subject: Re: [Tarantool-patches] [PATCH v3 1/2] sql: add missing diag_set on failure when working inside os_unix.c List-Id: Tarantool development patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Leonid Vasiliev , tarantool-patches@dev.tarantool.org, imeevma@tarantool.org, korablev@tarantool.org, sergos@tarantool.org Hi! Thanks for the fixes! See 1 comment below. After that the patchset will LGTM, and you can send it to Nikita on a second review. > diff --git a/src/box/sql/os_unix.c b/src/box/sql/os_unix.c > index d64f1bd..07461f5 100644 > --- a/src/box/sql/os_unix.c > +++ b/src/box/sql/os_unix.c > @@ -873,6 +908,12 @@ unixWrite(sql_file * id, const void *pBuf, int amt, sql_int64 offset) >              /* lastErrno set by seekAndWrite */ >              return -1; >          } else { > +            /* Wrote to file less than planned. */ > +            const char *err = tt_sprintf("wrote less (%i bytes) " > +                             "than planned (%i bytes) " > +                             "to file: %s", > +                             wrote, amt, pFile->zPath); > +            diag_set(ClientError, ER_SQL_EXECUTE, err); Planned wasn't amt, because amt is modified in the loop above. Also 'wrote' will be -1 here, because this branch is taked on ENOSPC and write() returned -1. Perpahs it is enough to say that didn't have enough space to write 'amt' bytes (this is how much was left to write). >              storeLastErrno(pFile, 0);    /* not a system error */ >              return -1; >          }