[Code study]should we remove if (motd && *motd) section?

2009-04-27 Thread Daniel.Li
Dear List,

I'm confused when we will run into "if (motd && *motd)"? 

As I have found that Globals is set 0 during initialization, and I
didn't find anywhere else assign the value.

If so, should we remove this section? 
Or there might be some where I missed? Please correct me, if I'm wrong.
Thanks in advance.

clientserver.c #line 147~160
>   if (!am_client) {
>   motd = lp_motd_file();
>   if (motd && *motd) {
>   FILE *f = fopen(motd,"r");
>   while (f && !feof(f)) {
>   int len = fread(buf, 1, bufsiz - 1, f);
>   if (len > 0)
>   write_buf(f_out, buf, len);
>   }
>   if (f)
>   fclose(f);
>   write_sbuf(f_out, "\n");
>   }
>   }


> static void init_globals(void)
> {
> memset(&Globals, 0, sizeof Globals);
> }
> 



-- 
Daniel

-- 
Please use reply-all for most replies to avoid omitting the mailing list.
To unsubscribe or change options: https://lists.samba.org/mailman/listinfo/rsync
Before posting, read: http://www.catb.org/~esr/faqs/smart-questions.html


"rsync: writefd_unbuffered failed to write 4 bytes" on mounted share

2009-04-27 Thread Stefan-Michael Guenther

Hello,

we are using rsync to backup data to a NAS share.

The share is mounted with the following command:

mount -t nfs 192.168.1.101:/nas/NASDisk-3/public /media/nas  -o 
timeo=5,rsize=8096,wsize=8096,soft


rsync is called by rsnapshot with the command:

rsync -a --stats --delete --numeric-ids --relative --delete-excluded 
/samba /media/nas



The process crashes when it tries to copy *.mdb files (15-600MB):

rsync: writefd_unbuffered failed to write 4 bytes [sender]: Broken pipe (32)
rsync: close failed on 
"/media/nas/daily.0/samba/Bereiche/Auslieferung/Software/NT2/2012/2012-69-RA-1L.0968 
(XY_I)/2006-11-16/XY_app.968/Logdb/.XYlog.mdb.REP380": Input/output 
error (5)

rsync error: error in file IO (code 11) at receiver.c(688) [receiver=3.0.3]
rsync: connection unexpectedly closed (65324 bytes received so far) [sender]
rsync error: error in rsync protocol data stream (code 12) at io.c(635) 
[sender=3.0.3]


The FAQ mentions this kind of error but only in combination with a 
rsyncd running on the remote site.


BTW: rsync is version 3.0.3

Thanks for any hints or suggestions,

Stefan

--
Please use reply-all for most replies to avoid omitting the mailing list.
To unsubscribe or change options: https://lists.samba.org/mailman/listinfo/rsync
Before posting, read: http://www.catb.org/~esr/faqs/smart-questions.html


Re: [Code study]should we remove if (motd && *motd) section?

2009-04-27 Thread Paul Slootman
On Mon 27 Apr 2009, Daniel.Li wrote:
> 
> I'm confused when we will run into "if (motd && *motd)"? 
> 
> As I have found that Globals is set 0 during initialization, and I
> didn't find anywhere else assign the value.

