Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

Re^2: Best practices for modifying a file in place: q's about opening files, file locking, and using the rename function

by ikegami (Patriarch)
on Nov 03, 2006 at 04:34 UTC ( [id://582004]=note: print w/replies, xml ) Need Help??


in reply to Re: Best practices for modifying a file in place: q's about opening files, file locking, and using the rename function
in thread Best practices for modifying a file in place: q's about opening files, file locking, and using the rename function

If you write all the programs that write to the files, you can use locks, but take care, file locks is not a real restriction, you can ignore it if you want

Not necessarily. Some OSes (Windows, for example) have mandatory locks (as opposed to advisory locks).

  • Comment on Re^2: Best practices for modifying a file in place: q's about opening files, file locking, and using the rename function

Replies are listed 'Best First'.
Re^3: Best practices for modifying a file in place: q's about opening files, file locking, and using the rename function
by halley (Prior) on Nov 03, 2006 at 14:16 UTC

    Even the "mandatory" locks on Windows' aren't infallible when you get into network shared filesystems, especially SMB/Samba connections, because the whole modification stack isn't under one machine's control. You are right: they profess to be mandatory and cause you grief if you ignore them, but they cause you grief anyway when the remote system does unexpected things.

    --
    [ e d @ h a l l e y . c c ]

Re^3: Best practices for modifying a file in place: q's about opening files, file locking, and using the rename function
by fmerges (Chaplain) on Nov 03, 2006 at 13:58 UTC

    Hi,

    You're right, but I wasn't talking in general sense, 'cause the code snippet pasted was written in some UN*X... ;-)

    Regards,

    fmerges at irc.freenode.net

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://582004]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others rifling through the Monastery: (5)
As of 2024-04-16 20:20 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found