delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2002/09/14/19:55:48

Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sources.redhat.com/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sources.redhat.com/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com
X-Authentication-Warning: slinky.cs.nyu.edu: pechtcha owned process doing -bs
Date: Sat, 14 Sep 2002 19:55:36 -0400 (EDT)
From: Igor Pechtchanski <pechtcha AT cs DOT nyu DOT edu>
Reply-To: cygwin AT cygwin DOT com
To: cygwin AT cygwin DOT com
Subject: Re: Crontab problems
In-Reply-To: <20020914200118.GA1032@TOOS>
Message-ID: <Pine.GSO.4.44.0209141950270.21486-100000@slinky.cs.nyu.edu>
MIME-Version: 1.0

On Sat, 14 Sep 2002, Raphael wrote:

> On Sat, Sep 14, 2002 at 01:00:20PM -0400, Igor Pechtchanski wrote:
> > On Thu, 12 Sep 2002, Raphael wrote:
> >
> > > On Wed, Sep 11, 2002 at 05:53:24PM -0400, Igor Pechtchanski wrote:
> > > > On Wed, 11 Sep 2002, Nicholas Wourms wrote:
> > > >
> > > > > --- Raphael <raphael AT oninet DOT pt> wrote:
> > > > > > Hi guys/girls~,
> > > > > >
> > > > > > I'm having a bit of a problem with my windows based editor. Using
> > > > > > it with
> > > > > > Pine or Mutt is not problem. Using it with Crontab -e gives a
> > > > > > sharing
> > > > > > violation error when I want to save the new file.
> > > > > >
> > > > > > Is this a crontab problem?
> > > > >
> > > > > Use vi.exe
> > > >
> > > > Most windows editors adopt a remove-and-recreate (or rename-and-recreate)
> > > > policy.  This basically means that they will try to remove or rename the
> > > > crontab-created file (which will fail, silently), and then create that
> > > > file over (which will fail since crontab has it open).  This is where your
> > > > sharing violation comes from.
> > >
> > > Ok, I can understand that explenation.
> > >
> > > > I've verified this with notepad and
> > > > editpad, but I'm sure most of the others will behave similarly.  Thus,
> > > > looks like using a cygwin-based editor is your only option, unless you can
> > > > find a windows one that writes the files in-place.  If this creates one
> > > > more convert for the vi camp, all the better. ;-)
> > >
> > > Don't think so, why should Cron not be able to act like Pine or Mutt. I
> > > guess the latter start opening the file in shared mode?
> >
> > I don't know about mutt, but pine, IIRC, does not keep the file open while
> > it's being edited by an external editor.  It re-opens the file afterwards,
> > which is why it doesn't care whether it's the same file, or a newly
> > created one.
>
> Hi Igor,
> But do you have any idea why Cron shouldn't be able to act the same?

Quoting straight from the crontab-3.0.1-7 source (crontab.c:418):

        /* we still have the file open.  editors will generally rewrite the
         * original file rather than renaming/unlinking it and starting a
         * new one; even backup files are supposed to be made by copying
         * rather than by renaming.  if some editor does not support this,
         * then don't use it.  the security problems are more severe if we
         * close and reopen the file around the edit.
         */

Hope this answers your question.  By the way, the patch to close the file
and re-open it is trivial, and is left as an exercise for the reader.

Boy, I get to quote the source a lot these days...  Not that I'm
complaining or anything... :-D
	Igor
-- 
				http://cs.nyu.edu/~pechtcha/
      |\      _,,,---,,_		pechtcha AT cs DOT nyu DOT edu
ZZZzz /,`.-'`'    -.  ;-;;,_		igor AT watson DOT ibm DOT com
     |,4-  ) )-,_. ,\ (  `'-'		Igor Pechtchanski
    '---''(_/--'  `-'\_) fL	a.k.a JaguaR-R-R-r-r-r-.-.-.  Meow!

It took the computational power of three Commodore 64s to fly to the moon.
It takes a 486 to run Windows 95.  Something is wrong here. -- SC sig file


--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Bug reporting:         http://cygwin.com/bugs.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019