Discussion:
exec problem
(too old to reply)
duzuike
2008-11-28 14:07:59 UTC
Permalink
Hi,

Here is my code:

tclsh8.5 [/usr~]exec uname
couldn't create error file for command: no such file or directory
while evaluating {exec uname}



But this works:

tclsh8.5 [/usr~]exec uname 2>&1
FreeBSD

I have read the tcl8.5 documents many times, the errror output
direction is not required. But without it , I always get the same
error.
Arjen Markus
2008-11-28 14:26:00 UTC
Permalink
Post by duzuike
Hi,
tclsh8.5 [/usr~]exec uname
couldn't create error file for command: no such file or directory
while evaluating {exec uname}
tclsh8.5 [/usr~]exec uname 2>&1
FreeBSD
I have read the tcl8.5 documents many times, the errror output
direction is not required. But without it , I always get the same
error.
Odd, does this happen for all commands?

Could it be that in your .tclshrc file the exec command is
redefined?

Regards,

Arjen
duzuike
2008-11-28 14:38:51 UTC
Permalink
Post by Arjen Markus
Post by duzuike
Hi,
tclsh8.5 [/usr~]exec uname
couldn't create error file for command: no such file or directory
while evaluating {exec uname}
tclsh8.5 [/usr~]exec uname 2>&1
FreeBSD
I have read the tcl8.5 documents many times, the errror output
direction is not required. But without it , I always get the same
error.
Odd, does this happen for all commands?
Could it be that in your .tclshrc file the exec command is
redefined?
Regards,
Arjen- Hide quoted text -
- Show quoted text -
Yes, this happen for all commands.
Andreas Leitgeb
2008-11-28 14:34:58 UTC
Permalink
Post by duzuike
tclsh8.5 [/usr~]exec uname
couldn't create error file for command: no such file or directory
while evaluating {exec uname}
tclsh8.5 [/usr~]exec uname 2>&1
FreeBSD
For stderr, exec creates a tempfile into which all the (putative)
stderr-output goes, and which is read back afterwards.

Now, no matter if the program actually produces stderr output or
not (as in your case), it still needs that tempfile "just in case".

Either your /tmp directory is not writable, or you've got some
environment variable set to a bad directory that tclsh uses.

try:
echo exec uname | strace -o log tclsh
and examine the log file for failed attempts to open a file.
(probably near the end of the log)
On *BSD, the "strace" may actually be called "truss" instead.
duzuike
2008-11-28 14:45:24 UTC
Permalink
Post by Andreas Leitgeb
Post by duzuike
tclsh8.5 [/usr~]exec uname
couldn't create error file for command: no such file or directory
while evaluating {exec uname}
tclsh8.5 [/usr~]exec uname 2>&1
FreeBSD
For stderr, exec creates a tempfile into which all the (putative)
stderr-output goes, and which is read back afterwards.
Now, no matter if the program actually produces stderr output or
not (as in your case), it still needs that tempfile "just in case".
Either your /tmp directory is not writable, or you've got some
environment variable set to a bad directory that tclsh uses.
   echo exec uname | strace -o log tclsh
and examine the log file for failed attempts to open a file.
(probably near the end of the log)
On *BSD, the "strace" may actually be called "truss" instead.
tclsh8.5 [/usr~/zz]echo exec uname | truss -o log tclsh
truss: cannot open /proc/8981/mem: No such file or directory
child process exited abnormally
while evaluating {echo exec uname | truss -o log tclsh}
truss: cannot open /proc/curproc/mem: No such file or directory

~/ls log
-rw-r--r-- 1 wwg wwg 0 Nov 28 22:41 log

My .tclsh just load tclreadline, so it should not be a problem.


I have tried run tclsh8.5 as root, but it dosn't help.
Arjen Markus
2008-11-28 15:01:45 UTC
Permalink
Post by duzuike
Post by Andreas Leitgeb
Post by duzuike
tclsh8.5 [/usr~]exec uname
couldn't create error file for command: no such file or directory
while evaluating {exec uname}
tclsh8.5 [/usr~]exec uname 2>&1
FreeBSD
For stderr, exec creates a tempfile into which all the (putative)
stderr-output goes, and which is read back afterwards.
Now, no matter if the program actually produces stderr output or
not (as in your case), it still needs that tempfile "just in case".
Either your /tmp directory is not writable, or you've got some
environment variable set to a bad directory that tclsh uses.
   echo exec uname | strace -o log tclsh
and examine the log file for failed attempts to open a file.
(probably near the end of the log)
On *BSD, the "strace" may actually be called "truss" instead.
tclsh8.5 [/usr~/zz]echo exec uname | truss -o log tclsh
truss: cannot open /proc/8981/mem: No such file or directory
child process exited abnormally
while evaluating {echo exec uname | truss -o log tclsh}
truss: cannot open /proc/curproc/mem: No such file or directory
~/ls log
-rw-r--r--  1 wwg  wwg  0 Nov 28 22:41 log
My .tclsh just load tclreadline, so it should not be a problem.
I have tried run tclsh8.5 as root, but it dosn't help.- Tekst uit oorspronkelijk bericht niet weergeven -
- Tekst uit oorspronkelijk bericht weergeven -
Hm, does printing errorInfo give more information?

