I am seeing an odd problem on a customer's machine and am stumped as
to what is going on.
The software I support uses rename() to rotate a data log file for
processing. When this particular problem crops up the rotation fails
with error '2', which is defined:
--------------------
#define ENOENT 2 /* No such file or directory */
--------------------
This is the log file rotation code:
--------------------------
if (rename(mFileName.data(), toName.data())) {
ourErrLog::Log(ourErrLog::anError, otherLogRotateFailed,
errno);
++mRotateErrors;
return otherLogRotateFailed;
ourMessages.msg:otherLogRotateFailed Log rotation failed with error
%d
--------------------------
The man page for "rename()" says this for ENOENT:
ENOENT
The link named by old does not exist, or either old
or new points to an empty string.
Since both the 'old' and the 'new' file names show up in the error
message log, that seems to indicate the old and new arguments are not
empty, which begs the question: why does rename think the 'old' name
does not exist?
The customer is running (uname -a output):
--------------------------
SunOS <hostname> 5.8 Generic_108528-15 sun4u sparc SUNW,UltraAX-MP
--------------------------
Also, when this occurs I have been able to take the value of 'old'
filename and 'vi' it, saving the data off to another file name.
However, if I 'ls' the directory where 'old' resides just before I 'vi
old', 'old' does not show up in the list. So 'vi' sees 'old' but 'ls'
does not.
This customer is the only customer of many running this product and
code on Solaris who sees this error. The customer has a similar
machine running this product also (same software version, same OS,
down to the patch level) and that machine does not see this problem.
Is anyone aware of any bugs in Solaris that have to do with this?
Also, if you have any ideas about what may be going on, please say so.
thanks,
Phil