Bash seg faulting?

Andy Hall fixpertise-consulting@comcast.net
Fri Jun 2 15:52:00 GMT 2017


On 1 June Doug Henderson wrote:
> 
> On 1 June 2017 at 18:01, Andy Hall wrote:
> >
> > Here is a strange one.   I have two scripts, conv.sh and conv.bat that do the same thing: scan the current directory for
> > .doc files and convert them to .docx files.  Here are the two scripts.
> >
> > $ cat conv.sh
> > #!/bin/bash
> >
> 
> Try running "cat -e conv.sh" to see if you have dos line endings, e.g.
> CR LF, instead of unix line endings, e.g. LF only.
> 
> If you do, run "dos2unix conv.sh" or "d2u conv.sh" to fix the line
> ending problem. Check that your editor can create files with unix line
> endings, and preserves unix line endings.
> 
> HTH
> Doug
> 
First of all, the Wordconv.exe converts a .doc file to a .docx file, ostensible writing no output.   However, I find if I change the script to read:

#!/bin/bash

OFFICE_BIN="C:\Program Files (x86)\Microsoft Office\root\Office16"

for doc in *.doc; do
        echo "converting: $doc"
        "$OFFICE_BIN"/Wordconv.exe -oice -nme "$doc" "${doc}x" | od
done

and run, I don’t get the seg faults, but od is showing no output written as you might expect (as in od <dev/null).

$ conv.sh
converting: Post-Install.doc
0000000
converting: Post-InstallB.doc
0000000
converting: Post-InstallTest.doc
0000000

So something is strange about this particular .exe being executed from bash.  (Remember that the .bat version of conv.sh does not seg fault.

Sending the output of od to /dev/null silences the seg fault and spurious output; provoding a workaround.
 










--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple



More information about the Cygwin mailing list