Re: ftpd feature: lock file being stored

1999-11-07 Thread Jos Backus

On Sun, Nov 07, 1999 at 05:44:51PM +0900, Daniel C. Sobral wrote:
> Actually, use fstat to check against ftpd, and lockf between the
> scripts. :-)

Good idea :) I think that I'll do just that.

Cheers,
-- 
Jos Backus _/  _/_/_/"Modularity is not a hack."
  _/  _/   _/-- D. J. Bernstein
 _/  _/_/_/ 
_/  _/  _/_/
[EMAIL PROTECTED] _/_/   _/_/_/use Std::Disclaimer;


To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-hackers" in the body of the message



Re: ftpd feature: lock file being stored

1999-11-07 Thread Daniel C. Sobral

Jos Backus wrote:
> 
> Scanning the directory for new files, as the aforementioned script does. If
> you have more than one script doing this at the same time, both may conclude
> that a given file is ``available'' and try to act upon it. Inevitably, one of
> those scripts will fail. Hence my solution. But maybe I don't quite understand
> the problem :-)
> 
> (Yes, I know you will say, "Don't run more than one script at a time then.".
> But whether this is possible really depends on the application and moreover
> seems to be an unecessary restriction.)

Actually, use fstat to check against ftpd, and lockf between the
scripts. :-)

--
Daniel C. Sobral(8-DCS)
[EMAIL PROTECTED]
[EMAIL PROTECTED]

What y'all wanna do?
Wanna be hackers? Code crackers? Slackers
Wastin' time with all the chatroom yakkers?


To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-hackers" in the body of the message



Re: ftpd feature: lock file being stored

1999-01-03 Thread Sheldon Hearn



On Fri, 05 Nov 1999 12:09:18 +0100, Jos Backus wrote:

> I'm in the anti-bloat camp, and I agree with this sentiment.

What would be more interesting, I think, is investigating the use of
locking by default.  One wonders what it'd break, and how we'd work
around it. ;-)

Ciao,
Sheldon.


To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-hackers" in the body of the message



Re: ftpd feature: lock file being stored

1999-01-03 Thread Jos Backus

On Fri, Nov 05, 1999 at 12:58:42PM +0200, Sheldon Hearn wrote:
> Then it's your _script_ that should do careful locking to avoid tripping
> up over itself, surely? :-)

Yeah, in fact it does, it uses lockf ;-p
 
> Let me take a step back.  I'm not saying that what you're doing to ftpd
> is wrong.  I'm saying that it's probably not worthwhile adding this
> feature to the stock ftpd when it's such a quirky work-around.

Hm, I wouldn't call it quirky. It would be nice to hear what others think
though. I've already received one positive private reply.

> I have several local hacks to ftpd which I think are very useful, but I
> don't think they should be added to FreeBSD's ftpd because they're not
> general solutions to wide-spread problems.

I'm in the anti-bloat camp, and I agree with this sentiment.

Cheers,
-- 
Jos Backus  _/ _/_/_/  "Reliability means never
   _/ _/   _/   having to say you're sorry."
  _/ _/_/_/ -- D. J. Bernstein
 _/  _/ _/_/
[EMAIL PROTECTED]  _/_/  _/_/_/  use Std::Disclaimer;


To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-hackers" in the body of the message



Re: ftpd feature: lock file being stored

1999-01-03 Thread Sheldon Hearn



On Fri, 05 Nov 1999 11:39:29 +0100, Jos Backus wrote:

> Scanning the directory for new files, as the aforementioned script does. If
> you have more than one script doing this at the same time, both may conclude
> that a given file is ``available'' and try to act upon it.

Then it's your _script_ that should do careful locking to avoid tripping
up over itself, surely? :-)

> Inevitably, one of those scripts will fail. Hence my solution. But
> maybe I don't quite understand the problem :-)