> clientserver.c #line 147~160
> > if (!am_client) {
> > motd = lp_motd_file();
^^
> > if (motd && *motd) {

It's being assigned the line above the (motd && *motd) part!


Paul
-- 
Please use reply-all for most replies to avoid omitting the mailing list.
To unsubscribe or change options: https://lists.samba.org/mailman/listinfo/rsync
Before posting, read: http://www.catb.org/~esr/faqs/smart-questions.html


Re: [Code study]should we remove if (motd && *motd) section?

2009-04-27 Thread Daniel.Li
On Mon, 2009-04-27 at 12:41 +0200, Paul Slootman wrote:
> On Mon 27 Apr 2009, Daniel.Li wrote:
> > 
> > I'm confused when we will run into "if (motd && *motd)"? 
> > 
> > As I have found that Globals is set 0 during initialization, and I
> > didn't find anywhere else assign the value.
> 
> > clientserver.c #line 147~160
> > >   if (!am_client) {
> > >   motd = lp_motd_file();
> ^^
> > >   if (motd && *motd) {
> 
> It's being assigned the line above the (motd && *motd) part!

Sorry, I forgot to paste below macros. Yes, it's assigned, but this
function just returns default("") or global values. But it seems never
assigned.

loadparam.c #line 394

> FN_GLOBAL_STRING(lp_motd_file, &Globals.motd_file)

loadparam.c #line 374~375


> #define FN_GLOBAL_STRING(fn_name,ptr) \
>  char *fn_name(void) {return(*(char **)(ptr) ? *(char **)(ptr) : "");}

So the function will return "" or it's assigned value.
char *lp_motd_file(void)
{
return(*(char **)(&Globals.motd_file) ? *(char **)(&Globals.motd_file) :
"");
}
> 
> 
> Paul
-- 
Daniel

-- 
Please use reply-all for most replies to avoid omitting the mailing list.
To unsubscribe or change options: https://lists.samba.org/mailman/listinfo/rsync
Before posting, read: http://www.catb.org/~esr/faqs/smart-questions.html


Re: [Code study]should we remove if (motd && *motd) section?

2009-04-27 Thread Petr Uzel
On Mon, Apr 27, 2009 at 07:27:38PM +0800, Daniel.Li wrote:
> On Mon, 2009-04-27 at 19:21 +0800, Daniel.Li wrote:
> > On Mon, 2009-04-27 at 12:41 +0200, Paul Slootman wrote:
> > > On Mon 27 Apr 2009, Daniel.Li wrote:
> > > > 
> > > > I'm confused when we will run into "if (motd && *motd)"? 
> > > > 
> > > > As I have found that Globals is set 0 during initialization, and I
> > > > didn't find anywhere else assign the value.
> > > 
> > > > clientserver.c #line 147~160
> > > > >   if (!am_client) {
> > > > >   motd = lp_motd_file();
> > > ^^
> > > > >   if (motd && *motd) {
> > > 
> > > It's being assigned the line above the (motd && *motd) part!
> > 
> > Sorry, I forgot to paste below macros. Yes, it's assigned, but this
> > function just returns default("") or global values. But it seems never
> > assigned.
> 
> What I mean is "Globals.motd_file is NEVER assigned". When we use
> default "". Then we still will NOT go into "if (motd && *motd)", as
> *motd == 0.

I'd guess it is assigned in the code that parses configuration file
(rsyncd.conf).

What if you set 'motd file = /etc/rsync.motd' in /etc/rsyncd.conf?

-- 
Best regards / s pozdravem

Petr Uzel, Packages maintainer
-
SUSE LINUX, s.r.o.  e-mail: pu...@suse.cz
Lihovarská 1060/12  tel: +420 284 028 964
190 00 Prague 9 fax: +420 284 028 951
Czech Republic  http://www.suse.cz
-- 
Please use reply-all for most replies to avoid omitting the mailing list.
To unsubscribe or change options: https://lists.samba.org/mailman/listinfo/rsync
Before posting, read: http://www.catb.org/~esr/faqs/smart-questions.html


Re: [Code study]should we remove if (motd && *motd) section?

2009-04-27 Thread Daniel.Li
On Mon, 2009-04-27 at 19:21 +0800, Daniel.Li wrote:
> On Mon, 2009-04-27 at 12:41 +0200, Paul Slootman wrote:
> > On Mon 27 Apr 2009, Daniel.Li wrote:
> > > 
> > > I'm confused when we will run into "if (motd && *motd)"? 
> > > 
> > > As I have found that Globals is set 0 during initialization, and I
> > > didn't find anywhere else assign the value.
> > 
> > > clientserver.c #line 147~160
> > > > if (!am_client) {
> > > > motd = lp_motd_file();
> > ^^
> > > > if (motd && *motd) {
> > 
> > It's being assigned the line above the (motd && *motd) part!
> 
> Sorry, I forgot to paste below macros. Yes, it's assigned, but this
> function just returns default("") or global values. But it seems never
> assigned.

What I mean is "Globals.motd_file is NEVER assigned". When we use
default "". Then we still will NOT go into "if (motd && *motd)", as
*motd == 0.

What do u think?
> 
> loadparam.c #line 394
> 
> > FN_GLOBAL_STRING(lp_motd_file, &Globals.motd_file)
> 
> loadparam.c #line 374~375
> 
> 
> > #define FN_GLOBAL_STRING(fn_name,ptr) \
> >  char *fn_name(void) {return(*(char **)(ptr) ? *(char **)(ptr) : "");}
> 
> So the function will return "" or it's assigned value.
> char *lp_motd_file(void)
> {
> return(*(char **)(&Globals.motd_file) ? *(char **)(&Globals.motd_file) :
> "");
> }
> > 
> > 
> > Paul
> -- 
> Daniel
> 
Daniel


-- 
Please use reply-all for most replies to avoid omitting the mailing list.
To unsubscribe or change options: https://lists.samba.org/mailman/listinfo/rsync
Before posting, read: http://www.catb.org/~esr/faqs/smart-questions.html


Re: [Code study]should we remove if (motd && *motd) section?

2009-04-27 Thread Daniel.Li
On Mon, 2009-04-27 at 13:34 +0200, Petr Uzel wrote:
> On Mon, Apr 27, 2009 at 07:27:38PM +0800, Daniel.Li wrote:
> > On Mon, 2009-04-27 at 19:21 +0800, Daniel.Li wrote:
> > > On Mon, 2009-04-27 at 12:41 +0200, Paul Slootman wrote:
> > > > On Mon 27 Apr 2009, Daniel.Li wrote:
> > > > > 
> > > > > I'm confused when we will run into "if (motd && *motd)"? 
> > > > > 
> > > > > As I have found that Globals is set 0 during initialization, and I
> > > > > didn't find anywhere else assign the value.
> > > > 
> > > > > clientserver.c #line 147~160
> > > > > > if (!am_client) {
> > > > > > motd = lp_motd_file();
> > > > ^^
> > > > > > if (motd && *motd) {
> > > > 
> > > > It's being assigned the line above the (motd && *motd) part!
> > > 
> > > Sorry, I forgot to paste below macros. Yes, it's assigned, but this
> > > function just returns default("") or global values. But it seems never
> > > assigned.
> > 
> > What I mean is "Globals.motd_file is NEVER assigned". When we use
> > default "". Then we still will NOT go into "if (motd && *motd)", as
> > *motd == 0.
> 
> I'd guess it is assigned in the code that parses configuration file
> (rsyncd.conf).
> 
> What if you set 'motd file = /etc/rsync.motd' in /etc/rsyncd.conf?

Humm... Thanks for the point.
load_config -> lp_load -> pm_process -> do_parameter

do_parameter compares "motd file", like a key, then assigned
Globals.motd_file =  "/etc/rsync.motd"

Well, NOW, take a close look at motd file, I know, it's something like
welcome message.

And the rsync protocol 30 only support 1024 chars of welcome message.

Thanks :)
> 
> -- 
> Best regards / s pozdravem
> 
> Petr Uzel, Packages maintainer
> -
> SUSE LINUX, s.r.o.  e-mail: pu...@suse.cz
> Lihovarská 1060/12  tel: +420 284 028 964
> 190 00 Prague 9 fax: +420 284 028 951
> Czech Republic  http://www.suse.cz
-- 
Daniel

-- 
Please use reply-all for most replies to avoid omitting the mailing list.
To unsubscribe or change options: https://lists.samba.org/mailman/listinfo/rsync
Before posting, read: http://www.catb.org/~esr/faqs/smart-questions.html


Re: [Code study]append_mode definitions

2009-04-27 Thread Wayne Davison
On Mon, Apr 27, 2009 at 10:33:02AM +0800, Daniel.Li wrote:
> Can anyone help to explain definitions of variable "append_mode"?

There are two different type of appending (see the man page) depending
on how new rsync is and how much of the file should be checksummed.  The
option is also disabled if a file is being fixed during a redo event.

..wayne..
-- 
Please use reply-all for most replies to avoid omitting the mailing list.
To unsubscribe or change options: https://lists.samba.org/mailman/listinfo/rsync
Before posting, read: http://www.catb.org/~esr/faqs/smart-questions.html


Re: "rsync: writefd_unbuffered failed to write 4 bytes" on mounted share

2009-04-27 Thread Wayne Davison
On Mon, Apr 27, 2009 at 12:19:10PM +0200, Stefan-Michael Guenther wrote:
> rsync: close failed on 
> "/media/nas/daily.0/samba/Bereiche/Auslieferung/Software/NT2/2012/2012-69-RA-1L.0968
>  
> (XY_I)/2006-11-16/XY_app.968/Logdb/.XYlog.mdb.REP380": Input/output error (5)

That's an OS error when rsync closed a file it was writing, so you'll need
to figure out what your OS is telling you about that failure on that disk.

..wayne..
-- 
Please use reply-all for most replies to avoid omitting the mailing list.
To unsubscribe or change options: https://lists.samba.org/mailman/listinfo/rsync
Before posting, read: http://www.catb.org/~esr/faqs/smart-questions.html


Re: [Code study]append_mode definitions

2009-04-27 Thread Daniel.Li
On Mon, 2009-04-27 at 06:44 -0700, Wayne Davison wrote:
> On Mon, Apr 27, 2009 at 10:33:02AM +0800, Daniel.Li wrote:
> > Can anyone help to explain definitions of variable "append_mode"?
> 
> There are two different type of appending (see the man page) depending
> on how new rsync is and how much of the file should be checksummed. 

We are studying ver 3.0.5.

So there are three states:

1) append_mode = 0, NONE append mode.

2) append_mode = 1, "--append" 
If file size on the receiver is the same or longer than the size on the
sender, the file is skipped

3) append_mode = 2, "--append-verify"
This works just like the --append option, but the existing data on the
receiving side is included in the full-file checksum verification step


>  The
> option is also disabled if a file is being fixed during a redo event.

I didn't get it. Can u help to explain a little bit more? Thanks.


But I still doesn't know why "append_mode = -append_mode" in those
files?

generate.c #line2102,2127

> append_mode = -append_mode;


receive.c #line503,513

> append_mode = -append_mode;

send.c #line248,254

> append_mode = -append_mode;
> 
> ..wayne..
---
Daniel


-- 
Please use reply-all for most replies to avoid omitting the mailing list.
To unsubscribe or change options: https://lists.samba.org/mailman/listinfo/rsync
Before posting, read: http://www.catb.org/~esr/faqs/smart-questions.html


Re: purge-empty-dirs and max-file-size confusion

2009-04-27 Thread Wayne Davison
On Fri, Apr 24, 2009 at 02:19:42PM -0400, Ian! D. Allen wrote:
> There is no mention of the concept of "transfer rule" in the rsync
> man page.  I offer some proposed man page wording changes, below.

Thanks.  I have committed some manpage changes that clarify this
unexpected behavior.  At some point rsync may allow actual filtering of
files by their (non-name) attributes, which would avoid this situation.

..wayne..
-- 
Please use reply-all for most replies to avoid omitting the mailing list.
To unsubscribe or change options: https://lists.samba.org/mailman/listinfo/rsync
Before posting, read: http://www.catb.org/~esr/faqs/smart-questions.html


Re: [PATCH] allow to disable SLP with runtime option

2009-04-27 Thread Wayne Davison
On Wed, Apr 22, 2009 at 04:14:23PM +0200, Petr Uzel wrote:
> It adds a new global boolean option, 'disable slp', which can be used
> to disable SLP advertisements at runtime.

I've taken your patch and changed the boolean into a "use slp" global
daemon parameter (default: enabled).  I also made sure that if slp is
disabled, that there is no slp timeout processing (or services could get
enabled at the first timeout).  The updated slp patch is now in git.

Thanks!

..wayne..
-- 
Please use reply-all for most replies to avoid omitting the mailing list.
To unsubscribe or change options: https://lists.samba.org/mailman/listinfo/rsync
Before posting, read: http://www.catb.org/~esr/faqs/smart-questions.html


Rsync (cwrsync) log file

2009-04-27 Thread Jeff Boyce

Greetings -

There is probably a simple answer to this, but I can't seem to figure it 
out.  I would like to have a clean log file of each rsync operation; in 
other words I don't want to have rsync append to the existing log file, but 
instead create a new one each time after deleting the old one.


My situation is this; I run rsync from a shell script on my Linux server 
which backs up our working data directories on the server.  The rsync 
command is copying the files to my Vista desktop box that is running 
cwRsync.  The purpose of this is to have an emergency backup of our working 
data directories in case of a hardware failure on our server, which could be 
used to keep staff working during the period when the server hardware is 
being replaced.  My script is run from cron nightly and it is working fine. 
The problem is that my log file is growing each day and I would like it to 
replace the existing log rather than append to it.  I am having the logs 
written to the Vista box as defined in my cwRsync configuration file on the 
Vista box.  Since the file is on the Vista machine, I can not just add a 
line in my (Linux) script to delete the existing log file before running the 
rsync command.  What would be a simple, or appropriate, way to do this?  I 
would like to have the log file remain on the Vista box.  Thanks.


Jeff Boyce
www.meridianenv.com

--
Please use reply-all for most replies to avoid omitting the mailing list.
To unsubscribe or change options: https://lists.samba.org/mailman/listinfo/rsync
Before posting, read: http://www.catb.org/~esr/faqs/smart-questions.html