[O] [BUG]C source block evaluation fails over pscp

2017-10-31 Thread Иван Трусков
I am working on Windows machine with org file with C source block. I want
to evaluate code block on remote machine accessible to me with PuTTY. Here
is relevant part of the org file:

#+PROPERTY: header-args :noweb yes :results verbatim :dir /pscp:tcl:/home/tc

Now, let us move to the green fields of user input.

#+NAME: echo_arguments
#+BEGIN_SRC C :main no
  #include 

  int main(int argc, const char* argv[])
  {
  printf("Has %d arguments\n", argc);
  for(int i = 0; i < argc; ++i)
  printf("Argument %d:\n%s\n", i, argv[i]);
  return 0;
  }

#+END_SRC

Evaluation of source block results in error with the following message:

Spawning child process: invalid argument

Full messages output is

executing C code block (echo_arguments)...
Continue...
Copying c:/Users/Ivan/AppData/Local/Temp/tramp.5760k9p.c to
/pscp:tcl:/tmp/C-src-5760Xzj.c...
Tramp: Waiting for prompts from remote shell...
Tramp: Process has finished.
Tramp: Waiting for prompts from remote shell...done
Copying c:/Users/Ivan/AppData/Local/Temp/tramp.5760k9p.c to
/pscp:tcl:/tmp/C-src-5760Xzj.c...done
Copying c:/Users/Ivan/AppData/Local/Temp/tramp.5760-R2.exe to
/pscp:tcl:/tmp/C-bin-5760xHw.exe...
Tramp: Waiting for prompts from remote shell...
Tramp: Process has finished.
Tramp: Waiting for prompts from remote shell...done
Copying c:/Users/Ivan/AppData/Local/Temp/tramp.5760-R2.exe to
/pscp:tcl:/tmp/C-bin-5760xHw.exe...done
Copying c:/Users/Ivan/AppData/Local/Temp/tramp.5760wbF.c to
/pscp:tcl:/tmp/C-src-5760Xzj.c...
Tramp: Waiting for prompts from remote shell...
Tramp: Process has finished.
Tramp: Waiting for prompts from remote shell...done
Copying c:/Users/Ivan/AppData/Local/Temp/tramp.5760wbF.c to
/pscp:tcl:/tmp/C-src-5760Xzj.c...done
Break
Copying c:/Users/Ivan/AppData/Local/Temp/tramp.5760KwR to
/pscp:tcl:/tmp/ob-input-57609lL...
Tramp: Waiting for prompts from remote shell...
Tramp: Process has finished.
Tramp: Waiting for prompts from remote shell...done
Copying c:/Users/Ivan/AppData/Local/Temp/tramp.5760KwR to
/pscp:tcl:/tmp/ob-input-57609lL...done
Copying c:/Users/Ivan/AppData/Local/Temp/tramp.5760kEe to
/pscp:tcl:/tmp/ob-error-5760X6X...
Tramp: Waiting for prompts from remote shell...
Tramp: Process has finished.
Tramp: Waiting for prompts from remote shell...done
Copying c:/Users/Ivan/AppData/Local/Temp/tramp.5760kEe to
/pscp:tcl:/tmp/ob-error-5760X6X...done
Copying c:/Users/Ivan/AppData/Local/Temp/tramp.5760xOk to
/pscp:tcl:/tmp/ob-input-57609lL...failed
edebug-signal: Spawning child process: invalid argument

Debugging shows that error occurs inside function org-babel-eval when call
to
 org-babel--shell-command-on-region is made at the line 105 of org-eval.el.
The line is:

(write-region start end input-file)

There are two things that seem strange:

1. Region is actually empty - input region for C file compilation is empty.
2. There is no problem in writing to remote machine. C source file is
written to location needed.
3. Command line is
"gcc -o \"/tmp/C-bin-5760L4M.exe\"  \"/tmp/C-src-5760xjA.c\" "
   If that command line is executed on remote machine, compilation succeeds

Was that error introduced in some recen org version?


[O] [PATCH] ob-C.el: Fix command to perform on remote host

2017-04-24 Thread Иван Трусков
* lisp/ob-C.el (org-babel-C-execute): Made sure name of compiled
program is converted to local representation before sending it to the
shell on remote host.

The problem was when one would try to evaluate C source code block in
the file on remote host. Compilation would go normally, then
evaluation will fail with error like "/bin/sh: unable to find file
prevents that.

