* diff in `src' blocks
@ 2013-05-13 7:33 Oliver Večerník
2013-05-13 8:07 ` Oliver Večerník
2013-05-13 8:30 ` Achim Gratz
0 siblings, 2 replies; 9+ messages in thread
From: Oliver Večerník @ 2013-05-13 7:33 UTC (permalink / raw)
To: emacs-orgmode
Hi,
in the following org file the second block gets not exported (tested with
text and html exporter, release_8.0.2-119-g646f1a):
--8<---------------cut here---------------start------------->8---
#+OPTIONS: toc:nil author:nil
#+BEGIN_SRC sh :exports results :results output
cat testdiff.txt.orig
#+END_SRC
#+BEGIN_SRC sh :exports results :results output
diff testdiff.txt.orig testdiff.txt
#+END_SRC
#+BEGIN_SRC sh :exports results :results output
diff testdiff.txt.orig testdiff.txt | cat
#+END_SRC
#+BEGIN_SRC sh :exports results :results output
ls testdiff.*
#+END_SRC
--8<---------------cut here---------------end--------------->8---
__________
TESTDIFF
__________
,----
| asdf
| ghjk
`----
,----
| 1c1
| < asdf
| ---
| > qwer
`----
,----
| testdiff.html
| testdiff.org
| testdiff.txt
| testdiff.txt.orig
`----
Why is the `diff' command alone not exported while the piped `diff' via
`cat' works? Is this this a bug?
--
Regards,
Oliver
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: diff in `src' blocks
2013-05-13 7:33 diff in `src' blocks Oliver Večerník
@ 2013-05-13 8:07 ` Oliver Večerník
2013-05-13 8:32 ` Achim Gratz
2013-05-13 8:30 ` Achim Gratz
1 sibling, 1 reply; 9+ messages in thread
From: Oliver Večerník @ 2013-05-13 8:07 UTC (permalink / raw)
To: emacs-orgmode
> Why is the `diff' command alone not exported while the piped `diff' via
> `cat' works? Is this this a bug?
Figured out myself, sorry for the noise. It has to do with the exit
status of the `diff', which is 1 if the files are different. So I use
the pipe through `cat'.
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: diff in `src' blocks
2013-05-13 7:33 diff in `src' blocks Oliver Večerník
2013-05-13 8:07 ` Oliver Večerník
@ 2013-05-13 8:30 ` Achim Gratz
2013-05-13 17:59 ` Achim Gratz
1 sibling, 1 reply; 9+ messages in thread
From: Achim Gratz @ 2013-05-13 8:30 UTC (permalink / raw)
To: emacs-orgmode
Oliver Večerník <ov <at> vecernik.at> writes:
> Why is the `diff' command alone not exported while the piped `diff' via
> `cat' works?
The exit code is not zero since diff found differences, so Babel assumes the
script produced an error. Try this instead when you don't know what the
return code of the last command will be or if you know that it isn't zero
even when no error occured:
#+BEGIN_SRC sh :exports results :results output
diff testdiff.txt.orig testdiff.txt
:
#+END_SRC
> Is this this a bug?
I don't think so, although Babel could give a more enlightening message
about why it didn't evaluate STDOUT. It gives this on your original example:
Babel evaluation exited with code 1
Code block produced no output.
Regards,
Achim.
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: diff in `src' blocks
2013-05-13 8:07 ` Oliver Večerník
@ 2013-05-13 8:32 ` Achim Gratz
2013-05-13 9:29 ` Oliver Večerník
0 siblings, 1 reply; 9+ messages in thread
From: Achim Gratz @ 2013-05-13 8:32 UTC (permalink / raw)
To: emacs-orgmode
Oliver Večerník <ov <at> vecernik.at> writes:
> Figured out myself, sorry for the noise. It has to do with the exit
> status of the `diff', which is 1 if the files are different. So I use
> the pipe through `cat'.
Useless use of cat...
Regards,
Achim
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: diff in `src' blocks
2013-05-13 8:32 ` Achim Gratz
@ 2013-05-13 9:29 ` Oliver Večerník
0 siblings, 0 replies; 9+ messages in thread
From: Oliver Večerník @ 2013-05-13 9:29 UTC (permalink / raw)
To: emacs-orgmode
>> Figured out myself, sorry for the noise. It has to do with the exit
>> status of the `diff', which is 1 if the files are different. So I use
>> the pipe through `cat'.
>
> Useless use of cat...
At least the return status is zero. But I agree with you, a colon is
better here. This is my first use of a `:' btw. I never had case
before.
--
Thanks,
Oliver
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: diff in `src' blocks
2013-05-13 8:30 ` Achim Gratz
@ 2013-05-13 17:59 ` Achim Gratz
2013-05-13 19:23 ` Samuel Wales
2013-05-14 9:07 ` Michael Brand
0 siblings, 2 replies; 9+ messages in thread
From: Achim Gratz @ 2013-05-13 17:59 UTC (permalink / raw)
To: emacs-orgmode
Achim Gratz writes:
>> Is this this a bug?
>
> I don't think so, although Babel could give a more enlightening message
> about why it didn't evaluate STDOUT. It gives this on your original example:
>
> Babel evaluation exited with code 1
> Code block produced no output.
All things considered, there may be room for an argument that Babel
shouldn't ignore the data from STDOUT on non-zero exit or have an option
to ignore the return code for cases like this.
Regards,
Achim.
--
+<[Q+ Matrix-12 WAVE#46+305 Neuron microQkb Andromeda XTk Blofeld]>+
SD adaptations for Waldorf Q V3.00R3 and Q+ V3.54R2:
http://Synth.Stromeko.net/Downloads.html#WaldorfSDada
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: diff in `src' blocks
2013-05-13 17:59 ` Achim Gratz
@ 2013-05-13 19:23 ` Samuel Wales
2013-05-14 9:07 ` Michael Brand
1 sibling, 0 replies; 9+ messages in thread
From: Samuel Wales @ 2013-05-13 19:23 UTC (permalink / raw)
To: Achim Gratz; +Cc: emacs-orgmode
On 5/13/13, Achim Gratz <Stromeko@nexgo.de> wrote:
> All things considered, there may be room for an argument that Babel
> shouldn't ignore the data from STDOUT on non-zero exit or have an option
> to ignore the return code for cases like this.
That sounds good for newcomers.
Samuel
--
The Kafka Pandemic: http://thekafkapandemic.blogspot.com
The disease DOES progress. MANY people have died from it. ANYBODY can get it.
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: diff in `src' blocks
2013-05-13 17:59 ` Achim Gratz
2013-05-13 19:23 ` Samuel Wales
@ 2013-05-14 9:07 ` Michael Brand
2013-05-14 9:12 ` Michael Brand
1 sibling, 1 reply; 9+ messages in thread
From: Michael Brand @ 2013-05-14 9:07 UTC (permalink / raw)
To: Org Mode
Hi all
On Mon, May 13, 2013 at 7:59 PM, Achim Gratz <Stromeko@nexgo.de> wrote:
> All things considered, there may be room for an argument that Babel
> shouldn't ignore the data from STDOUT on non-zero exit [...]
Yes please, and a report of the actual exit status in the babel result
would be nice, probably as an option in the source block header. In
addition babel should also not ignore stderr on exit status 0, see my
example 2) with GNU/Linux's strace in a lengthy post about my thoughts
and workarounds for stdout, stderr and exit status with babel. It
contains a complete set of the different cases as I see them:
http://thread.gmane.org/gmane.emacs.orgmode/45828/focus=45881
Michael
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: diff in `src' blocks
2013-05-14 9:07 ` Michael Brand
@ 2013-05-14 9:12 ` Michael Brand
0 siblings, 0 replies; 9+ messages in thread
From: Michael Brand @ 2013-05-14 9:12 UTC (permalink / raw)
To: Org Mode
> http://thread.gmane.org/gmane.emacs.orgmode/45828/focus=45881
Sorry, the above was with the wrong message focus. Corrected:
http://thread.gmane.org/gmane.emacs.orgmode/45828/focus=46415
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2013-05-14 9:13 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-05-13 7:33 diff in `src' blocks Oliver Večerník
2013-05-13 8:07 ` Oliver Večerník
2013-05-13 8:32 ` Achim Gratz
2013-05-13 9:29 ` Oliver Večerník
2013-05-13 8:30 ` Achim Gratz
2013-05-13 17:59 ` Achim Gratz
2013-05-13 19:23 ` Samuel Wales
2013-05-14 9:07 ` Michael Brand
2013-05-14 9:12 ` Michael Brand
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).