From mboxrd@z Thu Jan 1 00:00:00 1970 From: Eric Schulte Subject: Re: [babel] how to pass data to gnuplot from another block Date: Fri, 13 Dec 2013 09:20:38 -0700 Message-ID: <87ob4kafjd.fsf@gmail.com> References: <87d2lsbvy7.fsf@ucl.ac.uk> <87iovkihe6.fsf@gmail.com> <8738mol52h.fsf@alphaville.bos.redhat.com> <874n73gk70.fsf@gmail.com> <87vbysahv0.fsf@gmail.com> Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:35196) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VrVV4-0002jI-5E for emacs-orgmode@gnu.org; Fri, 13 Dec 2013 11:22:07 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VrVUy-00006x-NG for emacs-orgmode@gnu.org; Fri, 13 Dec 2013 11:22:02 -0500 Received: from mail-pd0-x22a.google.com ([2607:f8b0:400e:c02::22a]:39867) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VrVUy-00006n-BY for emacs-orgmode@gnu.org; Fri, 13 Dec 2013 11:21:56 -0500 Received: by mail-pd0-f170.google.com with SMTP id g10so2675024pdj.29 for ; Fri, 13 Dec 2013 08:21:55 -0800 (PST) In-Reply-To: (Greg Troxel's message of "Fri, 13 Dec 2013 10:48:40 -0500") List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: Greg Troxel Cc: Nick Dokos , emacs-orgmode@gnu.org >> >> I understand your point, but in reality I doubt there are many systems >> on which people use Org-mode with code blocks and on which sh is >> available but no bash is installed. > > That may be true on some flavors of Linux, but on BSDs: > > bash is not the normal shell (and is not part of the base system, at > least on NetBSD, and I think that's still true on the others). When > it does exist it's not in /bin. > > It's not so odd to have a system without bash. > > I am also under the impression that Debian does not use bash as the > /bin/sh. > > org, like anything else, should be OS-agnostic, and follow open > standards whenever that's at all reasonable. > >> Bash is the new normal shell and I would argue is what most users expect >> from a shell code block. > > I find that pretty astounding. In a block labeled sh it is obvious that > a shell conforming to the POSIX sh standard is expected, and it's not so > different from a file with "#!/bin/sh". Users who expect bash in a > block labeled sh are wrong, although I agree that many people have been > misled this way by the culture of using "test ==" in a file that starts > #!/bin/sh. > > The real issue is that org files that actually expect bash (test ==, > etc.) become nonportable to other environments. If someone is writing > a script and not intending to use beyond-posix features, it's harmful to > let them work (in cases where they are published). > Points well made, I was not aware of the BSD default. Although purely semantically, in my opinion the "sh" in "#+begin_src sh" indicates generic "shell-script", not the POSIX sh. E.g., there is no ob-bash.el or ob-csh.el. See the first line in ob-sh.el, ,---- | ;;; ob-sh.el --- org-babel functions for shell evaluation `---- > >> E.g., the default value of `shell-file-name' used by M-x shell is >> "/bin/bash". > > I just checked on my system (NetBSD 6 i386, emacs 23.4.1), and > shell-file-name is documented to inherit from SHELL if present, which it > does. It's /bin/sh if SHELL is unset, which complies with the > documentation: > > *File name to load inferior shells from. > Initialized from the SHELL environment variable, or to a system-dependent > default if SHELL is not set. > > which doesn't promise bash (or even a Bourne-style shell!). (The emacs > package doesn't depend on the bash package.) But shell-file-name is > about giving the user of emacs their shell, not using a particular > programming language, so this fuzz is fine. > And this is where we disagree. Sh code blocks don't currently promise POSIX sh, they promise a shell. This is certainly a much more dangerous generalization than say Perl code blocks possibly using Perl 5 or 6. How about the following resolution? We rename ob-sh.el to ob-shell.el. New "shell" code blocks could use the value of the `org-babel-sh-command' environment variable. Then sh, bash, zsh, csh, ash, dash (am I missing any other common ones) use the specific shell specified. What do you think? In the mean time, I don't believe the change in default value for `org-babel-sh-command' has been included in any maintenance releases, so I've just reverted this to minimize any further confusion. > >> It is possible to explicitly set shell code blocks to use sh. > > Sure, but that wasn't my point; it's the encouragement of nonportability > that is problematic. > > I should point out that I'm not a bash hater --- I actually use it as my > interactive shell, and have done so since around 1990. But I don't > write scripts in it. > And I should say that I've argued the same point your making myself in the past (on a project making the much more serious error of using bash notation ">&" in a shell script starting with "#!/bin/sh"). I think we only disagree on the current meaning of "sh" in code blocks, which hopefully the suggestion above will rectify. Best, > > Greg -- Eric Schulte https://cs.unm.edu/~eschulte PGP: 0x614CA05D