TINYCHANGE
---
 lisp/ob-C.el | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lisp/ob-C.el b/lisp/ob-C.el
index 795bcb2..e54e174 100644
--- a/lisp/ob-C.el
+++ b/lisp/ob-C.el
@@ -161,7 +161,7 @@ or `org-babel-execute:C++' or `org-babel-execute:D'."
   (org-babel-eval
(pcase org-babel-c-variant
  ((or `c `cpp)
-  (concat tmp-bin-file cmdline))
+  (concat (org-babel-process-file-name tmp-bin-file) cmdline))
  (`d
   (format "%s %s %s %s"
   org-babel-D-compiler


[O] Logging evaluation of the source block

2017-03-29 Thread Иван Трусков
Is there a way to log actions that org undertakes in process of evaluation
of the code block?
Preferably in such a way that all commands executed will be visible.

Reason: i am suspecting org is not trying to evaluate source block on
remote machine, but i need data to substantiate that claim


[O] Evaluating C code block on remote host

2017-03-29 Thread Иван Трусков
I am working on windows machine. I have last org version (from february
2017).
I have a remote host accessible by putty, where i have created org file of
the following contents:

#+TITLE C language things

* Simple hello-world program

#+NAME hello world on C
#+BEGIN_SRC C :dir /pscp:tcl:/home/tc/development :main no
  #include 

  int main()
  {
  printf("Hello, world!");
  return 0;
  }
#+END_SRC

where tcl is name of saved putty configuration

When i evaluate codefragment, overall result is a failure (however, it is
not a crash, and toggling debug on yields no backtrace)
Here is what is output to *Message* buffer:

executing C code block...
Copying c:/Users/Ivan/AppData/Local/Temp/tramp.4816iL0.c to
/pscp:tcl:/tmp/C-src-4816VBu.c...
Tramp: Waiting for prompts from remote shell...
Tramp: Process has finished.
Tramp: Waiting for prompts from remote shell...done
Copying c:/Users/Ivan/AppData/Local/Temp/tramp.4816iL0.c to
/pscp:tcl:/tmp/C-src-4816VBu.c...done
Copying c:/Users/Ivan/AppData/Local/Temp/tramp.4816hfJ.exe to
/pscp:tcl:/tmp/C-bin-4816UVD.exe...
Tramp: Waiting for prompts from remote shell...
Tramp: Process has finished.
Tramp: Waiting for prompts from remote shell...done
Copying c:/Users/Ivan/AppData/Local/Temp/tramp.4816hfJ.exe to
/pscp:tcl:/tmp/C-bin-4816UVD.exe...done
Copying c:/Users/Ivan/AppData/Local/Temp/tramp.4816upP.c to
/pscp:tcl:/tmp/C-src-4816VBu.c...
Tramp: Waiting for prompts from remote shell...
Tramp: Process has finished.
Tramp: Waiting for prompts from remote shell...done
Copying c:/Users/Ivan/AppData/Local/Temp/tramp.4816upP.c to
/pscp:tcl:/tmp/C-src-4816VBu.c...done
Copying c:/Users/Ivan/AppData/Local/Temp/tramp.4816I-b to
/pscp:tcl:/tmp/ob-input-48167zV...
Tramp: Waiting for prompts from remote shell...
Tramp: Process has finished.
Tramp: Waiting for prompts from remote shell...done
Copying c:/Users/Ivan/AppData/Local/Temp/tramp.4816I-b to
/pscp:tcl:/tmp/ob-input-48167zV...done
Copying c:/Users/Ivan/AppData/Local/Temp/tramp.4816iSo to
/pscp:tcl:/tmp/ob-error-4816VIi...
Tramp: Waiting for prompts from remote shell...
Tramp: Process has finished.
Tramp: Waiting for prompts from remote shell...done
Copying c:/Users/Ivan/AppData/Local/Temp/tramp.4816iSo to
/pscp:tcl:/tmp/ob-error-4816VIi...done
Copying c:/Users/Ivan/AppData/Local/Temp/tramp.4816vcu to
/pscp:tcl:/tmp/ob-input-48167zV...failed
byte-code: Spawning child process: invalid argument

What is going on there? What does error in the end mean? Most importantly,
is code block being evaluated on remote host at all? Can output of
org-babel commands be turned on to get that information?