|
|
 |
 |
 |
 |
TCL(Tool Command Language) Scripting
|
 |
 |
 |
 |
 |
 |
 |
 |
Problems with exec of mkisofs
I am trying to generate a Joliet and Rockridge ISO image from a TCL script. Whenever I run the script, it aborts. The ultimate reason, according to the ErrorInfo string is: "no such file or directory". I have beat my head against the wall with this one. All of the directory paths involved have been verified. Here is the code: #!/usr/bin/tclsh # tstmkiso.tcl #set TMPDIR /archive/bld/distro/tmp set TMPDIR ../tmp #set DIR /archive/bld/distro/archiving/rex/product/1.0.9 set DIR ../archiving/rex/product/1.0.9 set isofname keith.iso set cmdstr2 "/usr/bin/mkisofs -J -R -D -l -V KEITH -v -o $TMPDIR/ $isofname ." cd $DIR set rc [catch { exec $cmdstr2 } msg ] set errc $errorCode; set erri $errorInfo puts "rc: $rc" puts "errc: $errc" puts "erri: $erri" puts "msg: $msg" Here are the results of the execution: {runt:keith 420 } tstmkiso.tcl rc: 1 errc: POSIX ENOENT {no such file or directory} erri: couldn't execute "/usr/bin/mkisofs -J -R -D -l -V KEITH -v -o ../ tmp/keith.iso .": no such file or directory while executing "exec $cmdstr2 " msg: couldn't execute "/usr/bin/mkisofs -J -R -D -l -V KEITH -v -o ../ tmp/keith.iso .": no such file or directory {runt:keith 421 } Most of the code may be familiar. I found the portion of the code that outputs what is the OS is returning as the error (in C, I think we call that perror). I have verified that all of the paths are valid. I even changed from absolute paths to relative paths to see if there was something wierd going on with the filesystem. I was hoping someone could point out something that perhaps I have left out. Thanks in advance, Keith
On May 23, 11:04 am, Keith.Pick@gmail.com wrote:
> I am trying to generate a Joliet and Rockridge ISO image from a TCL > script. Whenever I run the script, it aborts. The ultimate reason, > according to the ErrorInfo string is: "no such file or directory". I > have beat my head against the wall with this one. All of the > directory paths involved have been verified. > Here is the code: > #!/usr/bin/tclsh > # tstmkiso.tcl > #set TMPDIR /archive/bld/distro/tmp > set TMPDIR ../tmp > #set DIR /archive/bld/distro/archiving/rex/product/1.0.9 > set DIR ../archiving/rex/product/1.0.9 > set isofname keith.iso > set cmdstr2 "/usr/bin/mkisofs -J -R -D -l -V KEITH -v -o $TMPDIR/ > $isofname ." > cd $DIR > set rc [catch { exec $cmdstr2 } msg ] > set errc $errorCode; set erri $errorInfo > puts "rc: $rc" > puts "errc: $errc" > puts "erri: $erri" > puts "msg: $msg" > Here are the results of the execution: > {runt:keith 420 } > tstmkiso.tcl > rc: 1 > errc: POSIX ENOENT {no such file or directory} > erri: couldn't execute "/usr/bin/mkisofs -J -R -D -l -V KEITH -v -o ../ > tmp/keith.iso .": no such file or directory > while executing > "exec $cmdstr2 " > msg: couldn't execute "/usr/bin/mkisofs -J -R -D -l -V KEITH -v -o ../ > tmp/keith.iso .": no such file or directory > {runt:keith 421 } > Most of the code may be familiar. I found the portion of the code > that outputs what is the OS is returning as the error (in C, I think > we call that perror). I have verified that all of the paths are > valid. I even changed from absolute paths to relative paths to see if > there was something wierd going on with the filesystem. I was hoping > someone could point out something that perhaps I have left out. > Thanks in advance, > Keith
Once again, Cameron Laird has come to the rescue. The simple fix was to put in eval before the exec command: set rc [catch { eval exec $cmdstr2 } msg ] Thanks Cameron for a quick response. -Keith
On May 23, 11:04 am, Keith.Pick@gmail.com wrote:
> I am trying to generate a Joliet and Rockridge ISO image from a TCL > script. Whenever I run the script, it aborts. The ultimate reason, > according to the ErrorInfo string is: "no such file or directory". I > have beat my head against the wall with this one. All of the > directory paths involved have been verified. > Here is the code: > #!/usr/bin/tclsh > # tstmkiso.tcl > #set TMPDIR /archive/bld/distro/tmp > set TMPDIR ../tmp > #set DIR /archive/bld/distro/archiving/rex/product/1.0.9 > set DIR ../archiving/rex/product/1.0.9 > set isofname keith.iso > set cmdstr2 "/usr/bin/mkisofs -J -R -D -l -V KEITH -v -o $TMPDIR/ > $isofname ." > cd $DIR > set rc [catch { exec $cmdstr2 } msg ] > set errc $errorCode; set erri $errorInfo > puts "rc: $rc" > puts "errc: $errc" > puts "erri: $erri" > puts "msg: $msg" > Here are the results of the execution: > {runt:keith 420 } > tstmkiso.tcl > rc: 1 > errc: POSIX ENOENT {no such file or directory} > erri: couldn't execute "/usr/bin/mkisofs -J -R -D -l -V KEITH -v -o ../ > tmp/keith.iso .": no such file or directory > while executing > "exec $cmdstr2 " > msg: couldn't execute "/usr/bin/mkisofs -J -R -D -l -V KEITH -v -o ../ > tmp/keith.iso .": no such file or directory > {runt:keith 421 } > Most of the code may be familiar. I found the portion of the code > that outputs what is the OS is returning as the error (in C, I think > we call that perror). I have verified that all of the paths are > valid. I even changed from absolute paths to relative paths to see if > there was something wierd going on with the filesystem. I was hoping > someone could point out something that perhaps I have left out. > Thanks in advance, > Keith
Once again, Cameron Laird has come to the rescue. The simple fix was to put in eval before the exec command: set rc [catch { eval exec $cmdstr2 } msg ] Thanks Cameron for a quick response. -Keith
On May 23, 11:04 am, Keith.Pick@gmail.com wrote:
> I am trying to generate a Joliet and Rockridge ISO image from a TCL > script. Whenever I run the script, it aborts. The ultimate reason, > according to the ErrorInfo string is: "no such file or directory". I > have beat my head against the wall with this one. All of the > directory paths involved have been verified. > Here is the code: > #!/usr/bin/tclsh > # tstmkiso.tcl > #set TMPDIR /archive/bld/distro/tmp > set TMPDIR ../tmp > #set DIR /archive/bld/distro/archiving/rex/product/1.0.9 > set DIR ../archiving/rex/product/1.0.9 > set isofname keith.iso > set cmdstr2 "/usr/bin/mkisofs -J -R -D -l -V KEITH -v -o $TMPDIR/ > $isofname ." > cd $DIR > set rc [catch { exec $cmdstr2 } msg ] > set errc $errorCode; set erri $errorInfo > puts "rc: $rc" > puts "errc: $errc" > puts "erri: $erri" > puts "msg: $msg" > Here are the results of the execution: > {runt:keith 420 } > tstmkiso.tcl > rc: 1 > errc: POSIX ENOENT {no such file or directory} > erri: couldn't execute "/usr/bin/mkisofs -J -R -D -l -V KEITH -v -o ../ > tmp/keith.iso .": no such file or directory > while executing > "exec $cmdstr2 " > msg: couldn't execute "/usr/bin/mkisofs -J -R -D -l -V KEITH -v -o ../ > tmp/keith.iso .": no such file or directory > {runt:keith 421 } > Most of the code may be familiar. I found the portion of the code > that outputs what is the OS is returning as the error (in C, I think > we call that perror). I have verified that all of the paths are > valid. I even changed from absolute paths to relative paths to see if > there was something wierd going on with the filesystem. I was hoping > someone could point out something that perhaps I have left out. > Thanks in advance, > Keith
Once again, Cameron Laird has come to the rescue. The simple fix was to put in eval before the exec command: set rc [catch { eval exec $cmdstr2 } msg ] Thanks Cameron for a quick response. -Keith
In article <1179932689.401512.326@g4g2000hsf.googlegroups.com>,
<Keith.Pick @gmail.com> wrote: >I am trying to generate a Joliet and Rockridge ISO image from a TCL >script. Whenever I run the script, it aborts. The ultimate reason, >according to the ErrorInfo string is: "no such file or directory". I >have beat my head against the wall with this one. All of the >directory paths involved have been verified. >Here is the code: >#!/usr/bin/tclsh ># tstmkiso.tcl >#set TMPDIR /archive/bld/distro/tmp >set TMPDIR ../tmp >#set DIR /archive/bld/distro/archiving/rex/product/1.0.9 >set DIR ../archiving/rex/product/1.0.9 >set isofname keith.iso >set cmdstr2 "/usr/bin/mkisofs -J -R -D -l -V KEITH -v -o $TMPDIR/ >$isofname ." >cd $DIR >set rc [catch { exec $cmdstr2 } msg ]
. . . Does catch {eval exec $cmdstr2} msg give a result closer to what you are after?
Keith.Pick @gmail.com wrote: > I am trying to generate a Joliet and Rockridge ISO image from a TCL > script. Whenever I run the script, it aborts. The ultimate reason, > according to the ErrorInfo string is: "no such file or directory". I > have beat my head against the wall with this one. All of the > directory paths involved have been verified. > ... > erri: couldn't execute "/usr/bin/mkisofs -J -R -D -l -V KEITH -v -o ../ > tmp/keith.iso .": no such file or directory > while executing > "exec $cmdstr2 " > msg: couldn't execute "/usr/bin/mkisofs -J -R -D -l -V KEITH -v -o ../ > tmp/keith.iso .": no such file or directory > {runt:keith 421 } Read the error message much more closely, and take it literally (always good advice for Tcl errors!). It is telling you exactly what the problem is. It is telling you it can't find a file named "/usr/bin/mkisofs -J -R -D -l -V ...". Do you actually expect to have a file by that name? Note that it is *not* telling you it can't find "/usr/bin/mkisofs". Do you now see the problem? You are passing a whole command string to exec as one argument, but exec expects it's first argument (*not* the first word of the first argument) to be the name of a file to exec. -- Bryan Oakley http://www.tclscripting.com
On May 23, 12:27 pm, Bryan Oakley <oak@bardo.clearlight.com> wrote:
> Keith.Pick @gmail.com wrote: > > I am trying to generate a Joliet and Rockridge ISO image from a TCL > > script. Whenever I run the script, it aborts. The ultimate reason, > > according to the ErrorInfo string is: "no such file or directory". I > > have beat my head against the wall with this one. All of the > > directory paths involved have been verified. > > ... > > erri: couldn't execute "/usr/bin/mkisofs -J -R -D -l -V KEITH -v -o ../ > > tmp/keith.iso .": no such file or directory > > while executing > > "exec $cmdstr2 " > > msg: couldn't execute "/usr/bin/mkisofs -J -R -D -l -V KEITH -v -o ../ > > tmp/keith.iso .": no such file or directory > > {runt:keith 421 } > Read the error message much more closely, and take it literally (always > good advice for Tcl errors!). It is telling you exactly what the problem is. > It is telling you it can't find a file named "/usr/bin/mkisofs -J -R -D > -l -V ...". Do you actually expect to have a file by that name? > Note that it is *not* telling you it can't find "/usr/bin/mkisofs". > Do you now see the problem? You are passing a whole command string to > exec as one argument, but exec expects it's first argument (*not* the > first word of the first argument) to be the name of a file to exec. > -- > Bryan Oakleyhttp://www.tclscripting.com
Oh.. I do now. It's whatever is quoted. I had not realized that. Thanks. P.S. Sorry for the multiple post earlier. The google reader told me that there was an error making the post and to try again. So, I did. Again, and again.... :-)
In article <1179933762.643980.196@q69g2000hsb.googlegroups.com>, <Keith.Pick @gmail.com> wrote: . . . >> set cmdstr2 "/usr/bin/mkisofs -J -R -D -l -V KEITH -v -o $TMPDIR/ >> $isofname ." >> cd $DIR >> set rc [catch { exec $cmdstr2 } msg ]
. . . >Once again, Cameron Laird has come to the rescue. The simple fix was >to put in eval before the exec command: >set rc [catch { eval exec $cmdstr2 } msg ] >Thanks Cameron for a quick response. >-Keith
You're welcome. Others have provided detail on why this gives symptomatic relief. If 8.5 is available to you, there's a stylistic variation you might prefer ("catch {exec {*}$cmdstr2} msg"). In part of your private correspondence, you wrote something like, "it still reports something ..." that confuses you about whether there's been an error or not. There are more aspects to this than I choose to address now (just as there were with [exec] vs. [eval exec]); my summary is that quite a few Unix commands (especially newer Linux-oriented ones, in my experience) exhibit surprising behavior in what they code as "errors". Without getting into the details of mkisofs, it could well be doing everything you expect, but still reporting back to your Tcl process that there was a (non-existent) error. I didn't understand from what you've written whether you feel you have everything you need. If not, and if you want to pursue this it's-an-error-no-it-isn't symptom, please follow-up explicitly.
|
 |
 |
 |
 |
|