From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Original-To: caml-list@sympa.inria.fr Delivered-To: caml-list@sympa.inria.fr Received: from mail3-relais-sop.national.inria.fr (mail3-relais-sop.national.inria.fr [192.134.164.104]) by sympa.inria.fr (Postfix) with ESMTPS id CC0F58009A for ; Sat, 3 Dec 2016 20:36:26 +0100 (CET) Authentication-Results: mail3-smtp-sop.national.inria.fr; spf=None smtp.pra=rich@annexia.org; spf=Pass smtp.mailfrom=rich@annexia.org; spf=Pass smtp.helo=postmaster@annexia.org Received-SPF: None (mail3-smtp-sop.national.inria.fr: no sender authenticity information available from domain of rich@annexia.org) identity=pra; client-ip=80.68.91.176; receiver=mail3-smtp-sop.national.inria.fr; envelope-from="rich@annexia.org"; x-sender="rich@annexia.org"; x-conformance=sidf_compatible Received-SPF: Pass (mail3-smtp-sop.national.inria.fr: domain of rich@annexia.org designates 80.68.91.176 as permitted sender) identity=mailfrom; client-ip=80.68.91.176; receiver=mail3-smtp-sop.national.inria.fr; envelope-from="rich@annexia.org"; x-sender="rich@annexia.org"; x-conformance=sidf_compatible; x-record-type="v=spf1" Received-SPF: Pass (mail3-smtp-sop.national.inria.fr: domain of postmaster@annexia.org designates 80.68.91.176 as permitted sender) identity=helo; client-ip=80.68.91.176; receiver=mail3-smtp-sop.national.inria.fr; envelope-from="rich@annexia.org"; x-sender="postmaster@annexia.org"; x-conformance=sidf_compatible; x-record-type="v=spf1" IronPort-PHdr: =?us-ascii?q?9a23=3A+436cx33X1lBkwdLsmDT+DRfVm0co7zxezQtwd8Z?= =?us-ascii?q?se0SLfad9pjvdHbS+e9qxAeQG96KsLQY1qGL4+jJYi8p2d65qncMcZhBBVcuqP?= =?us-ascii?q?49uEgeOvODElDxN/XwbiY3T4xoXV5h+GynYwAOQJ6tL1LdrWev4jEMBx7xKRR6?= =?us-ascii?q?JvjvGo7Vks+7y/2+94fdbghMijexe7x/IRW5oQjRtcQdnJdvJLs2xhbVuHVDZv?= =?us-ascii?q?5YxXlvJVKdnhb84tm/8Zt++ClOuPwv6tBNX7zic6s3UbJXAjImM3so5MLwrhnM?= =?us-ascii?q?URGP5noHXWoIlBdDHhXI4wv7Xpf1tSv6q/Z91SyHNsD4Ubw4RTKv5LpwRRT2lC?= =?us-ascii?q?kIKSI28GDPisxxkq1bpg6hpwdiyILQeY2ZKeZycr/Ycd4cWGFPXNteVzZZD42y?= =?us-ascii?q?b4UBEfcPM+VWr4byu1QBsBmxCge3CePz1jNFnGP60bEg3ug/FwzNwQwuH8gJsH?= =?us-ascii?q?TRtNj5OrscUeGpw6nI1zrDde5Z0ir954TSdR4tu+yHU7Z3ccrX10YvDA3JhUiX?= =?us-ascii?q?pIz/PjOayuQNvnOB4OpmU+KglWEmqwBrrTS1wccskIbJi5sTx1vZ9it52J44KN?= =?us-ascii?q?6kREJhYNOpE4FcuiWHO4dsX88vQWBltSAnwbMco5G7ZjIFyJE/yh7fdfOHd4+I?= =?us-ascii?q?7wr5W+aXJzd3mn1keLOliBqo9kig0OL8WtG10FZMsCVFjsHBu3MR2xDJ68WKSe?= =?us-ascii?q?Fx80O81TqVygze6OBJLVgxlaXBKp4hxrAwloAUsUTGBiL2gkT2g7OWdkg/4Oeo?= =?us-ascii?q?7eLnbavpp5+dLYB4kAb+Mr4hmsCnG+Q3LhAOX3SH+eS7zLDs4Vf2QLBOjvEvlq?= =?us-ascii?q?nZsYvaJdgAq66iAw5V154j5AylAzen1tQYh3gHI0hfdBKJlYi6c23JdfH9CP65?= =?us-ascii?q?nlmo2DNq2+LcOaHhSsHMKnnfgq3mYbZV5EtVyQ51xtdascF6ELYEdbjJW0Txvc?= =?us-ascii?q?bURiB/Fkr84eHhBc43ntcEWGmPKqafNq7CsFbO4fggdbrfLLQJsSrwfqB2r8Xl?= =?us-ascii?q?imU0zBpEJfGk?= X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: =?us-ascii?q?A0CbAgBLHUNY/7BbRFBdGgEBAQECAQEBA?= =?us-ascii?q?QgBAQEBFQEBAQECAQEBAQgBAQEBgw0BAQEBAR+EW4pMlWcGgR2QMoRLggiGIgK?= =?us-ascii?q?CHT8UAQEBAQEBAQEBAQFhKIIzGgGCGgEBAQMBOj8FCwsYCRMSDwUoIS6ITAyvZ?= =?us-ascii?q?IsxAQEBBwIBJIV0QIRlh3mCMAWaZgGRCZBKSY05hA0fN4EZI4UyPoo0AQEB?= X-IPAS-Result: =?us-ascii?q?A0CbAgBLHUNY/7BbRFBdGgEBAQECAQEBAQgBAQEBFQEBAQE?= =?us-ascii?q?CAQEBAQgBAQEBgw0BAQEBAR+EW4pMlWcGgR2QMoRLggiGIgKCHT8UAQEBAQEBA?= =?us-ascii?q?QEBAQFhKIIzGgGCGgEBAQMBOj8FCwsYCRMSDwUoIS6ITAyvZIsxAQEBBwIBJIV?= =?us-ascii?q?0QIRlh3mCMAWaZgGRCZBKSY05hA0fN4EZI4UyPoo0AQEB?= X-IronPort-AV: E=Sophos;i="5.33,294,1477954800"; d="scan'208";a="202723149" Received: from annexia.org ([80.68.91.176]) by mail3-smtp-sop.national.inria.fr with ESMTP/TLS/AES128-GCM-SHA256; 03 Dec 2016 20:36:26 +0100 Received: from rich by annexia.org with local (Exim 4.84_2) (envelope-from ) id 1cDG6i-0007kQ-U7; Sat, 03 Dec 2016 19:36:24 +0000 Date: Sat, 3 Dec 2016 19:36:24 +0000 From: "Richard W.M. Jones" To: immanuel litzroth Cc: OCaML List Mailing Message-ID: <20161203193624.GB28111@annexia.org> References: <20161203132028.GA28111@annexia.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.23 (2014-03-12) Subject: Re: [Caml-list] Raising invalid_argument with a constructed string. On Sat, Dec 03, 2016 at 03:00:57PM +0100, immanuel litzroth wrote: > Yes, I've used that solution too, keeping a static fixed string around, > it's just not very nice and will break if it's ever multithreaded. You shouldn't make the string static, and we do *not* do that in libguestfs. You should simply allocate it on the stack. This is thread safe. Also on the bug it was stated: > The stack-based solutions rely on guessing arbitrary size limits on > the dynamic strings, which is often possibles but sometimes > inconvenient/inelegant. but this is not true either. You can use alloca to allocate a variable sized string on the stack. As Xavier Leroy says, fixing this is not necessary, although there's perhaps a usability argument. Rich.