From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp1.migadu.com ([2001:41d0:403:58f0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms8.migadu.com with LMTPS id GFHoEkcT7GV8ggAA62LTzQ:P1 (envelope-from ) for ; Sat, 09 Mar 2024 08:44:07 +0100 Received: from aspmx1.migadu.com ([2001:41d0:403:58f0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp1.migadu.com with LMTPS id GFHoEkcT7GV8ggAA62LTzQ (envelope-from ) for ; Sat, 09 Mar 2024 08:44:07 +0100 X-Envelope-To: larch@yhetil.org Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=cassou.me header.s=dkim header.b=WGusdJWQ; spf=pass (aspmx1.migadu.com: domain of "emacs-orgmode-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="emacs-orgmode-bounces+larch=yhetil.org@gnu.org"; dmarc=pass (policy=none) header.from=cassou.me ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1709970247; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type:list-id:list-help:list-unsubscribe: list-subscribe:list-post:dkim-signature; bh=c0fgagRPY1b3je8wsosHWHS1AzJofgKsL79KAaQ/qRQ=; b=p5JgxCmdOyLOA9Rk5AhdVRQvgotRL+WtMSn2ZB/GcuHPd+A7iiZlMG0Fmp9qi5KA/QwPzB IzWPIMcSYXYr/oTnyY2Stfd9wrKTfdRbWwfTIAnv767Afs567aGmF4kLGfVUUIQJNtgEPp 6p222rRpHSUCBgEAmuE9B9puRm2h+FjeYlVrD0q/vcN6NUg7g/QpDDvOzgb79gtGAu3dxY zGzRgfAo6gOC7p53ZYBL25nHWoteqfy7XJNF2i6P3vga6pGbrCgeIpxvzCJby9YgUqIZgO wMGaCFYDLd7TP9ceVAp4JcaakE4w7dpZhLg6vyp0j9gZOW3S5JEVpKR8Y3PM5Q== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1709970247; a=rsa-sha256; cv=none; b=CmbAcjcasxuM6cjJ6B1IxzdlNh80fvC+l47og6gUKvAeGfWj1EIMIZN8n5B8UGLMVf9Wwf gwqLHf230oKN4+FRFEYXSFqxObTQ0rIwGphPH4oQaFVINoRqsPz71PBiv9TRxWTetTXyjx BBpofPhl6H+HROrRqfvVKw0RkXSkIcMsXYVSs4hYh6yuJPnUSogLjRLRcIr/XSluk6fyjx aFgExODli7e/SFWvEJkXYmO1zTi5VXNwBzy5xxZoD1HJ7D6wqGhSPyz8rGkznRpjwi9s+r X1CP/ZRiOTjPGBReDqEaZv3vY92QjwyLlW+6jzaZ7OsGQxYHd/LOm92J+N4a/g== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=cassou.me header.s=dkim header.b=WGusdJWQ; spf=pass (aspmx1.migadu.com: domain of "emacs-orgmode-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="emacs-orgmode-bounces+larch=yhetil.org@gnu.org"; dmarc=pass (policy=none) header.from=cassou.me Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id B7BF242B25 for ; Sat, 9 Mar 2024 08:44:06 +0100 (CET) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rirMB-0002tm-Jz; Sat, 09 Mar 2024 02:42:59 -0500 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 1rirM8-0002sk-9f for emacs-orgmode@gnu.org; Sat, 09 Mar 2024 02:42:56 -0500 Received: from mail.reprendre.net ([2001:910:1410:501::1]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rirM4-00076L-Mj for emacs-orgmode@gnu.org; Sat, 09 Mar 2024 02:42:55 -0500 Received: from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon) with ESMTPSA id C22742C1CB9 for ; Sat, 9 Mar 2024 08:42:31 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cassou.me; s=dkim; t=1709970152; h=from:subject:date:message-id:to:mime-version:content-type; bh=c0fgagRPY1b3je8wsosHWHS1AzJofgKsL79KAaQ/qRQ=; b=WGusdJWQLKIeNdmNvckB27C+mRVs1G6RXNp4HNSkrUZG4g2xgMfF2AiheBcC3kRtoEPGgc ni3UnGrrCLMcPBnasZyhAZjMUzVun0NhvBzeaf0ublE4hGSx/XXtiTBzeDZnhwQljxFLXs PdNIA6TJ1so/ua2TBouokL2qckAc513EIOQJZodpnmq7q0es5kxbpuyBxqiPyCiUpu/c9I bzeoyhA5v7O3eOmfrc7thjlx2CyjODK2ZqEdo5R4UUE7lS3lhhq7LN3W+uMoMriRk7WCol sfoscgeE55bK667/bERaBWiaKnt+KMFwkAc+uHPnvqCSCgrORMZg2CIu5DjIfw== From: Damien Cassou To: emacs-orgmode@gnu.org Subject: [BUG] [PATCH] org-babel-execute-buffer: Prevent executing non-code blocks [9.6.20 ( @ /home/cassou/.emacs.d/lib/org/lisp/)] Date: Sat, 09 Mar 2024 08:42:30 +0100 Message-ID: <87zfv7kg0p.fsf@cassou.me> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Last-TLS-Session-Version: TLSv1.3 Received-SPF: pass client-ip=2001:910:1410:501::1; envelope-from=damien@cassou.me; helo=mail.reprendre.net X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-orgmode@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+larch=yhetil.org@gnu.org Sender: emacs-orgmode-bounces+larch=yhetil.org@gnu.org X-Migadu-Flow: FLOW_IN X-Migadu-Country: US X-Migadu-Spam-Score: -7.47 X-Spam-Score: -7.47 X-Migadu-Queue-Id: B7BF242B25 X-Migadu-Scanner: mx11.migadu.com X-TUID: X2s0vs8eDJ6b --=-=-= Content-Type: text/plain Remember to cover the basics, that is, what you expected to happen and what in fact did happen. You don't know how to make a good report? See https://orgmode.org/manual/Feedback.html#Feedback Your bug report will be posted to the Org mailing list. ------------------------------------------------------------------------ The command `org-babel-execute-buffer' tries to execute all source code blocks of the current buffer. When it encounters a block that is not executable the command crashes. The attached patch makes the command ignore non-executable blocks and move on. Emacs : GNU Emacs 29.2 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.41, cairo version 1.18.0) Package: Org mode version 9.6.20 ( @ /home/cassou/.emacs.d/lib/org/lisp/) -- Damien Cassou "Success is the ability to go from one failure to another without losing enthusiasm." --Winston Churchill --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=0001-org-babel-execute-buffer-Prevent-executing-non-code-.patch >From 0879a7f4b855465a9cb1532293726a9a3d7d7c75 Mon Sep 17 00:00:00 2001 From: Damien Cassou Date: Sat, 9 Mar 2024 08:35:44 +0100 Subject: [PATCH] org-babel-execute-buffer: Prevent executing non-code blocks * lisp/ob-core.el (org-babel-execute-buffer): Guard against evaluating non-code blocks. --- lisp/ob-core.el | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lisp/ob-core.el b/lisp/ob-core.el index bfeac257b..ca7afcdc5 100644 --- a/lisp/ob-core.el +++ b/lisp/ob-core.el @@ -1417,7 +1417,11 @@ (defun org-babel-execute-buffer (&optional arg) (if (org-element-type-p (org-element-context) '(babel-call inline-babel-call)) (org-babel-lob-execute-maybe) - (org-babel-execute-src-block arg))))) + (let* ((info (org-babel-get-src-block-info)) + (lang (nth 0 info)) + (cmd (intern (concat "org-babel-execute:" lang)))) + (when (fboundp cmd) + (org-babel-execute-src-block arg))))))) ;;;###autoload (defun org-babel-execute-subtree (&optional arg) -- 2.43.1 --=-=-=--