From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from [87.239.111.99] (localhost [127.0.0.1]) by dev.tarantool.org (Postfix) with ESMTP id DC62E6EC5B; Thu, 13 May 2021 11:17:05 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org DC62E6EC5B DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tarantool.org; s=dev; t=1620893826; bh=P1CtAz8IdHh3p9dNGPpUBanOa21w3R5yBqYnWrpntSE=; h=Date:To:References:In-Reply-To:Subject:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc: From; b=HocQKwlHNiLAqtgGIoVhVREN2ieySCTP4k/jq5lpvwEtAJfGYvdSxI6zix2bghwqm uJTQhMMI6WbbmIOUx2H/1EgR4tQki8WpZcXJMOK1hetXmX9MXCfJQtmq+eXm3/ava8 O1tYDLlM6VVJtm7Vlr8Bh0VlPZdqeyxvvft9ZMPU= Received: from mail-lj1-f179.google.com (mail-lj1-f179.google.com [209.85.208.179]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by dev.tarantool.org (Postfix) with ESMTPS id DAE796EC5B for ; Thu, 13 May 2021 11:17:03 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org DAE796EC5B Received: by mail-lj1-f179.google.com with SMTP id o8so1801245ljp.0 for ; Thu, 13 May 2021 01:17:03 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=VVYZWNHzYHJAw52MgS2yMbaz7KRxmyMmZPYVtvmB1e4=; b=c/8j8F3TiT4wlpZkyunvy6HqjN76Hyi6W6fincmq9tBFfeF5sLWMlgZ17Cz7AmpvhH fg6q4SsiWUtAqWSUVF2VNUXqiPwHBMU8m8lXLS91r9VQLti2O5z1p66PLPlFZRPWrR0O XTH8w0AuIsUwkXZLouC2a4dzz+JmqbOXyvhMR5Xk8xvqmD5VfmDahKSnGIF8WUxZnACk FLJDEUgWsdlGPf9+1AAVWYv8FPRMykJXqxOZWEKY2KbwpxkqNJ+XOULpl++mBfb7zQcN 6gJLaaTA278r0C8q3iKNDiKQGPGPC+7dch56/lgedGaR3U9JY/MAUgrGzjNji+fthl3R IHoQ== X-Gm-Message-State: AOAM533/VOUU5iPmstDbJV6oDUTPqtGITECjDXNQYaPa//keZBqSQ2kd P5YfwUb4DK/edTax/JUvCAW7/RbTqFw= X-Google-Smtp-Source: ABdhPJyVR6gHFcfjBvZmfTbXh88P3ETFBHtUaJM6KkSigs67VbKn+evsU7gnsW1lJWZYqQyeHV0fpQ== X-Received: by 2002:a2e:501e:: with SMTP id e30mr32276510ljb.327.1620893822651; Thu, 13 May 2021 01:17:02 -0700 (PDT) Received: from grain.localdomain ([5.18.171.94]) by smtp.gmail.com with ESMTPSA id m22sm218038lfb.69.2021.05.13.01.17.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 13 May 2021 01:17:01 -0700 (PDT) Received: by grain.localdomain (Postfix, from userid 1000) id 73C665A003D; Thu, 13 May 2021 11:17:00 +0300 (MSK) Date: Thu, 13 May 2021 11:17:00 +0300 To: Vladislav Shpilevoy Message-ID: References: <20210504155819.290874-1-gorcunov@gmail.com> <3917eb85-85e6-56d1-4176-7d6926587a49@tarantool.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <3917eb85-85e6-56d1-4176-7d6926587a49@tarantool.org> User-Agent: Mutt/2.0.6 (2021-03-06) Subject: Re: [Tarantool-patches] [PATCH v3 00/10] fix say_x format and rework fibers X-BeenThere: tarantool-patches@dev.tarantool.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Tarantool development patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , From: Cyrill Gorcunov via Tarantool-patches Reply-To: Cyrill Gorcunov Cc: tml Errors-To: tarantool-patches-bounces@dev.tarantool.org Sender: "Tarantool-patches" On Wed, May 12, 2021 at 08:41:42PM +0200, Vladislav Shpilevoy wrote: > > > > static int > > lbox_fiber_top_entry(struct fiber *f, void *cb_ctx) > > { > > struct lua_State *L = (struct lua_State *) cb_ctx; > > > > --> lua_pushfstring(L, "%f/%s", (lua_Number)f->fid, f->name); > > > > why do we use float formate here at all?! > > Because lua_pushfstring() does not support %llu. What about the idea below? float is 4 byte len and won't cover the 8 byte integer so we will have a rounding error. --- [cyrill@grain tarantool.git] git diff diff --git a/src/lua/fiber.c b/src/lua/fiber.c index 02ec3d158..753b9aa16 100644 --- a/src/lua/fiber.c +++ b/src/lua/fiber.c @@ -337,7 +337,10 @@ lbox_fiber_top_entry(struct fiber *f, void *cb_ctx) { struct lua_State *L = (struct lua_State *) cb_ctx; - lua_pushfstring(L, "%f/%s", (lua_Number)f->fid, f->name); + char sbuf[FIBER_NAME_MAX + 32]; + snprintf(sbuf, sizeof(sbuf), "%llu/%s", + (long long)f->fid, f->name); + lua_pushstring(L, sbuf); lua_newtable(L);