Re: file rename -force failing silently
- From: "neuronstorm@xxxxxxxxx" <neuronstorm@xxxxxxxxx>
- Date: Mon, 7 Jul 2008 22:18:58 -0700 (PDT)
On Jul 7, 6:52 pm, "tom.rmadilo" <tom.rmad...@xxxxxxxxx> wrote:
On Jul 7, 11:23 am, "neuronst...@xxxxxxxxx" <neuronst...@xxxxxxxxx>
wrote:
file rename -force somenewdata.file someexistingdata.file is
behaving in a way that surprises me.
(tcl8.6a0 - I haven't tried it on other versions)
I would have expected that if the rename fails for any reason - an
error should be raised.
I have a situation, where both files are in the same folder on a
network share (samba), and possibly someexistingdata.file is in use by
another process.
The rename command simply runs without error - and without performing
the rename.
Is this expected behaviour? Nothing in the man page led me to expect
this.
Surely 'file rename' should easily be able to detect that the rename
didn't occur, am I just supposed to check afterwards that
somenewdata.file no longer exists?
I'm guessing that a samba network share, and the files on it are not
regular files, directories or symbolic links. What happens when you
don't use -force? Nothing can really be guaranteed with respect to
file operations on network shares, this would require something like a
database transaction (it is actually the same for local files with a
power loss).- Hide quoted text -
- Show quoted text -
The files are just text files - being accessed from a windows machine.
That the operation might fail doesn't particularly concern me.
That it doesn't raise an error is the problem.
(If I don't use force, the rename quite rightly produces an error
because the destination file already exists.)
I can adjust my code to check whether the rename succeeded - but my
question is whether this is the expected idiom?
In the past I've been wrapping calls to the various 'file' subcommands
in a catch, and taking action on the error.
The silent rename failure makes me wonder if that way of coding is
actually invalid - but it would be incredibly unwieldy to test the
result of every file operation after performing it..
Maybe the OS is reporting to Tcl that it all went smoothly..
but even if not Tcl's fault as such, it must be a bug in something for
rename not to notice it failed.. right?
Julian
.
- References:
- file rename -force failing silently
- From: neuronstorm@xxxxxxxxx
- Re: file rename -force failing silently
- From: tom.rmadilo
- file rename -force failing silently
- Prev by Date: Re: dealing with special characters
- Next by Date: query regarding open braces
- Previous by thread: Re: file rename -force failing silently
- Next by thread: Re: file rename -force failing silently
- Index(es):
Relevant Pages
|