From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#67711: Org Babel gives incomplete result when writing multi-thread code Date: Fri, 08 Dec 2023 16:47:14 +0200 Message-ID: <83lea4zr7x.fsf@gnu.org> References: Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="2985"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 67711@debbugs.gnu.org To: ". shynur" Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Fri Dec 08 15:48:10 2023 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1rBc9B-0000bo-EL for geb-bug-gnu-emacs@m.gmane-mx.org; Fri, 08 Dec 2023 15:48:09 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rBc8v-00018M-CG; Fri, 08 Dec 2023 09:47:53 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rBc8r-000185-OS for bug-gnu-emacs@gnu.org; Fri, 08 Dec 2023 09:47:49 -0500 Original-Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rBc8r-0004Wj-C5 for bug-gnu-emacs@gnu.org; Fri, 08 Dec 2023 09:47:49 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1rBc94-0008Vm-Ah for bug-gnu-emacs@gnu.org; Fri, 08 Dec 2023 09:48:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 08 Dec 2023 14:48:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 67711 X-GNU-PR-Package: emacs Original-Received: via spool by 67711-submit@debbugs.gnu.org id=B67711.170204683832578 (code B ref 67711); Fri, 08 Dec 2023 14:48:02 +0000 Original-Received: (at 67711) by debbugs.gnu.org; 8 Dec 2023 14:47:18 +0000 Original-Received: from localhost ([127.0.0.1]:44306 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rBc8M-0008TL-CQ for submit@debbugs.gnu.org; Fri, 08 Dec 2023 09:47:18 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:46914) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rBc8K-0008T6-II for 67711@debbugs.gnu.org; Fri, 08 Dec 2023 09:47:16 -0500 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rBc82-0003Pj-19; Fri, 08 Dec 2023 09:46:58 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=isg1mSaoViQy1QgZzD1casK5RjOWYvgtFn3AZyt2zQo=; b=iKy5aV0+Afuc ZRg/x1SX1SoiEePxsHOHAlW7I5qr67VwU/O2CAsoInkho/zd3kpkXB9DWe6zW+9gnYtDXfVWPhtJo XHlMPWT3oJ3LEisyoO2gKPB/BDVziOb7xif9NK0YzElxstQfNyfnooY9adbQ5lNtYG4Ceudl7QiEv b6rNFSe22BUeqKAxXtDt0yQ5VpZ5f3PMDvb4orhOwJtP7Jybvs3wB1f0BlAQIOi7b9rq0yZMjqMdJ Bl4drWSd0ESbi57Oja8QysRQu1vQGIi+Z7q6SqzCxKZYj9HfYkEog41b9nN9rjeWVxdZIRERsiFXS vWRu9GSOHSHXDMjH0sosfA==; In-Reply-To: (one.last.kiss@outlook.com) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:275784 Archived-At: > From: ". shynur" > Date: Fri, 8 Dec 2023 14:31:37 +0000 > msip_labels: > > (I use Emacs v29.1.90 for MS-Windows; gcc 10.3.0) > Here's an Org file: > > #+BEGIN_SRC C > #include > #include > int main() { > #pragma omp parallel num_threads(3) > printf("0"), printf("1"); > } > #+END_SRC > > # Local Variables: > # eval: (require 'ob-C) > # org-babel-C-compiler: "gcc.exe \ > # -std=c17 -Wall -O0 \ > # -fopenmp " > # org-confirm-babel-evaluate: nil > # End: > > Executing the C code block usually outputs: > > #+RESULTS: > : 10101 > > #+RESULTS: > : 1101 > > This output was unexpected, so I personally ran the temporary EXE file generated by Org-Babel: > > Windows Terminal > PS D:/Tmp/babel-Xyz123> ./C-bin-Xyz123.exe > 010101 > > As you can see, this program should output 6 characters. The above invocation is AFAIU not an accurate reproduction of what happens when this program is invoked from Emacs on MS-Windows. Emacs on Windows communicates with subprocesses via pipes, so a more accurate reproduction would be something like C-bin-Xyz123.exe | more IOW, you need to invoke the program with its output redirected to a pipe. In any case, please report this to the Org developers first, and only if their analysis shows this is a core Emacs problem, come here. Thanks.