There's a bug reported in Debian about the tty being screwed up by wierd filenames, see http://bugs.debian.org/bug=242300 On the one hand, find will also do this. On the other hand, ls will replace such chars with a question mark. Upon inspection, it appears to be fairly simple to also do this in rsync (in the rwrite() function). Here's a patch. Opinions? Perhaps don't do it unconditionally, i.e. offer some way to turn it off? Paul Slootman --- log.c.orig 2004-10-04 11:51:37.000000000 +0200 +++ log.c 2004-11-23 17:27:29.000000000 +0100 @@ -180,6 +180,15 @@ buf[len] = 0; + if (code == FINFO) { + /* Replace non-printing chars in the string, most probably due to + * wierd filenames. Skip the first and last chars, they may be \n */ + int i; + for (i=1; i<len-1; i++) + if (!isprint(buf[i])) + buf[i] = '?'; + } + if (am_server && msg_fd_out >= 0) { /* Pass the message to our sibling. */ send_msg((enum msgcode)code, buf, len);
On Tue, Nov 23, 2004 at 05:29:57PM +0100, Paul Slootman wrote:> Here's a patch. Opinions?I think that a better place to munge the name would be in the safe_fname() routine in utils.c (which already munges newlines characters into question marks). The reason I didn't change any other characters was because I feared that it would mangle foreign filenames that use high-bit characters. I'd want some feedback from such users before accepting such a patch. ..wayne..
Dmitry V. Levin
2004-Nov-23 22:40 UTC
patch for replacing non-printable chars in filenames
Hi, On Tue, Nov 23, 2004 at 05:29:57PM +0100, Paul Slootman wrote:> There's a bug reported in Debian about the tty being screwed up by wierd > filenames, see http://bugs.debian.org/bug=242300 > > On the one hand, find will also do this. On the other hand, ls will > replace such chars with a question mark. Upon inspection, it appears to > be fairly simple to also do this in rsync (in the rwrite() function).1. find's output is mostly for another program's input, not for tty. 2. ls does --hide-control-chars by default only if isatty (STDOUT_FILENO).> Here's a patch. Opinions? Perhaps don't do it unconditionally, i.e. > offer some way to turn it off?I'd make it like ls, i.e. when descriptor is a tty; also I'd add some option to enforce --hide-control-chars also for non-tty. -- ldv -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 189 bytes Desc: not available Url : http://lists.samba.org/archive/rsync/attachments/20041124/ee27606c/attachment.bin
On Tue, Nov 23, 2004 at 05:29:57PM +0100, Paul Slootman wrote:> + /* Replace non-printing chars in the string, most probably due to > + * wierd filenames. Skip the first and last chars, they may be \n */ > + int i; > + for (i=1; i<len-1; i++) > + if (!isprint(buf[i])) > + buf[i] = '?';Is looping over strings a good idea in times of UTF-8? cu, Stefan -- Stefan Nehlsen | ParlaNet Administration | sn@parlanet.de | +49 431 988-1260
Have an environment where we're using rsync to do server to disk backups...... on the problem server - Win2k Server running a scheduled task with cwrsync installed. It has a script and should be backing up to a linux server (rsync to a directory, not a rsync server). However, the scheduled task never seems to start - I can come back to the server in a few days and find multiple rsync and ssh tasks running on the Win2k Server. I can run the script manually - and it will not ask for a password, as I've set the keygen and known/authorized host information for both the source and the target. I know I'm missing something silly, but cannot figure out what it is. Jon Johnston Creative Business Solutions IBM,Microsoft, Novell/Suse, Sophos Consultants http://www.cbsol.com 952-544-1108 Blog: http://bingo.cbsol.com -------------- next part -------------- HTML attachment scrubbed and removed