Re: [PATCH] rsync on cygwin - textmode config files

2002-03-26 Thread Martin Pool

Thanks, this will be merged in 2.6.  Please let me know if anything
further is required.

-- 
Martin 

-- 
To unsubscribe or change options: http://lists.samba.org/mailman/listinfo/rsync
Before posting, read: http://www.tuxedo.org/~esr/faqs/smart-questions.html



Re: [PATCH] rsync on cygwin - textmode config files

2002-02-21 Thread Ville Herva

On Wed, Feb 20, 2002 at 11:17:24AM -0800, you [Martin Pool] wrote:

 OK, already fixed.  --no-fork would be good to add in the future -- it
 can be handy for debugging.

As said, I only added the --dont-fork==--no-detach  mostly because I use it
in my scripts. (The original --dont-fork did disable just the fork() call,
not the whole become_daemon() call, so it was slightly different from
--no-detach.)
  
  O_TEXT and O_BINARY
 
 Good.
 
 It might be cleaner to #ifdef on O_BINARY or something that will also
 work on MSVC++.

O_TEXT and O_BINARY also work on MSVC (and propably on most other windows
compilers.)

So perhaps 

#if defined(_WIN32) || defined(__CYGWIN__)
#define TEXT O_TEXT
#define BINARY O_BINARY
#else
#define TEXT 0
#define BINARY 0
#endif

and

   fd = open(fname, O_RDONLY | TEXT)

(not sure what to call those -- TEXT/BINARY might collide with
something?)

Or is 

#if !defined(O_TEXT)
#define O_TEXT 0
#endif
#if !defined(O_BINARY)
#define O_BINARY 0
#endif

better?
 
 Can't you say rt as an fopen mode?  That works on all C platforms
 that I know, and avoids the ifdef.

I'm not sure what I was thinking back then :) (This dates back to few years
ago). Perhaps I tried rt, but it didn't work or something. Or perhaps it
was just my thinko. It should work now with cygwin, you're right.

  (3) avoid perm check on password file
 
 This seems good, though again perhaps ideally we would ifdef for the
 windows platform rather than cygwin.

Ok, how about 

#if defined(_WIN32) || defined(__CYGWIN__)

?


-- v --

[EMAIL PROTECTED]


To unsubscribe or change options: http://lists.samba.org/mailman/listinfo/rsync
Before posting, read: http://www.tuxedo.org/~esr/faqs/smart-questions.html



Re: [PATCH] rsync on cygwin - textmode config files

2002-02-20 Thread Ville Herva

On Wed, Feb 20, 2002 at 08:27:07AM +0200,  [Ville Herva] wrote:
 
(2) Secondly, if I connect to rsync daemon from another machine and hit
ctrl-c at the client end during transfer, the rsync daemon exists (not
just the connection handler process, but every rsync). I guess this is
because rsync gets sigpipe signal, which is handled by sig_int, which
in turn sends sigusr to the parent. I have no idea why this should be.
I changed sigpipe handler to SIG_IGN, and I now get the behaviour I
want: if there is a network error (such as premature socket closing)
the rysnc daemon won't die, and I can reconnect to it. I didn't do
this cleanly: the connection handler process should in fact exit
(perhaps after some clean up), but not the parent. This is not a
problem, however, since the parent will reap the connection handler
after a minute.
 
 This I'm not sure about. Does more recent cygwin handle this better? I'll
 try it without the patch and try to reproduce the bug I was seeing back
 then.

Ok, from 2.5.2 - 2.5.3pre1:

signal(SIGINT,SIGNAL_CAST sig_int);
-   signal(SIGPIPE,SIGNAL_CAST sig_int);
signal(SIGHUP,SIGNAL_CAST sig_int);
signal(SIGTERM,SIGNAL_CAST sig_int);
 
+   /* Ignore SIGPIPE; we consistently check error codes and will
+* see the EPIPE. */
+   signal(SIGPIPE, SIG_IGN);

So mainline does the same thing nowadays (the consistently check error
codes and will see the EPIPE was something I propably didn't do, anyway).


-- v --

[EMAIL PROTECTED]




Re: [PATCH] rsync on cygwin - textmode config files

2002-02-20 Thread Martin Pool

 (1) --no-detach

OK, already fixed.  --no-fork would be good to add in the future -- it
can be handy for debugging.

 (2) ctrl-c

Fixed recently by Colin Walters.

 O_TEXT and O_BINARY

Good.

It might be cleaner to #ifdef on O_BINARY or something that will also
work on MSVC++.

 +#ifdef __CYGWIN__
 +   {
 +   /* CYGWIN has no O_TEXT equivalent for
 +   fopen... */
 +   int fd = open( FileName, O_RDONLY | O_TEXT);
 +   OpenedFile = fdopen( fd, r );
 +   }
 +#else 
 +   OpenedFile = fopen( FileName, r );
 +#endif

Can't you say rt as an fopen mode?  That works on all C platforms
that I know, and avoids the ifdef.

 (3) avoid perm check on password file

This seems good, though again perhaps ideally we would ifdef for the
windows platform rather than cygwin.

Thanks very much,
-- 
Martin 


To unsubscribe or change options: http://lists.samba.org/mailman//listinfo/rsync
Before posting, read: http://www.tuxedo.org/~esr/faqs/smart-questions.html