Re: file rename -force failing silently



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






.



Relevant Pages

  • Re: file rename -force failing silently
    ... I'm guessing that a samba network share, and the files on it are not ... file operations on network shares, this would require something like a ... file rename without -force raises an error due to the existing target ...
    (comp.lang.tcl)
  • Re: file rename -force failing silently
    ... | network share (samba), and possibly someexistingdata.file is in use ... | performing the rename. ... The source file still exists - strongly suggesting the ...
    (comp.lang.tcl)
  • SAMBA Authentication Problem
    ... University's Windows network. ... Samba has a huge number of configurable options (perhaps too ... # per user logon script ...
    (Fedora)
  • Re: Samba wont dance (more info)
    ... changes invoke another contest round for who gets to be the master, ... Watching a friend's all-XP network, over a number of years, has shown me ...  What method is used (hosts, DNS, lmhosts) in which order, ... # This is the main Samba configuration file. ...
    (Fedora)
  • [FC4]Samba doesnt accessible to Windows
    ... my samba share cannot be accessed by Windows computers in my network. ... # set local master to no if you don't want Samba to become a master ... # per user logon script ...
    (Fedora)