0

My program is coded in Python, and it calls a bash script in a vte window:

enter image description here

In 14.04 or 14.10 ubuntu system, no problem. (python 2.7.8)

But, in ubuntu 12.04, the window closes with this message: (python 2.7.3)

segmentation error

To debug, I've tried to use gdb with this line:

gdb -ex r --args python my_program.py

The output of gdb at the end is:

Program received signal SIGPIPE, Broken pipe.
0xb7fdd416 in __kernel_vsyscall ()

I know it's a problem with the bash script, but I don't know realy what is the problem. The line to call the bash script is:

self.child_pid = self.v.fork_command(None, ['/bin/bash', cli, '-f', '-d', dest, '-u', adresse, v])

It is possible to debug this for ubuntu 12.04 ? How can I do ?

Guillaume
  • 2,752
  • 5
  • 27
  • 42
  • What are the arguments to `fork_command`? Isn't the first argument the command and the second a list of the arguments? – Reut Sharabani Dec 16 '14 at 08:58
  • Thanks for your response - The error is the same when I use `self.child_pid = self.v.fork_command(cli, ['/bin/bash', '-f', '-d', dest, '-u', adresse, v])` – Guillaume Dec 16 '14 at 09:12
  • I don't know the library, just trying to help out. Do you have any calls to fork_command that **do** work? can you show them? – Reut Sharabani Dec 16 '14 at 09:35
  • The bug is aleatory: it can appear either at the beginning, either at the end of the bash script. The script is using ffmpeg, but I will try to use another script to see the result. – Guillaume Dec 16 '14 at 10:01
  • Ok, so I tried another script: just `echo 'foo'` and there's no bug. – Guillaume Dec 16 '14 at 10:22
  • What is in `cli`? what are you trying to run? – Reut Sharabani Dec 16 '14 at 10:23
  • It's a script to download a TV channel videos podcasts. It uses avconv or ffmpeg. There are 240 lines in this script, if you want to see the complete code I can send you a link (but you can't try it, there's country limitations if you're not in France) – Guillaume Dec 16 '14 at 10:26
  • Let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/66983/discussion-between-reut-sharabani-and-guillaume). – Reut Sharabani Dec 16 '14 at 10:30
  • 1
    Hi Reut, I think I have solved the problem with adding in the bash script `sleep 1` after the command ffmpeg. Now, I can dl a list of videos without problems :) – Guillaume Dec 17 '14 at 09:05

1 Answers1

0

I have found a solution with insering a sleep 1 in the bash script (cli), just after the ffmpeg command:

ffmpeg -y -i "${M3U2}" -vcodec copy -acodec copy "${Directory}/${PROG}_${ID}.mkv"
sleep 1
Guillaume
  • 2,752
  • 5
  • 27
  • 42