What is env(TMP)? Does it point to a writable directory?

Regards,

Arjen
Andreas Leitgeb
2008-11-28 15:04:32 UTC
Permalink
Post by duzuike
Post by Andreas Leitgeb
   echo exec uname | strace -o log tclsh
and examine the log file for failed attempts to open a file.
(probably near the end of the log)
On *BSD, the "strace" may actually be called "truss" instead.
tclsh8.5 [/usr~/zz]echo exec uname | truss -o log tclsh
truss: cannot open /proc/8981/mem: No such file or directory
Sorry, I cannot help you getting BSD's tools to work properly.
Try to solve the issue with truss first, so you can trace the
system calls of another process, and once that works, you'll
have a non-empty log file, and that will help getting tclsh's
problem solved.
Post by duzuike
I have tried run tclsh8.5 as root, but it dosn't help.
Alternatively, you can examine the following:
ls -ld /tmp /var/tmp #(don't forget the "d" option for ls)
env | grep ^T #(a separate ^ and T; not control-t)
duzuike
2008-11-28 15:13:12 UTC
Permalink
Post by Andreas Leitgeb
Post by duzuike
Post by Andreas Leitgeb
   echo exec uname | strace -o log tclsh
and examine the log file for failed attempts to open a file.
(probably near the end of the log)
On *BSD, the "strace" may actually be called "truss" instead.
tclsh8.5 [/usr~/zz]echo exec uname | truss -o log tclsh
truss: cannot open /proc/8981/mem: No such file or directory
Sorry, I cannot help you getting BSD's tools to work properly.
Try to solve the issue with truss first, so you can trace the
system calls of another process, and once that works, you'll
have a non-empty log file, and that will help getting tclsh's
problem solved.
Post by duzuike
I have tried run tclsh8.5 as root, but it dosn't help.
  ls -ld /tmp  /var/tmp    #(don't forget the "d" option for ls)
  env | grep ^T            #(a separate ^ and T;  not control-t)
ls -ld /tmp
drwxrwxrwt 7 root wheel 110592 Nov 28 23:00 /tmp

env | grep ^T
[***@epox /]$ env | grep ^T
TERM=xterm
TMP=/tmp

As I statemented before, I tried to run tclsh as root, but it dosn't
help.
Andreas Leitgeb
2008-11-28 15:53:42 UTC
Permalink
Post by Andreas Leitgeb
ls -ld /tmp
drwxrwxrwt 7 root wheel 110592 Nov 28 23:00 /tmp
env | grep ^T
TERM=xterm
TMP=/tmp
You left out /var/tmp Did that not exist?
If no, then create one (it's a standard location,
and might be hardcoded somewhere) and try the
"exec uname" in tclsh again.

Otherwise I fear you'll have to repair "truss" first,
so we see, where that temp-file is really tried to be
created.

That it doesn't work as root either, is not all that
surprising, because the error was something along
ENOENT, not EACCESS. That probably means, it tries to
open e.g. /tmp/gigfdhj/newfile, which even for root
fails as long as there is no /tmp/gigfdhj directory.

Without truss, I don't know, how else we get to know the
attempted location. Perhaps with a debugger? In that
case reconfigure tcl with --enable-symbols option passed
to the configure script.
duzuike
2008-11-29 09:56:37 UTC
Permalink
Post by Andreas Leitgeb
ls -ld /tmp
drwxrwxrwt  7 root  wheel  110592 Nov 28 23:00 /tmp
env | grep ^T
TERM=xterm
TMP=/tmp
You left out  /var/tmp   Did that not exist?
If no, then create one (it's a standard location,
and might be hardcoded somewhere) and try the
"exec uname" in tclsh again.
Otherwise I fear you'll have to repair "truss" first,
so we see, where that temp-file is really tried to be
created.
That it doesn't work as root either, is not all that
surprising, because the error was something along
ENOENT, not EACCESS.   That probably means, it tries to
open e.g.  /tmp/gigfdhj/newfile, which even for root
fails as long as there is no /tmp/gigfdhj  directory.
Without truss, I don't know, how else we get to know the
attempted location.  Perhaps with a debugger?  In that
case reconfigure tcl with --enable-symbols option passed
to the configure script.
Hi,
I have made the directory /var/tmp today, it's ok now!

Several months ago, I moved /var/tmp to /tmp to free some spaces on
the disk partition, and let TMP points to /tmp.

Thank you very much.
Andreas Leitgeb
2008-11-29 20:00:08 UTC
Permalink
Post by duzuike
I have made the directory /var/tmp today, it's ok now!
Several months ago, I moved /var/tmp to /tmp to free some spaces on
the disk partition, and let TMP points to /tmp.
On BSD-like systems /tmp is usually a memory-filesystem,
whereas /var/tmp is usually on a disk-device. For certain
types of tempfiles you most likely *want* a disk-device
backed temp dir (though the problem at hand is not one of
those).

If you're sure not to ever want a temp dir on disk, then
you can of course symlink /var/tmp to /tmp, but I most
certainly don't recommend that.

Loading...