Bugs item #3559382, was opened at 2012-08-19 03:03 Message generated for change (Tracker Item Submitted) made by boxofrox You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=110706&aid=3559382&group_id=10706
Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: None Group: None Status: Open Resolution: None Priority: 5 Private: No Submitted By: boxofrox (boxofrox) Assigned to: Nobody/Anonymous (nobody) Summary: [Bug] sox does not respond to SIGINT over ssh Initial Comment: Summary: When running sox as a background job on a Mac OS system via a SSH connection, I try to stop sox with 'kill -SIGINT <pid>', and nothing happens. I expect sox to quit gracefully, instead it continues running/sleeping. ----------------------------------------------------- Background: The goal is to pipe audio from my landlord's Mac microphone through SSH to my Linux speakers. We're trying to set up a means for me to hear his ADT alarm while he's out of town when someone breaks in. I initiate the SSH connection from my Linux computer and pipe a remote sox command back to my system where I use sox to play the piped audio. It works great. The problem is, at first, using Ctrl-C locally killed my sox process, but left sox running on the Mac. So I decided to expand the remote bash command to read input from my Linux terminal until an EOF character was sent, then interrupt the remote sox process, but the remote sox process keeps running. ----------------------------------------------------- System Details: Mac OS X 11.4.0 x86_64 sox v14.4.0 Linux Gentoo Kernel 3.2.12 x86 sox v14.3.2 ----------------------------------------------------- Test Case to Reproduce: 1. Get a Mac. This will be the remote system. 2. Get another *nix system. This will be the local system. 3. Turn on Remote Access in System Properties -> Network -> Shares for the remote Mac. 4. On the local *nix, open two terminals 5. In the first terminal, run local # ssh -p 22 <username>@<remote ip> remote # { sox -q -t coreaudio "default" -p & echo -e "\npid = $! \n" 1>&2; } | sox -p - > /dev/null a. record the pid 6. In the second terminal, run local # ssh -p 22 <username>@<remote ip> remote # kill -SIGINT <pid> remote # ps -l <pid> 7. Observe that sox is still running/sleeping and did not quit. 8. In the second terminal, run remote # kill -SIGKILL <pid> 9. Observe the output in the first terminal. pid = 54290 sox FAIL formats: can't open input `-': premature EOF 10. Notice that sox did not quit gracefully. ----------------------------------------------------- Expected Behavior: 1. On a Linux system, open two terminals. 2. In the first terminal, run # { sox -q -t alsa hw:1,0 -p & echo -e "\npid = $!\n" 1>&2; } | sox -p - > /dev/null a. record the pid 3. In the second terminal, run # kill -SIGINT <pid> 4. Observe the output in the first terminal. pid = 20376 -: (sox) Encoding: Signed PCM Channels: 1 @ 32-bit Samplerate: 48000Hz Replaygain: off Duration: unknown In:0.00% 00:04:36.82 [00:00:00.00] Out:13.3M [ | ] Clip:0 Aborted. In:0.00% 00:04:36.65 [00:00:00.00] Out:13.3M [ | ] Clip:0 Done. 5. Notice that sox quit gracefully at both ends of the pipe. ----------------------------------------------------- SSH Scripts: These are the ssh scripts I described in the Background section. It's FYI. #!/bin/bash # version 0.1 # warning: this script does not terminate the remote sox process. REMOTE_USER= REMOTE_HOST= echo ":: Press Ctrl-C to stop." ssh $REMOTE_USER@$REMOTE_HOST -p 22 'sox -q -t coreaudio "default" -p' | sox -p -t alsa #!/bin/bash # version 0.2 # warning: this script does not terminate the remote sox process. switch to kill -KILL instead, but the local sox process will complain. REMOTE_USER= REMOTE_HOST= echo ":: Press Ctrl-D to stop." ssh $REMOTE_USER@$REMOTE_HOST -p 22 'sox -q -t coreaudio "default" -p & pid=$! ; while read >/dev/null ; do echo > /dev/null; done ; kill -INT $pid; echo -e "\nkill -INT $pid\n" 1>&2;' | sox -p -t alsa ----------------------------------------------------- Epilogue: I don't know if this is an issue with Mac OSX, it's Bash shell, it's kill utility, or with sox. Since I'm piping the audio directly to my speaker, the EOF complaint from sox does not hurt anyting. This issue may matter when piping the audio into a formatted audio file (like .mp3). If this issue cannot be resolved in sox, then this report will serve to document this behavior. ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=110706&aid=3559382&group_id=10706 ------------------------------------------------------------------------------ Live Security Virtual Conference Exclusive live event will cover all the ways today's security and threat landscape has changed and how IT managers can respond. Discussions will include endpoint security, mobile security and the latest in malware threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ _______________________________________________ SoX-devel mailing list SoX-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/sox-devel