Let me take a step back.  I'm not saying that what you're doing to ftpd
is wrong.  I'm saying that it's probably not worthwhile adding this
feature to the stock ftpd when it's such a quirky work-around.

I have several local hacks to ftpd which I think are very useful, but I
don't think they should be added to FreeBSD's ftpd because they're not
general solutions to wide-spread problems.

Ciao,
Sheldon.


To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-hackers" in the body of the message



Re: ftpd feature: lock file being stored

1999-01-03 Thread Jos Backus

On Fri, Nov 05, 1999 at 12:18:21PM +0200, Sheldon Hearn wrote:
> Then use fstat. :-)

OK, OK :)

> I think you've developed a complex solution to a more simply solved
> problem.  UNIX offers you lots of little tools for good reason.  Adding
> functionality to ftpd that is available through other tools doesn't seem
> wise to me.

I'm not yet convinced that your solution does what I want in a reliable
fashion.

> What does "polling the directory" mean?

Scanning the directory for new files, as the aforementioned script does. If
you have more than one script doing this at the same time, both may conclude
that a given file is ``available'' and try to act upon it. Inevitably, one of
those scripts will fail. Hence my solution. But maybe I don't quite understand
the problem :-)

(Yes, I know you will say, "Don't run more than one script at a time then.".
But whether this is possible really depends on the application and moreover
seems to be an unecessary restriction.)

Cheers,
-- 
Jos Backus  _/ _/_/_/  "Reliability means never
   _/ _/   _/   having to say you're sorry."
  _/ _/_/_/ -- D. J. Bernstein
 _/  _/ _/_/
[EMAIL PROTECTED]  _/_/  _/_/_/  use Std::Disclaimer;


To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-hackers" in the body of the message



Re: ftpd feature: lock file being stored

1999-01-03 Thread Sheldon Hearn



On Fri, 05 Nov 1999 11:15:18 +0100, Jos Backus wrote:

> > So fstat(1) doesn't show you that the file is opened to ftpd?
> 
> No, it does indeed show that.

Then use fstat. :-)

> It seems a more natural solution to me than grepping for ftpd in fstat's
> output regarding the file.

I think you've developed a complex solution to a more simply solved
problem.  UNIX offers you lots of little tools for good reason.  Adding
functionality to ftpd that is available through other tools doesn't seem
wise to me.

> Also, I think that approach introduces races when
> you have more than one program/script polling the directory.

What does "polling the directory" mean?  Fstat(1) is interested only in
those programs which have open file descriptors on the file you're
interested in.  Sounds like the perfect tool for the job. :-)

Ciao,
Sheldon.


To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-hackers" in the body of the message



Re: ftpd feature: lock file being stored

1999-01-03 Thread Jos Backus

> So fstat(1) doesn't show you that the file is opened to ftpd?

No, it does indeed show that.

> You really have to lock the files to help you with this problem?

It seems a more natural solution to me than grepping for ftpd in fstat's
output regarding the file. Also, I think that approach introduces races when
you have more than one program/script polling the directory.

-- 
Jos Backus  _/ _/_/_/  "Reliability means never
   _/ _/   _/   having to say you're sorry."
  _/ _/_/_/ -- D. J. Bernstein
 _/  _/ _/_/
[EMAIL PROTECTED]  _/_/  _/_/_/  use Std::Disclaimer;


To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-hackers" in the body of the message



Re: ftpd feature: lock file being stored

1999-01-03 Thread Sheldon Hearn



On Thu, 04 Nov 1999 23:05:30 +0100, Jos Backus wrote:

> This patch adds a ``-x'' flag to ftpd, which instructs ftpd to obtain
> an exclusive lock on files it commits to disk as a result of a store
> operation.  This way it becomes easy to tell whether a download has
> finished, in case the file needs to be copied someplace else (as in my
> case).

So fstat(1) doesn't show you that the file is opened to ftpd? You really
have to lock the files to help you with this problem?

Ciao,
Sheldon.


To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-hackers" in the body of the message