From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp12.migadu.com ([2001:41d0:403:478a::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms8.migadu.com with LMTPS id eETBDj6PN2WyggEAauVa8A:P1 (envelope-from ) for ; Tue, 24 Oct 2023 11:32:46 +0200 Received: from aspmx1.migadu.com ([2001:41d0:403:478a::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp12.migadu.com with LMTPS id eETBDj6PN2WyggEAauVa8A (envelope-from ) for ; Tue, 24 Oct 2023 11:32:46 +0200 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 958F06BA6F for ; Tue, 24 Oct 2023 11:32:43 +0200 (CEST) Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=rootshell.ro header.s=default header.b=rh1to+LA; 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=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1698139966; 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: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post:dkim-signature; bh=q4KGPOxAS5LbZzat/FEUAG0KyaCRuN+QtgtCLUThWVo=; b=tZC1W8si+wTBxLTX0dv9+RWwZUbzbX0+mCLBs3dpbEgJGM2fPHKCznMXUwP2xtsXXAUCgH 9/E8FqCA12KX/fsl4nMym6Vayt8VuM8LeBqegffBDpqcEPdnBSfzPYOSS4m7ZiCFOgdQgD ufWliPcQE7gbbyE2dg1HKgG1atEFTRBW5ezgtbHKe10zNpST850gHcYm3y7931e+/wvqWY YUpTwsfbxExV/U5OuV/sBn1CxZpE+mxvfU5mDNArdzeWqnCy2+7Baq5TsmGN/EOZFqba1T s8Ozymgn38ZJDPcKdP6vqA9aqtdYtoBO0SxgM/itXkFaFPYHKjc3gUO49h03fQ== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1698139966; a=rsa-sha256; cv=none; b=GOnTgQTCdb4PX2Kb+dP/YTlQnikpZvsr/Cr5RHkSjecT6Qf21TBbMXMMskI/aN/kLPOhJE NffV7B81FI9K7Gh0HApPTtIuN+Xa2k1NqOGnAmJquZ/I2eiXPRgpxCZBjhGGU+GVZXLmUK PcFjltR/IeyN1SZArN89+Ji4AKOrh60C2+cd2CNzgUsdbDgdUpPV5UO+S+X8Xn8GFe51DI 4mEwA4wfNNCpiSfZ3H/jr/6ZHCisptIoQfGJN4j1tzIOyjp/Ez4x1Y2Pa2rcBuh0I2qf4s /paaEkQIl0QsY8F3UFAndl3pP4jppQaTiTMUdpywy5/kld4CU8S7Tkqzd88CNg== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=rootshell.ro header.s=default header.b=rh1to+LA; 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=none Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qvDly-0007yf-Hv; Tue, 24 Oct 2023 05:32:27 -0400 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 1qvDll-0007vc-UK for emacs-orgmode@gnu.org; Tue, 24 Oct 2023 05:32:15 -0400 Received: from rootshell.ro ([82.79.32.74] helo=mail.rootshell.ro) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qvDlf-00070x-Dt for emacs-orgmode@gnu.org; Tue, 24 Oct 2023 05:32:12 -0400 Received: from localhost (unknown [IPv6:2001:4091:a247:81e5:c6ab:9e00:9c15:f896]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-384) server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mail.rootshell.ro (Postfix) with ESMTPSA id 3EBF8201BE for ; Tue, 24 Oct 2023 12:31:52 +0300 (EEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=rootshell.ro; s=default; t=1698139913; bh=vFxHZ0XrdIUsnsyFsBuCu3fsGN9pj86poYf4DS4uFZM=; h=Date:From:To:Subject:References:In-Reply-To:From; b=rh1to+LA07fsm/svvYVsBDMupVPsOmw/oHlZzr2NZkce1E11Gq490lgDDhXqTyiv6 eK9TX91rApyLdGBuCvHqmpqVXHWNB7tibydiiMq3+nXLNpN2+LWw1+uZu8D2hWYYqT 2ZL7mCHzljA4JKl0bIz+IOhAOEaKZFi3kuZArDYL0cflQMTBX2EJTsYcOMH7BczqSQ MB9ExxwZQgi0btvTBPSAI+4HsTj9EAieptvSbUDijwweRT4tiz7Cx/teK/eClJEquO Tfnnj3ZDqaqcUoqV90I/LXs4dD1Le4IDjy/ArevuXHEHuJSTRbl0JG3KZlixqEi+Pd slqLbqavhtPkg== Date: Tue, 24 Oct 2023 11:31:50 +0200 From: Florin Boariu To: emacs-orgmode@gnu.org Subject: Re: org-ditaa woes Message-ID: References: <87wmvhnr8b.fsf@t14.reltub.ca> <31b83821-3468-499c-a7f8-54912e5caf90@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: Received-SPF: pass client-ip=82.79.32.74; envelope-from=florin.om@rootshell.ro; helo=mail.rootshell.ro 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 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-Spam-Score: -5.35 X-Migadu-Queue-Id: 958F06BA6F X-Migadu-Scanner: mx0.migadu.com X-Migadu-Spam-Score: -5.35 X-TUID: 1zm9t2MbUP2a Hello, >I hope, a couple of workarounds are still possible. > >1. Get java command by adding bash -x (or /usr/bin/bash, or >"/usr/bin/env bash") > > flatpak-spawn --host toolbox run bash -x /usr/bin/ditaa \ > /tmp/foo.txt -o /tmp/foo.png > >- set `org-babel-ditaa-java-cmd' to something like > "flatpak-spawn --host toolbox run /usr/bin/java", >- set `org-ditaa-jar-path' to path to ditaa.jar reported by the >command above, There are a lot of assumptions baked into this one, for starters: that I can actually do "java -jar $PATH_REPORTED_BY_COMMAND.jar" actually works. It doesn't: sh-5.1$ flatpak-spawn --host toolbox run java -jar /usr/share/java/ditaa.jar Error: Unable to initialize main class org.stathissideris.ascii2image.core.CommandLineConverter Caused by: java.lang.NoClassDefFoundError: org/apache/commons/cli/ParseException 🤷 >- add other options to either `org-babel-header-args:ditaa' :java >property or to `org-babel-ditaa-java-cmd' >- perhaps add /usr/bin/env JAVA_HOME=... and other required >environment variables before java binary. ...and now I, despite not being a Java developer, need to figure out how to debug the execution of a program I didn't develop (in a language I'm not familiar with), and for which a perfectly functional script was _already_ delivered by my distribution in the form of "/usr/bin/ditaa" ;-) What actually _does_ work (and what I'm currently indeed using as a workaround) is download my own copy of ditaa.jar from their website, put it under ~/.local/share/ditaa/ditaa.jar, and set 'org-ditaa-jar-path' to that specific value. This still leaves me with the necessity to download a package through a side channel which already exists in my distribution as a pacakge, but at least I don't need to get into the bowels of Java to run it. >2. >- set `org-babel-ditaa-java-cmd' to > "flatpak-spawn --host toolbox run /usr/bin/ditaa". >- set `org-ditaa-jar-option' to empty string. >- Call of `shell-quote-argument' makes it impossible to set >`org-ditaa-jar-path' to empty string, so set the following variables >to some harmless value, e.g. "-Dfile.encoding=UTF-8" (anything added >through :java babel header argument): > + `org-ditaa-jar-path' > + `org-ditaa-eps-jar-path' I'm not sure whether I had thought of that (-Dfile.encoding is not recognized by recent ditaa, BTW, I think they have a new option for that). I think I had, but got stuck at "set org-ditaa-jar-option to empty string" :-D IIRD it threw an error (the one you said it would), and that's where I stopped investigating. >I agree that it should be possible to call ditaa executable directly. >Perhaps it is not possible because for a long time ditaa.jar was a >part of Org mode repository (there were a lot of messages against >dropping of jar files from the repository). I'm not sure having the .jar in the repository would even help in my case, unless the Emacs Flatpak specifically also shipped with a Java runtime. (And I think we agree that this shouldn't happen -- Emacs is a perfectly usable OS in its own right, no need for Java on top ;-) ). Because otherwise the .jar would be inside the Flatpak, and the runtime would be somewhere else from where it couldn't access the .jar. >It seems, nobody is ready to take responsibility and to become >maintainer of ob-ditaa.el while active users have no ability to >install ditaa as a package, so they anyway have to download .jar from >upstream. I can offer to try my luck with writing a patch for ob-ditaa.el, but I'm not knowledgeable enough (or have enough time on my hands) to actually keep maintaining it :-p >I find it tedious to add "flatpak-spawn ..." to every tool used by >Emacs. Who is the publisher of the flatpak? I would expect a directory >with symlinks named ditaa, java, git, gcc, cpp, etc to a script line > >#!/bin/sh >exec flatpak-spawn --host toolbox run /usr/bin/env "$0" "$@" > >(or "$(basename "$0")") > >mounted to flatpak runtime and added to $PATH. Perhaps another >approach exist and it should be discussed with the packager and Emacs >developers. It's a double-edged sword. Not every Flatpak distribution actually has a Toolbox infrastructure, too... (Flatpak didn't get invented with, or for, Fedora Silverblue; it was around for a long time before that. But Toolbox did.) So for most, "flatpak-spawn --host $CMD" would be the way to go, not "...toolbox run $CMD". And even in Toolbox systems, there can be more than one toolbox, so some might want to run "...toolbox run -c gcc-devel $CMD ...", where "gcc-devel" is a specific toolbox for GCC development. But with regards to the Emacs Flatpak: gcc, cpp and gitare part of it: sh-5.1$ which git /usr/bin/git sh-5.1$ which gcc /usr/bin/gcc sh-5.1$ (I'm guessing they're actually part of the underlying SDK -- Flatpaks apparently are a kind of "layered system", where specific applications can build upon the same support). But Java and Ditaa aren't: sh-5.1$ which java which: no java in (/app/bin:/usr/bin:/var/home/florin/.var/app/org.gnu.emacs/data/node/bin:/var/home/florin/.var/app/org.gnu.emacs/data/cargo/bin:/var/home/florin/.var/app/org.gnu.emacs/data/python/bin) So... 🤷 But that's the joy of experimental operating systems. When people start toying around in non-standard ways, there's always something that doesn't add up, or requires manual intervention even for trivial tasks. If anybody, then Linux people in general, and Emacs people specifically, should have made this their credo by now :-D It used to be like this 25 years ago when I started with Linux, when you couldn't even start a benign GUI without enchanting the XFree86 drivers for days. And it's the same today, just differently. Today we have Live ISOs, Steam for Linux, and a famous Redmond company timidly nudgnig their users towards a smoother Linux desktop than Windows ever was. But thankfully, containers and sandboxing and all the rage are here to "help", and thus old and comfortable patterns start becoming modern again... :) Flatpak's the new Black, baby! :-D (Now if you'll excuse me, I need to scream at some kids to get off my lawn... :-p ) Cheers, Florin. -- "Socks come in pairs. If you put a sock on your left foot, the other sock of the pair instantly becomes the “right sock,” no matter where it is located in the universe." -- quantum entanglement explained on /.