View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
0000275 | Rsync | Bug | public | 2008-09-12 23:41 | 2020-08-24 03:14 |
Reporter | Steven Levine | Assigned To | Steven Levine | ||
Priority | normal | Severity | major | Reproducibility | always |
Status | closed | Resolution | fixed | ||
Summary | 0000275: rsync does not copy EAs to server | ||||
Description | Linux EAs (i.e. xattrs) expect a namespace prefix. OS/2 EAs do not support his notion. The rsync v3.0.3pre10 OS/2 build does not handle this well. The result is any EAs received by the server are dropped. The attached diffs includes all of Paul's 3.0.3pre10 patches and correctly replicates EAs on the server. The diffs include code to attempt to correctly handle EAs when the server is a Linux box, but this has not been tested. The diffs also include logic to resolve tickets 245, 246 and 260. Overall, the build is only lightly tested, but it appears to work at least was well as 3.0.3pre10. | ||||
Tags | No tags attached. | ||||
Attached Files | rsync-3.0.3-20080911-shl.diff (45,671 bytes)
Only in .: Makefile diff -r -u -w ../../../sla_dev2_browse/rsync/rsync-3.0.3/access.c ./access.c --- ../../../sla_dev2_browse/rsync/rsync-3.0.3/access.c 2008-03-01 12:01:40.000000000 -0800 +++ ./access.c 2008-09-11 17:36:28.000000000 -0700 @@ -100,7 +100,9 @@ hints.ai_flags = AI_NUMERICHOST; #endif - if (getaddrinfo(addr, NULL, &hints, &resa) != 0) { + // if (getaddrinfo(addr, NULL, &hints, &resa) != 0) { + if ((gai = getaddrinfo(addr, NULL, &hints, &resa)) != 0) { // 27 Jul 08 SHL debug + // rprintf(FLOG, "* match_address: gai %d %s(%d)\n", gai, __FILE__, __LINE__); // 28 Jul 08 SHL debug if (p) *p = '/'; return 0; @@ -110,8 +112,8 @@ if (p) *p++ = '/'; if (gai != 0) { - rprintf(FLOG, "error matching address %s: %s\n", - tok, gai_strerror(gai)); + rprintf(FLOG, "* error matching address %s: %s (%d)\n", + tok, gai_strerror(gai), gai); freeaddrinfo(resa); return 0; } @@ -222,7 +224,11 @@ if (host) strlower(host); + // rprintf(FLOG, "* access_match: %s (%s) %s(%d)\n", host, addr, __FILE__, __LINE__); // 28 Jul 08 SHL debug + for (tok = strtok(list2, " ,\t"); tok; tok = strtok(NULL, " ,\t")) { + + // rprintf(FLOG, "* access_match: tok %s %s(%d)\n", tok, __FILE__, __LINE__); // 28 Jul 08 SHL debug if (match_hostname(host, tok) || match_address(addr, tok)) { free(list2); return 1; Only in .: access.o Only in .: acls.o diff -r -u -w ../../../sla_dev2_browse/rsync/rsync-3.0.3/authenticate.c ./authenticate.c --- ../../../sla_dev2_browse/rsync/rsync-3.0.3/authenticate.c 2008-03-01 12:01:40.000000000 -0800 +++ ./authenticate.c 2008-07-29 17:01:30.000000000 -0700 @@ -173,13 +173,16 @@ if (do_stat(filename, &st) == -1) { rsyserr(FWARNING, errno, "stat(%s)", filename); ok = 0; - } else if ((st.st_mode & 06) != 0) { + } +#ifndef __OS2__ /* 12 Jun 08 SHL ignore unsupported mode checks */ + else if ((st.st_mode & 06) != 0) { rprintf(FWARNING, "password file must not be other-accessible\n"); ok = 0; } else if (MY_UID() == 0 && st.st_uid != 0) { rprintf(FWARNING, "password file must be owned by root when running as root\n"); ok = 0; } +#endif /* __OS2__ */ if (!ok) { close(fd); rprintf(FWARNING, "continuing without password file\n"); Only in .: authenticate.o Only in .: backup.o Only in .: batch.o Only in .: cfg_shl Only in .: checksum.o Only in .: chmod.o Only in .: cleanup.o diff -r -u -w ../../../sla_dev2_browse/rsync/rsync-3.0.3/clientname.c ./clientname.c --- ../../../sla_dev2_browse/rsync/rsync-3.0.3/clientname.c 2008-03-01 12:01:40.000000000 -0800 +++ ./clientname.c 2008-09-11 17:50:12.000000000 -0700 @@ -95,8 +95,10 @@ struct sockaddr_storage ss; socklen_t ss_len; - if (initialised) + if (initialised) { + // rprintf(FLOG, "* client_name: %s %s(%d)\n", name_buf, __FILE__, __LINE__); // 28 Jul 08 SHL debug return name_buf; + } strlcpy(name_buf, default_name, sizeof name_buf); initialised = 1; @@ -145,6 +147,8 @@ port_buf, sizeof port_buf) == 0) check_name(fd, &ss, name_buf, sizeof name_buf); + // rprintf(FLOG, "* client_name: %s %s(%d)\n", name_buf, __FILE__, __LINE__); // 28 Jul 08 SHL debug + return name_buf; } @@ -213,14 +217,17 @@ int name_err; /* reverse lookup */ + // rprintf(FLOG, "* lookup_name: %s(%d)\n", __FILE__, __LINE__); // 28 Jul 08 SHL debug name_err = getnameinfo((struct sockaddr *) ss, ss_len, name_buf, name_buf_size, port_buf, port_buf_size, NI_NAMEREQD | NI_NUMERICSERV); if (name_err != 0) { strlcpy(name_buf, default_name, name_buf_size); - rprintf(FLOG, "name lookup failed for %s: %s\n", - client_addr(fd), gai_strerror(name_err)); + // rprintf(FLOG, "name lookup failed for %s: %s\n", + // client_addr(fd), gai_strerror(name_err)); + rprintf(FLOG, "* lookup_name failed for %s with error %s (%d) [%s] %s(%d)\n", // 27 Jul 08 SHL + client_addr(fd), gai_strerror(name_err), name_err, who_am_i(), __FILE__, __LINE__); // 28 Jul 08 SHL return name_err; } Only in .: clientname.o diff -r -u -w ../../../sla_dev2_browse/rsync/rsync-3.0.3/clientserver.c ./clientserver.c --- ../../../sla_dev2_browse/rsync/rsync-3.0.3/clientserver.c 2008-04-15 08:34:16.000000000 -0700 +++ ./clientserver.c 2008-09-11 17:35:52.000000000 -0700 @@ -416,6 +416,7 @@ iconv_opt = NULL; #endif + rprintf(FLOG, "rsync_module: addr %s host %s [%s] %s(%d)\n", addr, host, who_am_i(), __FILE__, __LINE__); // 28 Jul 08 SHL debug if (!allow_access(addr, host, lp_hosts_allow(i), lp_hosts_deny(i))) { rprintf(FLOG, "rsync denied on module %s from %s (%s)\n", name, host, addr); @@ -469,6 +470,7 @@ am_root = (MY_UID() == 0); +#ifndef __OS2__ if (am_root) { p = lp_uid(i); if (!name_to_uid(p, &uid)) { @@ -490,6 +492,7 @@ gid = atoi(p); } } +#endif // __OS2__ /* TODO: If we're not root, but the configuration requests * that we change to some uid other than the current one, then @@ -510,11 +513,13 @@ /* We do a change_dir() that doesn't actually call chdir() * just to make a relative path absolute. */ strlcpy(line, curr_dir, sizeof line); + // rprintf(FLOG, "* module_dir %s %s(%d)\n", module_dir, __FILE__, __LINE__); // 28 Jul 08 SHL debug if (!change_dir(module_dir, CD_SKIP_CHDIR)) goto chdir_failed; if (strcmp(curr_dir, module_dir) != 0 && (module_dir = strdup(curr_dir)) == NULL) out_of_memory("rsync_module"); + // rprintf(FLOG, "* line %s %s(%d)\n", line, __FILE__, __LINE__); // 28 Jul 08 SHL debug change_dir(line, CD_SKIP_CHDIR); /* Restore curr_dir. */ if (use_chroot) { @@ -522,6 +527,7 @@ module_dir = p; /* p is "/" or our inside-chroot path */ } module_dirlen = clean_fname(module_dir, CFN_COLLAPSE_DOT_DOT_DIRS | CFN_DROP_TRAILING_DOT_DIR); + // rprintf(FLOG, "* module_dir %s %s(%d)\n", module_dir, __FILE__, __LINE__); // 28 Jul 08 SHL debug if (module_dirlen == 1) { module_dirlen = 0; @@ -671,15 +677,18 @@ io_printf(f_out, "@ERROR: chroot failed\n"); return -1; } + // rprintf(FLOG, "* module_dir %s %s(%d)\n", module_dir, __FILE__, __LINE__); // 28 Jul 08 SHL debug if (!change_dir(module_dir, CD_NORMAL)) goto chdir_failed; if (module_dirlen) sanitize_paths = 1; } else { + // rprintf(FLOG, "* module_dir %s %s(%d)\n", module_dir, __FILE__, __LINE__); // 28 Jul 08 SHL debug if (!change_dir(module_dir, CD_NORMAL)) { chdir_failed: - rsyserr(FLOG, errno, "chdir %s failed\n", module_dir); - io_printf(f_out, "@ERROR: chdir failed\n"); + rsyserr(FLOG, errno, "* chdir %s failed\n", module_dir); + // io_printf(f_out, "@ERROR: chdir failed\n"); + io_printf(f_out, "@ERROR: chdir failed %s\n", module_dir); // 28 Jul 08 SHL debug return -1; } sanitize_paths = 1; @@ -964,6 +973,8 @@ #endif SIGACTION(SIGCHLD, remember_children); + // rprintf(FLOG, "start_daemon: %s %s [%s] %s(%d)\n", addr, host, who_am_i(), __FILE__, __LINE__); // 28 Jul 08 SHL debug + return rsync_module(f_in, f_out, i, addr, host); } @@ -1044,10 +1055,14 @@ exit_cleanup(RERR_SYNTAX); } +#ifndef __OS2__ if (no_detach) create_pid_file(); else become_daemon(); +#else + create_pid_file(); +#endif if (rsync_port == 0 && (rsync_port = lp_rsync_port()) == 0) rsync_port = RSYNC_PORT; Only in .: clientserver.o Only in .: compat.o Only in .: config.cache Only in .: config.h Only in .: config.log Only in .: config.status diff -r -u -w ../../../sla_dev2_browse/rsync/rsync-3.0.3/configure.sh ./configure.sh --- ../../../sla_dev2_browse/rsync/rsync-3.0.3/configure.sh 2008-06-29 20:32:10.000000000 -0700 +++ ./configure.sh 2008-07-29 17:01:30.000000000 -0700 @@ -16624,6 +16624,15 @@ _ACEOF ;; + *os2*) + { echo "$as_me:$LINENO: result: Using OS/2 extattrs" >&5 +echo "${ECHO_T}Using OS/2 extattrs" >&6; } + cat >>confdefs.h <<\_ACEOF +#define SUPPORT_XATTRS 1 +_ACEOF + + ;; + *) if test x"$enable_xattr_support" = x"yes"; then { { echo "$as_me:$LINENO: error: Failed to find extended attribute support" >&5 Only in .: connection.o Only in .: ctags.tag Only in .: diff_shl.cmd Only in .: exclude.o Only in .: fileio.o diff -r -u -w ../../../sla_dev2_browse/rsync/rsync-3.0.3/flist.c ./flist.c --- ../../../sla_dev2_browse/rsync/rsync-3.0.3/flist.c 2008-06-22 19:00:50.000000000 -0700 +++ ./flist.c 2008-09-11 17:36:06.000000000 -0700 @@ -347,8 +347,16 @@ { if (dirlen < 0) { char *cpy = strdup(dir); +#ifndef __OS__ // 28 Jul 08 SHL if (*cpy != '/') change_dir(orig_dir, CD_SKIP_CHDIR); +#else + if ((*(cpy + 1) == ':' && *(cpy + 2) != '/') || + (*(cpy + 1) != ':' && *cpy != '/')) { + // rprintf(FLOG, "* orig_dir %s %s(%d)\n", orig_dir, __FILE__, __LINE__); // 28 Jul 08 SHL debug + change_dir(orig_dir, CD_SKIP_CHDIR); + } +#endif if (path_is_daemon_excluded(cpy, 0)) goto chdir_error; dir = cpy; @@ -362,8 +370,17 @@ dirlen = strlen(dir); } else if (pathname == dir) return 1; +#ifndef __OS__ // 28 Jul 08 SHL if (dir && *dir != '/') change_dir(orig_dir, CD_SKIP_CHDIR); +#else + if (dir && + ((*(dir + 1) == ':' && *(dir + 2) != '/') || + (*(dir + 1) != ':' && *dir != '/'))) { + // rprintf(FLOG, "* orig_dir %s %s(%d)\n", orig_dir, __FILE__, __LINE__); // 28 Jul 08 SHL debug + change_dir(orig_dir, CD_SKIP_CHDIR); + } +#endif } pathname = dir; @@ -372,12 +389,15 @@ if (!dir) dir = orig_dir; + // rprintf(FLOG, "* dir %s %s(%d)\n", dir, __FILE__, __LINE__); // 28 Jul 08 SHL debug if (!change_dir(dir, CD_NORMAL)) { chdir_error: io_error |= IOERR_GENERAL; rsyserr(FERROR, errno, "change_dir %s failed", full_fname(dir)); - if (dir != orig_dir) + if (dir != orig_dir) { + // rprintf(FLOG, "* orig_dir %s %s(%d)\n", orig_dir, __FILE__, __LINE__); // 28 Jul 08 SHL debug change_dir(orig_dir, CD_NORMAL); + } pathname = NULL; pathname_len = 0; return 0; @@ -1906,6 +1926,7 @@ disable_buffering = io_start_buffering_out(f); if (filesfrom_fd >= 0) { + // rprintf(FLOG, "* argv[0] %s %s(%d)\n", argv[0], __FILE__, __LINE__); // 28 Jul 08 SHL debug if (argv[0] && !change_dir(argv[0], CD_NORMAL)) { rsyserr(FERROR_XFER, errno, "change_dir %s failed", full_fname(argv[0])); Only in .: flist.o diff -r -u -w ../../../sla_dev2_browse/rsync/rsync-3.0.3/generator.c ./generator.c --- ../../../sla_dev2_browse/rsync/rsync-3.0.3/generator.c 2008-06-26 08:14:10.000000000 -0700 +++ ./generator.c 2008-09-11 18:05:02.000000000 -0700 @@ -675,12 +675,17 @@ get_xattr(fnamecmp, sxp); if (xattr_diff(file, sxp, 1)) iflags |= ITEM_REPORT_XATTR; + else if (verbose > 2) + rprintf(FINFO, "itemize: xattr_diff returned false for %s [%s] %s(%d)\n", fnamecmp, who_am_i(), __FILE__, __LINE__); // 09 Sep 08 SHL debug + } #endif } else { #ifdef SUPPORT_XATTRS if (preserve_xattrs && xattr_diff(file, NULL, 1)) iflags |= ITEM_REPORT_XATTR; + else if (verbose > 2) + rprintf(FINFO, "itemize: xattr_diff returned false for %s [%s] %s(%d)\n", fnamecmp, who_am_i(), __FILE__, __LINE__); // 09 Sep 08 SHL debug #endif iflags |= ITEM_IS_NEW; } @@ -702,6 +707,8 @@ send_xattr_request(NULL, file, iflags & ITEM_REPORT_XATTR ? sock_f_out : -1); } + else if (verbose > 2) + rprintf(FINFO, "itemize: ITEM_REPORT_XATTR|ITEM_TRANSFER false for %s [%s] %s(%d)\n", fnamecmp, who_am_i(), __FILE__, __LINE__); // 09 Sep 08 SHL debug #endif } else if (ndx >= 0) { enum logcode code = logfile_format_has_i ? FINFO : FCLIENT; @@ -1471,6 +1478,8 @@ #ifdef SUPPORT_XATTRS if (preserve_xattrs && statret == 1) copy_xattrs(fnamecmpbuf, fname); + else if (verbose > 2) + rprintf(FINFO, "recv_generator: skipped copy_xattrs for %s fnamecmpbuf \"%s\" statret %d [%s] %s(%d)\n", fname, fnamecmpbuf, statret, who_am_i(), __FILE__, __LINE__); // 09 Sep 08 SHL debug #endif if (set_file_attrs(fname, file, real_ret ? NULL : &real_sx, NULL, 0) && verbose && code != FNONE && f_out != -1) Only in .: generator.o Only in .: hashtable.o Only in .: hlink.o Only in .: init_shl Only in .: init_shl.cmd Only in .: io.o Only in ./lib: compat.o Only in ./lib: ctags.tag Only in ./lib: dummy diff -r -u -w ../../../sla_dev2_browse/rsync/rsync-3.0.3/lib/getaddrinfo.c ./lib/getaddrinfo.c --- ../../../sla_dev2_browse/rsync/rsync-3.0.3/lib/getaddrinfo.c 2007-11-08 12:30:16.000000000 -0800 +++ ./lib/getaddrinfo.c 2008-09-11 17:49:50.000000000 -0700 @@ -404,12 +404,16 @@ int ret = -1; char *p = NULL; + // rprintf(FLOG, "* gethostnameinfo: NI_NUMERICHOST %u %s(%d)\n", flags & NI_NUMERICHOST, __FILE__, __LINE__); // 28 Jul 08 SHL debug if (!(flags & NI_NUMERICHOST)) { + // rprintf(FLOG, "* gethostnameinfo: %s(%d)\n", __FILE__, __LINE__); // 28 Jul 08 SHL debug struct hostent *hp = gethostbyaddr( (void *)&((struct sockaddr_in *)sa)->sin_addr, sizeof (struct in_addr), sa->sa_family); + // rprintf(FLOG, "* gethostnameinfo: hp %p %s(%d)\n", hp, __FILE__, __LINE__); // 28 Jul 08 SHL debug ret = check_hostent_err(hp); + // rprintf(FLOG, "* ret %d %s(%d)\n", ret, __FILE__, __LINE__); // 28 Jul 08 SHL debug if (ret == 0) { /* Name looked up successfully. */ ret = snprintf(node, nodelen, "%s", hp->h_name); @@ -425,6 +429,7 @@ return 0; } + // rprintf(FLOG, "* %s(%d)\n", __FILE__, __LINE__); // 28 Jul 08 SHL debug if (flags & NI_NAMEREQD) { /* If we require a name and didn't get one, * automatically fail. */ @@ -432,6 +437,7 @@ } /* Otherwise just fall into the numeric host code... */ } + // rprintf(FLOG, "* %s(%d)\n", __FILE__, __LINE__); // 28 Jul 08 SHL debug p = inet_ntoa(((struct sockaddr_in *)sa)->sin_addr); ret = snprintf(node, nodelen, "%s", p); if (ret < 0 || (size_t)ret >= nodelen) { @@ -492,17 +498,23 @@ return EAI_FAIL; } + // rprintf(FLOG, "* %s(%d)\n", __FILE__, __LINE__); // 28 Jul 08 SHL debug /* We don't support those. */ if ((node && !(flags & NI_NUMERICHOST)) - || (service && !(flags & NI_NUMERICSERV))) + || (service && !(flags & NI_NUMERICSERV))) { + rprintf(FLOG, "* unsupported getnameinfo request [%s] %s(%d)\n", who_am_i(), __FILE__, __LINE__); // 28 Jul 08 SHL return EAI_FAIL; + } + // rprintf(FLOG, "* getnameinfo: %p %s(%d)\n", node, __FILE__, __LINE__); // 28 Jul 08 SHL debug if (node) { return gethostnameinfo(sa, node, nodelen, flags); } + // rprintf(FLOG, "* %s(%d)\n", __FILE__, __LINE__); // 28 Jul 08 SHL debug if (service) { return getservicenameinfo(sa, service, servicelen, flags); } + // rprintf(FLOG, "* %s(%d)\n", __FILE__, __LINE__); // 28 Jul 08 SHL debug return 0; } Only in ./lib: getaddrinfo.o Only in ./lib: md5.o Only in ./lib: mdfour.o Only in ./lib: permstring.o Only in ./lib: pool_alloc.o Only in ./lib: snprintf.o Only in ./lib: sysacls.o diff -r -u -w ../../../sla_dev2_browse/rsync/rsync-3.0.3/lib/sysxattrs.c ./lib/sysxattrs.c --- ../../../sla_dev2_browse/rsync/rsync-3.0.3/lib/sysxattrs.c 2008-03-01 12:01:40.000000000 -0800 +++ ./lib/sysxattrs.c 2008-09-11 19:12:40.000000000 -0700 @@ -126,6 +126,382 @@ return len; } +#elif defined(__OS2__) + +#define INCL_LONGLONG +#define INCL_DOS +#define INCL_DOSPROCESS +#define INCL_DOSPROFILE +#define INCL_DOSMISC +#define INCL_DOSMODULEMGR +#define INCL_DOSERRORS + +#include <os2.h> +#include <stdio.h> +#include <stdlib.h> +#include <errno.h> +#include <types.h> +ssize_t sys_lgetxattr(const char *path, const char *name, void *value, size_t size) +{ + return unigetxattr(path, 0, name, value, size); +} + +ssize_t sys_fgetxattr(int filedes, const char *name, void *value, size_t size) +{ + return unigetxattr(0, filedes, name, value, size); +} + +int sys_lsetxattr(const char *path, const char *name, const void *value, size_t size) +{ + return unisetxattr (path, 0, name, value, size, 0); +} + +int sys_lremovexattr(const char *path, const char *name) +{ + return uniremovexattr (path, 0, name); +} + +ssize_t sys_llistxattr(const char *path, char *list, size_t size) +{ + return unilistxattr(path, 0, list, size); +} + +ssize_t unigetxattr (const char *path, int file, const char *name, void *value, size_t size) +{ + int rc, namelen; + EAOP2 eaop2 = {0,0,0}; + PGEA2LIST pgea2list = NULL; + PFEA2LIST pfea2list = NULL; + char * p; + + if ((!path && !file) || !name) + { + errno = EINVAL; + return -1; + } + namelen = strlen(name); + if (namelen > 0xFF) + { + errno = EINVAL; + return -1; + } + pgea2list = (PGEA2LIST)calloc(sizeof(GEA2LIST) + namelen + 1, 1); + pgea2list->list[0].oNextEntryOffset = 0; + pgea2list->list[0].cbName = namelen; + strcpy(pgea2list->list[0].szName, name); + pgea2list->cbList = sizeof(GEA2LIST) + namelen; + + // max ea is 64kb + pfea2list = (PFEA2LIST)calloc(sizeof(FEA2LIST) + 0x10000, 1); + pfea2list->cbList = sizeof(FEA2LIST) + 0x10000; + + eaop2.fpGEA2List = pgea2list; + eaop2.fpFEA2List = pfea2list; + eaop2.oError = 0; + do + { + if (path) + { + char npath[CCHMAXPATH + 1] = {0}; + strncpy(npath, path, CCHMAXPATH); + for (p = npath; *p; p++) + { + if (*p == '/') *p = '\\'; // 29 Jul 08 SHL why - OS/2 does not care? + } + rc = DosQueryPathInfo(npath, FIL_QUERYEASFROMLIST, &eaop2, sizeof(eaop2)); + if (rc) + rprintf(FERROR, "* DosQueryPathInfo(%s, FIL_QUERYEASFROMLIST) failed with error %u [%s] %s(%d)\n", npath, rc, who_am_i(), __FILE__, __LINE__); // 28 Jul 08 SHL + else if (verbose > 2) + rprintf(FINFO, "unigetxattr: %s has %lu EA bytes [%s] %s(%d)\n", path, eaop2.fpFEA2List->cbList, who_am_i(), __FILE__, __LINE__); // 28 Jul 08 SHL debug + } + else + { + rc = DosQueryFileInfo( file, FIL_QUERYEASFROMLIST, &eaop2, sizeof(eaop2)); + if (rc) + rprintf(FERROR, "* DosQueryFileInfo(%u, FIL_QUERYEASFROMLIST) failed with error %u [%s] %s(%d)\n", file, rc, who_am_i(), __FILE__, __LINE__); // 28 Jul 08 SHL + else if (verbose > 2) + rprintf(FINFO, "unigetxattr: handle %d has %lu EA bytes %s(%d)\n", file, eaop2.fpFEA2List->cbList, __FILE__, __LINE__); // 28 Jul 08 SHL debug + } + if (rc) + { + break; + } + if (strnicmp(pfea2list->list[0].szName, name, namelen) || pfea2list->list[0].cbValue == 0) + { + errno = ENOATTR; + rc = -1; + break; + } + rc = pfea2list->list[0].cbValue; + if (value) + { + if ((size_t)rc > size) + { + errno = ERANGE; + rc = -1; + } + else + { + p = pfea2list->list[0].szName + pfea2list->list[0].cbName + 1; + memcpy(value, p, rc); + } + } + } while (0); + if (pgea2list) + { + free(pgea2list); + } + if (pgea2list) + { + free(pfea2list); + } + + return rc; +} + +ssize_t unilistxattr (const char *path, int file, char *list, size_t size) +{ + ssize_t gotsize = 0; + unsigned long ulCount = -1; + int rc; + char * buf, *p = list; + PFEA2 pfea; + FILESTATUS4 stat = {0}; // Warning expected + char npath[CCHMAXPATH + 1] = {0}; + if (!path && !file) + { + errno = EINVAL; + return -1; + } + if (path) + { + char * p; + strncpy(npath, path, CCHMAXPATH); + for (p = npath; *p; p++) + { + if (*p == '/') *p = '\\'; + } + rc = DosQueryPathInfo(npath, FIL_QUERYEASIZE, &stat, sizeof(stat)); + if (rc) + rprintf(FERROR, "* DosQueryPathInfo(%s, FIL_QUERYEASIZE) failed with error %u %s(%d)\n", npath, rc, __FILE__, __LINE__); // 28 Jul 08 SHL + else if (verbose > 2) + rprintf(FINFO, "unilistxattr: %s has %lu EA bytes [%s] %s(%d)\n", path, stat.cbList, who_am_i(), __FILE__, __LINE__); // 28 Jul 08 SHL debug + } + else + { + rc = DosQueryFileInfo( file, FIL_QUERYEASIZE, &stat, sizeof(stat)); + if (rc) + rprintf(FERROR, "* DosQueryFilInfo(%u, FIL_QUERYEASIZE) failed with %u [%s] %s(%d)\n", file, rc, who_am_i(), __FILE__, __LINE__); // 28 Jul 08 SHL + else if (verbose > 2) + rprintf(FINFO, "unilistxattr: handle %d has %lu EA bytes [%s] %s(%d)\n", file, stat.cbList, who_am_i(), __FILE__, __LINE__); // 28 Jul 08 SHL debug + } + if (rc) + { + return -1; + } + if (stat.cbList <= 4) + { + // NO ea + return 0; + } + //YD DosEnumAttribute doesn't like high-mem buffers, get a low one. + buf = (char *)_tmalloc(stat.cbList * 2); + rc = DosEnumAttribute(path ? 1 : 0, path ? (PVOID)path : (PVOID)&file, 1, (PVOID)buf, stat.cbList * 2, &ulCount, 1); + if (rc) + { + rprintf(FERROR, "* DosEnumAttribute failed with error %u [%s] %s(%d)\n", rc, who_am_i(), __FILE__, __LINE__); // 28 Jul 08 SHL + _tfree(buf); + return -1; + } + else if (verbose > 2) { + if (path) + rprintf(FINFO, "unilistxattr: %s has %lu EA items [%s] %s(%d)\n", path, ulCount, who_am_i(), __FILE__, __LINE__); // 28 Jul 08 SHL debug + else + rprintf(FINFO, "unilistxattr: handle %d has %lu EA items %s(%d)\n", file, ulCount, __FILE__, __LINE__); // 28 Jul 08 SHL debug + } + if (ulCount > 0) + for (pfea = (PFEA2)buf; ; pfea = (PFEA2)((char *)pfea + pfea->oNextEntryOffset)) + { + if (pfea->cbName > 0) + { + gotsize += pfea->cbName + 1; + // Avoid overflow + if (p && (size_t)gotsize <= size) + { + pfea->szName[pfea->cbName] = 0; + strcpy(p, pfea->szName); + p += strlen(p) + 1; + } + } + if (!pfea->oNextEntryOffset) + { + break; + } + } + _tfree(buf); + if ((size_t)gotsize > size) + { + errno = ERANGE; + return list ? -1 : gotsize; + } + if (verbose > 2) { + if (path) + rprintf(FINFO, "[%s] unilistxattr: returning %d EA name list bytes for %s %s(%d)\n", + who_am_i(), gotsize, path, __FILE__, __LINE__); // 28 Jul 08 SHL debug + else + rprintf(FINFO, "[%s] unilistxattr: returning %d EA name list bytes for %d %s(%d)\n", + who_am_i(), gotsize, file, __FILE__, __LINE__); // 28 Jul 08 SHL debug + } + return gotsize; +} + +int uniremovexattr (const char *path, int file, const char *name) +{ + int rc, namelen; + EAOP2 eaop2 = {0,0,0}; + PFEA2LIST pfea2list = NULL; + char buf[300] = {0}; + + if ((!path && !file) || !name) + { + errno = EINVAL; + return -1; + } + + namelen = strlen(name); + if (namelen > 0xFF) + { + errno = EINVAL; + return -1; + } + + pfea2list = (PFEA2LIST)buf; + pfea2list->list[0].cbName = namelen; + pfea2list->list[0].cbValue = 0; + pfea2list->list[0].fEA = 0; + strcpy(pfea2list->list[0].szName, name); + pfea2list->cbList = sizeof(FEA2LIST) + namelen; + eaop2.fpFEA2List = pfea2list; + + if (path) + { + char npath[CCHMAXPATH + 1]; + char * p; + strncpy(npath, path, CCHMAXPATH); + for (p = npath; *p; p++) + { + if (*p == '/') *p = '\\'; + } + rc = DosSetPathInfo(npath, FIL_QUERYEASIZE, &eaop2, sizeof(eaop2), DSPI_WRTTHRU); + if (rc) + rprintf(FERROR, "* DosSetPathInfo(%s, FIL_QUERYEASIZE) failed with error %u [%s] %s(%d)\n", npath, rc, who_am_i(), __FILE__, __LINE__); // 28 Jul 08 SHL + else if (verbose > 2) + rprintf(FINFO, "uniremovexattr: deleted EA %s from %s [%s] %s(%d)\n", name, path, who_am_i(), __FILE__, __LINE__); // 28 Jul 08 SHL debug + } + else + { + rc = DosSetFileInfo( file, FIL_QUERYEASIZE, &eaop2, sizeof(eaop2)); + if (rc) + rprintf(FERROR, "* DosFileInfo(%u, FIL_QUERYEASIZE) failed with error %u [%s] %s(%d)\n", file, rc, who_am_i(), __FILE__, __LINE__); // 28 Jul 08 SHL + else if (verbose > 2) + rprintf(FINFO, "uniremovexattr: deleted EA %s from handle %d %s(%d)\n", name, file, __FILE__, __LINE__); // 28 Jul 08 SHL debug + } + if (rc) + { + return -1; + } + return 0; +} + +#ifndef XATTR_CREATE +#define XATTR_CREATE 1 +#endif +#ifndef XATTR_REPLACE +#define XATTR_REPLACE 2 +#endif + +int unisetxattr (const char *path, int file, const char *name, const void *value, size_t size, int flags) +{ + int rc, namelen, totalsize; + EAOP2 eaop2 = {0,0,0}; + PFEA2LIST pfea2list = NULL; + char * p; + + if ((!path && !file) || !name || (!value && size)) + { + rprintf(FERROR, "* unisetxattr received bad args [%s] %s(%d)\n", who_am_i(), __FILE__, __LINE__); // 28 Jul 08 SHL + errno = EINVAL; + return -1; + } + namelen = strlen(name); + if (namelen > 0xFF) + { + rprintf(FERROR, "* unisetxattr name len exceeds 255 [%s] %s(%d)\n", who_am_i(), __FILE__, __LINE__); // 28 Jul 08 SHL + errno = EINVAL; + return -1; + } + + if (flags & (XATTR_CREATE | XATTR_REPLACE)) + { + ssize_t esize = unigetxattr(path, file, name, 0, 0); + if (flags & XATTR_CREATE && esize > 0) + { + rprintf(FERROR, "* unisetxattr: create requested with existing EAs [%s] %s(%d)\n", who_am_i(), __FILE__, __LINE__); // 28 Jul 08 SHL + errno = EEXIST; + return -1; + } + if (flags & XATTR_REPLACE && esize < 0) + { + rprintf(FERROR, "* unisetxattr: replace requested with no EAs [%s] %s(%d)\n", who_am_i(), __FILE__, __LINE__); // 28 Jul 08 SHL + errno = ENOATTR; + return -1; + } + } + + totalsize = sizeof(FEA2LIST) + size + namelen + 1; + + pfea2list = (PFEA2LIST)calloc(totalsize, 1); + pfea2list->cbList = totalsize; + pfea2list->list[0].oNextEntryOffset = 0; + pfea2list->list[0].cbName = namelen; + pfea2list->list[0].cbValue = size; + strcpy(pfea2list->list[0].szName, name); + if (value) + { + memcpy(pfea2list->list[0].szName + namelen + 1, value, size); + } + eaop2.fpFEA2List = pfea2list; + + if (path) + { + char npath[CCHMAXPATH + 1] = {0}; + strncpy(npath, path, CCHMAXPATH); + for (p = npath; *p; p++) + { + if (*p == '/') *p = '\\'; + } + rc = DosSetPathInfo(npath, FIL_QUERYEASIZE, &eaop2, sizeof(eaop2), DSPI_WRTTHRU); + if (rc) + rprintf(FERROR, "* DosSetPathInfo(%s, FIL_QUERYEASIZE) failed with error %u [%s] %s(%d)\n", npath, rc, who_am_i(), __FILE__, __LINE__); // 28 Jul 08 SHL + else if (verbose > 2) + rprintf(FINFO, "unisetxattr: set EA %s for %s [%s] %s(%d)\n", name, path, who_am_i(), __FILE__, __LINE__); // 28 Jul 08 SHL debug + } + else + { + rc = DosSetFileInfo( file, FIL_QUERYEASIZE, &eaop2, sizeof(eaop2)); + if (rc) + rprintf(FERROR, "* DosSetFileInfo(%u, FIL_QUERYEASIZE) failed with %u [%s] %s(%d)\n", file, rc, who_am_i(), __FILE__, __LINE__); // 28 Jul 08 SHL + else if (verbose > 2) + rprintf(FINFO, "unisetxattr: set EA %s for handle %d %s(%d)\n", name, file, __FILE__, __LINE__); // 28 Jul 08 SHL debug + } + free(pfea2list); + if (rc) + { + return -1; + } + return 0; +} + #else #error You need to create xattr compatibility functions. diff -r -u -w ../../../sla_dev2_browse/rsync/rsync-3.0.3/lib/sysxattrs.h ./lib/sysxattrs.h --- ../../../sla_dev2_browse/rsync/rsync-3.0.3/lib/sysxattrs.h 2007-04-07 10:22:24.000000000 -0700 +++ ./lib/sysxattrs.h 2008-07-29 18:40:38.000000000 -0700 @@ -19,6 +19,13 @@ int sys_lremovexattr(const char *path, const char *name); ssize_t sys_llistxattr(const char *path, char *list, size_t size); +#ifdef __OS2__ +ssize_t unigetxattr (const char *path, int file, const char *name, void *value, size_t size); +ssize_t unilistxattr (const char *path, int file, char *list, size_t size); +int uniremovexattr (const char *path, int file, const char *name); +int unisetxattr (const char *path, int file, const char *name, const void *value, size_t size, int flags); +#endif + #else /* No xattrs available */ Only in ./lib: sysxattrs.o Only in ./lib: wildmatch.o Only in .: loadparm.o Only in .: log.o Only in .: m_shl diff -r -u -w ../../../sla_dev2_browse/rsync/rsync-3.0.3/main.c ./main.c --- ../../../sla_dev2_browse/rsync/rsync-3.0.3/main.c 2008-05-31 14:51:38.000000000 -0700 +++ ./main.c 2008-09-10 08:25:28.000000000 -0700 @@ -528,6 +528,7 @@ if ((statret = do_stat(dest_path, &st)) == 0) { /* If the destination is a dir, enter it and use mode 1. */ if (S_ISDIR(st.st_mode)) { + // rprintf(FLOG, "* dest_path %s %s(%d)\n", dest_path, __FILE__, __LINE__); // 28 Jul 08 SHL debug if (!change_dir(dest_path, CD_NORMAL)) { rsyserr(FERROR, errno, "change_dir#1 %s failed", full_fname(dest_path)); @@ -588,6 +589,7 @@ dry_run++; } + // rprintf(FLOG, "* dest_path %s %s(%d)\n", dest_path, __FILE__, __LINE__); // 28 Jul 08 SHL debug if (!change_dir(dest_path, dry_run > 1 ? CD_SKIP_CHDIR : CD_NORMAL)) { rsyserr(FERROR, errno, "change_dir#2 %s failed", full_fname(dest_path)); @@ -608,6 +610,7 @@ dest_path = "/"; *cp = '\0'; + // rprintf(FLOG, "* dest_path %s %s(%d)\n", dest_path, __FILE__, __LINE__); // 28 Jul 08 SHL debug if (!change_dir(dest_path, CD_NORMAL)) { rsyserr(FERROR, errno, "change_dir#3 %s failed", full_fname(dest_path)); @@ -701,6 +704,7 @@ } if (!relative_paths) { + // rprintf(FLOG, "* dir %s %s(%d)\n", dir, __FILE__, __LINE__); // 28 Jul 08 SHL debug if (!change_dir(dir, CD_NORMAL)) { rsyserr(FERROR, errno, "change_dir#3 %s failed", full_fname(dir)); @@ -871,6 +875,7 @@ char *dir = argv[0]; argc--; argv++; + // rprintf(FLOG, "* dir %s %s(%d)\n", dir, __FILE__, __LINE__); // 28 Jul 08 SHL debug if (!am_daemon && !change_dir(dir, CD_NORMAL)) { rsyserr(FERROR, errno, "change_dir#4 %s failed", full_fname(dir)); @@ -1441,6 +1446,7 @@ * (implemented by forking "pwd" and reading its output) doesn't * work when there are other child processes. Also, on all systems * that implement getcwd that way "pwd" can't be found after chroot. */ + // rprintf(FLOG, "* %s %s(%d)\n", "(null)", __FILE__, __LINE__); // 28 Jul 08 SHL debug change_dir(NULL, CD_NORMAL); init_flist(); Only in .: main.o Only in .: match.o diff -r -u -w ../../../sla_dev2_browse/rsync/rsync-3.0.3/options.c ./options.c --- ../../../sla_dev2_browse/rsync/rsync-3.0.3/options.c 2008-03-30 08:05:50.000000000 -0700 +++ ./options.c 2008-07-29 17:01:30.000000000 -0700 @@ -51,7 +51,12 @@ int preserve_links = 0; int preserve_hard_links = 0; int preserve_acls = 0; +#ifndef __OS2__ int preserve_xattrs = 0; +#else +/* OS/2 uses Extended attributes extensively - make preserving them the default */ +int preserve_xattrs = 1; +#endif int preserve_perms = 0; int preserve_executability = 0; int preserve_devices = 0; @@ -1033,6 +1038,7 @@ case OPT_EXCLUDE_FROM: case OPT_INCLUDE_FROM: arg = poptGetOptArg(pc); +printf("PS - pc = %s\n",arg); if (sanitize_paths) arg = sanitize_path(NULL, arg, NULL, 0, SP_DEFAULT); if (daemon_filter_list.head) { @@ -2118,7 +2124,11 @@ *host_ptr = new_array(char, hostlen + 1); strlcpy(*host_ptr, s, hostlen + 1); - +#ifdef __EMX__ + if ((p[0] == ':')&&((p[1] == '\\')||(p[1] == '/'))) { + return NULL; + } +#endif if (p[1] == ':') { if (port_ptr && !*port_ptr) *port_ptr = RSYNC_PORT; Only in .: options.o Only in .: params.o Only in .: patch_shl.cmd Only in .: patch_shl.out Only in .: pipe.o Only in ./popt: ctags.tag Only in ./popt: dummy Only in ./popt: findme.o Only in ./popt: popt.o Only in ./popt: poptconfig.o Only in ./popt: popthelp.o Only in ./popt: poptparse.o Only in .: progress.o diff -r -u -w ../../../sla_dev2_browse/rsync/rsync-3.0.3/proto.h ./proto.h --- ../../../sla_dev2_browse/rsync/rsync-3.0.3/proto.h 2008-06-29 20:59:24.000000000 -0700 +++ ./proto.h 2008-09-11 18:51:18.000000000 -0700 @@ -392,4 +392,23 @@ int x_stat(const char *fname, STRUCT_STAT *fst, STRUCT_STAT *xst); int x_lstat(const char *fname, STRUCT_STAT *fst, STRUCT_STAT *xst); int x_fstat(int fd, STRUCT_STAT *fst, STRUCT_STAT *xst); +void free_xattr(stat_x *sxp); +int get_xattr(const char *fname, stat_x *sxp); +int copy_xattrs(const char *source, const char *dest); +int send_xattr(stat_x *sxp, int f); +int xattr_diff(struct file_struct *file, stat_x *sxp, int find_all); +void send_xattr_request(const char *fname, struct file_struct *file, int f_out); +int recv_xattr_request(struct file_struct *file, int f_in); +void receive_xattr(struct file_struct *file, int f); +void cache_xattr(struct file_struct *file, stat_x *sxp); +int set_xattr(const char *fname, const struct file_struct *file, + const char *fnamecmp, stat_x *sxp); +char *get_xattr_acl(const char *fname, int is_access_acl, size_t *len_p); +int set_xattr_acl(const char *fname, int is_access_acl, const char *buf, size_t buf_len); +int del_def_xattr_acl(const char *fname); +int get_stat_xattr(const char *fname, int fd, STRUCT_STAT *fst, STRUCT_STAT *xst); +int set_stat_xattr(const char *fname, struct file_struct *file, mode_t new_mode); +int x_stat(const char *fname, STRUCT_STAT *fst, STRUCT_STAT *xst); +int x_lstat(const char *fname, STRUCT_STAT *fst, STRUCT_STAT *xst); +int x_fstat(int fd, STRUCT_STAT *fst, STRUCT_STAT *xst); int sys_gettimeofday(struct timeval *tv); diff -r -u -w ../../../sla_dev2_browse/rsync/rsync-3.0.3/receiver.c ./receiver.c --- ../../../sla_dev2_browse/rsync/rsync-3.0.3/receiver.c 2008-03-24 10:14:58.000000000 -0700 +++ ./receiver.c 2008-09-11 17:54:06.000000000 -0700 @@ -443,6 +443,8 @@ #ifdef SUPPORT_XATTRS if (iflags & ITEM_REPORT_XATTR && !dry_run) recv_xattr_request(file, f_in); + else if (verbose > 2) + rprintf(FINFO, "recv_files: recv_xattr_request skipped for %s [%s] %s(%d)\n", fname, who_am_i(), __FILE__, __LINE__); // 11 Sep 08 SHL debug #endif if (!(iflags & ITEM_TRANSFER)) { @@ -450,6 +452,8 @@ #ifdef SUPPORT_XATTRS if (preserve_xattrs && iflags & ITEM_REPORT_XATTR && !dry_run) set_file_attrs(fname, file, NULL, fname, 0); + else if (verbose > 2) + rprintf(FINFO, "recv_files: set_file_attrs skipped for %s [%s] %s(%d)\n", fname, who_am_i(), __FILE__, __LINE__); // 11 Sep 08 SHL debug #endif continue; } Only in .: receiver.o Only in .: rounding.exe Only in .: rounding.h Only in .: rounding.map Only in .: rsync-3.0.3-20080729-shl.diff Only in .: rsync-3.0.3-20080911-shl.diff Only in .: rsync-3.0.3pre2-20080729-shl.diff diff -r -u -w ../../../sla_dev2_browse/rsync/rsync-3.0.3/rsync.c ./rsync.c --- ../../../sla_dev2_browse/rsync/rsync-3.0.3/rsync.c 2008-05-22 07:32:10.000000000 -0700 +++ ./rsync.c 2008-09-11 17:54:42.000000000 -0700 @@ -421,6 +421,8 @@ set_stat_xattr(fname, file, new_mode); if (preserve_xattrs && fnamecmp) set_xattr(fname, file, fnamecmp, sxp); + else if (verbose > 2) + rprintf(FINFO, "set_file_attrs: fnamecmp null for %s [%s] %s(%d)\n", fname, who_am_i(), __FILE__, __LINE__); // 09 Sep 08 SHL debug #endif if (!preserve_times || (S_ISDIR(sxp->st.st_mode) && preserve_times == 1)) Only in .: rsync.exe Only in .: rsync.map Only in .: rsync.o diff -r -u -w ../../../sla_dev2_browse/rsync/rsync-3.0.3/sender.c ./sender.c --- ../../../sla_dev2_browse/rsync/rsync-3.0.3/sender.c 2008-03-30 15:44:46.000000000 -0700 +++ ./sender.c 2008-09-11 18:03:50.000000000 -0700 @@ -161,6 +161,8 @@ #ifdef SUPPORT_XATTRS if (preserve_xattrs && iflags & ITEM_REPORT_XATTR && !dry_run) send_xattr_request(fname, file, f_out); + else if (verbose > 2) + rprintf(FINFO, "write_ndx_and_attrs: ITEM_REPORT_XATTR false for %s [%s] %s(%d)\n", fname, who_am_i(), __FILE__, __LINE__); // 09 Sep 08 SHL debug #endif } @@ -231,6 +233,9 @@ #ifdef SUPPORT_XATTRS if (preserve_xattrs && iflags & ITEM_REPORT_XATTR && !dry_run) recv_xattr_request(file, f_in); + else if (verbose > 2) + rprintf(FINFO, "send_files: ITEM_REPORT_XATTR %u for %s [%s] %s(%d)\n", // 10 Sep 08 SHL debug + iflags & ITEM_REPORT_XATTR, fname, who_am_i(), __FILE__, __LINE__); // 10 Sep 08 SHL debug #endif if (!(iflags & ITEM_TRANSFER)) { Only in .: sender.o Only in .: shconfig Only in .: socket.o Only in ./support: ctags.tag Only in .: syscall.o Only in .: token.o Only in .: uidlist.o diff -r -u -w ../../../sla_dev2_browse/rsync/rsync-3.0.3/util.c ./util.c --- ../../../sla_dev2_browse/rsync/rsync-3.0.3/util.c 2008-05-17 09:35:46.000000000 -0700 +++ ./util.c 2008-07-29 17:01:30.000000000 -0700 @@ -191,6 +191,11 @@ char *p; int ret = 0; +#ifdef __OS2__ /* 25 Sep 07 */ + if (*(fname + 1) == ':' && isalpha(*fname)) + fname += 2; /* Bypass drive letter */ +#endif /* __OS2__ */ + while (*fname == '/') fname++; while (strncmp(fname, "./", 2) == 0) @@ -821,6 +826,13 @@ if (!name) return 0; +#ifdef __OS2__ /* 25 Sep 07 SHL */ + if (*(f + 1) == ':' && isalpha(*f)) { + f += 2; // 28 Jul 08 SHL Keep drive letter + t += 2; + } +#endif /* __OS2__ */ + if ((anchored = *f == '/') != 0) *t++ = *f++; else if (flags & CFN_KEEP_DOT_DIRS && *f == '.' && f[1] == '/') { @@ -900,6 +912,15 @@ if (dest != p) { int plen = strlen(p); +#ifdef __OS2__ /* 25 Sep 07 SHL */ + if (*(p + 1) == ':' && isalpha(*p)) { + if (!rootdir) + rootdir = module_dir; + rlen = strlen(rootdir); + depth = 0; + p += 2; /* Bypass drive letter */ + } +#endif if (*p == '/') { if (!rootdir) rootdir = module_dir; @@ -966,6 +987,9 @@ } *sanp = '\0'; +#if 0 + printf("santize_path - dest2 = %s\n",dest); /* 25 Sep 07 SHL */ +#endif return dest; } @@ -977,9 +1001,12 @@ static int initialised; unsigned int len; + // rprintf(FLOG, "* change_dir dir %s %s(%u)\n", dir ? dir : "(null)", __FILE__, __LINE__); // 28 Jul 08 SHL debug + if (!initialised) { initialised = 1; getcwd(curr_dir, sizeof curr_dir - 1); + // rprintf(FLOG, "* change_dir curr_dir %s %s(%u)\n", curr_dir, __FILE__, __LINE__); // 28 Jul 08 SHL debug curr_dir_len = strlen(curr_dir); } @@ -990,15 +1017,37 @@ if (len == 1 && *dir == '.') return 1; +#ifndef __OS2__ if (*dir == '/') { +#else + // 28 Jul 08 SHL fixme to support relative path with drive letter? + if (*(dir + 1) == ':' && isalpha(*dir)) { +#endif + // Absolute path if (len >= sizeof curr_dir) { errno = ENAMETOOLONG; return 0; } +#ifndef __OS2__ // 28 Jul 08 SHL if (!set_path_only && chdir(dir)) return 0; memcpy(curr_dir, dir, len + 1); +#else + if (!set_path_only) { + if (chdir(dir)) { + rprintf(FLOG, "* change_dir: chdir failed for dir %s %s(%u)\n", dir, __FILE__, __LINE__); // 28 Jul 08 SHL debug + return 0; + } + if (_chdrive(*dir)) { + rprintf(FLOG, "* change_dir: _chdrive failed for dir %s %s(%u)\n", dir, __FILE__, __LINE__); // 28 Jul 08 SHL debug + return 0; + } + } + memcpy(curr_dir, dir, len + 1); + // rprintf(FLOG, "* change_dir curr_dir %s %s(%u)\n", curr_dir, __FILE__, __LINE__); // 28 Jul 08 SHL debug +#endif } else { + // Relative path if (curr_dir_len + 1 + len >= sizeof curr_dir) { errno = ENAMETOOLONG; return 0; @@ -1007,6 +1056,7 @@ memcpy(curr_dir + curr_dir_len + 1, dir, len + 1); if (!set_path_only && chdir(curr_dir)) { + rprintf(FLOG, "* change_dir: chdir failed for curr_dir %s %s(%u)\n", dir, __FILE__, __LINE__); // 28 Jul 08 SHL debug curr_dir[curr_dir_len] = '\0'; return 0; } @@ -1041,6 +1091,12 @@ if (*fn == '/') p1 = p2 = ""; +#ifdef __OS2__ /* 25 Sep 07 SHL */ + else if (*(fn + 1) == ':' && + *(fn + 2) == '/' && + isalpha(*fn)) + p1 = p2 = ""; /* Got d:/ */ +#endif else { p1 = curr_dir + module_dirlen; for (p2 = p1; *p2 == '/'; p2++) {} Only in .: util.o Only in .: xattrs-20080911-1800.c diff -r -u -w ../../../sla_dev2_browse/rsync/rsync-3.0.3/xattrs.c ./xattrs.c --- ../../../sla_dev2_browse/rsync/rsync-3.0.3/xattrs.c 2008-06-12 06:59:50.000000000 -0700 +++ ./xattrs.c 2008-09-11 19:54:54.000000000 -0700 @@ -108,6 +108,8 @@ { const rsync_xa *xa1 = x1; const rsync_xa *xa2 = x2; + // rprintf(FINFO, "* rsync_xal_compare_names: xa1.name %p xa2.name %p %s:%u\n", xa1->name, xa2->name, __FILE__, __LINE__); // 28 Jul 08 SHL debug + return strcmp(xa1->name, xa2->name); } @@ -279,6 +281,9 @@ /* Read the xattr(s) for this filename. */ int get_xattr(const char *fname, stat_x *sxp) { + if (verbose > 2) + rprintf(FINFO, "get_xattr: called for %s [%s] %s(%d)\n", fname, who_am_i(), __FILE__, __LINE__); // 07 Sep 08 SHL debug + sxp->xattr = new(item_list); *sxp->xattr = empty_xattr; if (rsync_xal_get(fname, sxp->xattr) < 0) { @@ -297,10 +302,14 @@ int user_only = am_sender ? 0 : !am_root; #endif + // rprintf(FINFO, "copy_xattrs: source %s dest %s [%s] %s(%d)\n", source, dest, who_am_i(), __FILE__, __LINE__); // 07 Sep 08 SHL debug + /* This puts the name list into the "namebuf" buffer. */ if ((list_len = get_xattr_names(source)) < 0) return -1; + // rprintf(FINFO, "copy_xattrs: list_len %u [%s] %s(%d)\n", list_len, who_am_i(), __FILE__, __LINE__); // 07 Sep 08 SHL debug + for (name = namebuf; list_len > 0; name += name_len) { name_len = strlen(name) + 1; list_len -= name_len; @@ -395,6 +404,7 @@ for (rxa = sxp->xattr->items; count--; rxa++) { size_t name_len = rxa->name_len; const char *name = rxa->name; +#ifndef __OS2__ // 11 Sep 08 SHL we don't do namespace prefixes /* Strip the rsync prefix from disguised namespaces. */ if (name_len > RPRE_LEN #ifdef HAVE_LINUX_XATTRS @@ -410,6 +420,7 @@ name_len += UPRE_LEN; } #endif +#endif // __OS2__ write_varint(f, name_len); write_varint(f, rxa->datum_len); #ifndef HAVE_LINUX_XATTRS @@ -418,6 +429,8 @@ name_len -= UPRE_LEN; } #endif + if (verbose > 2) + rprintf(FINFO, "send_xattr: sending EA %.*s [%s] %s(%d)\n", name_len, name, who_am_i(), __FILE__, __LINE__); // 29 Jul 08 SHL debug write_buf(f, name, name_len); if (rxa->datum_len > MAX_FULL_DATUM) write_buf(f, rxa->datum + 1, MAX_DIGEST_LEN); @@ -436,6 +449,8 @@ * need so that send_xattr_request() can tell the sender about them. */ int xattr_diff(struct file_struct *file, stat_x *sxp, int find_all) { + // rprintf(FINFO, "xattr_diff: file %p sxp %p find_all %u [%s] %s(%d)\n", file, sxp, find_all, who_am_i(), __FILE__, __LINE__); // 11 Sep 08 SHL debug + item_list *lst = rsync_xal_l.items; rsync_xa *snd_rxa, *rec_rxa; int snd_cnt, rec_cnt; @@ -449,6 +464,8 @@ rec_cnt = 0; } + // rprintf(FINFO, "xattr_diff: rec_rxa %p rec_cnt %u [%s] %s(%d)\n", rec_rxa, rec_cnt, who_am_i(), __FILE__, __LINE__); // 07 Sep 08 SHL debug + if (F_XATTR(file) >= 0) lst += F_XATTR(file); else @@ -457,6 +474,8 @@ snd_rxa = lst->items; snd_cnt = lst->count; + // rprintf(FINFO, "xattr_diff: snd_rxa %p snd_cnt %u [%s] %s(%d)\n", snd_rxa, snd_cnt, who_am_i(), __FILE__, __LINE__); // 11 Sep 08 SHL debug + /* If the count of the sender's xattrs is different from our * (receiver's) xattrs, the lists are not the same. */ if (snd_cnt != rec_cnt) { @@ -684,6 +703,8 @@ need_sort = 1; } #else +// 11 Sep 08 SHL +#ifndef __OS2__ /* This OS only has a user namespace, so we either * strip the user prefix, or we put a non-user * namespace inside our rsync hierarchy. */ @@ -691,14 +712,28 @@ name += UPRE_LEN; name_len -= UPRE_LEN; } else if (am_root) { + // 11 Sep 08 SHL fixme to understand - assuming rsync namespace? name -= RPRE_LEN; name_len += RPRE_LEN; memcpy(name, RSYNC_PREFIX, RPRE_LEN); - } else { + } else if (UPRE_LEN > 0) { free(ptr); continue; } -#endif +#else // __OS2__ + /* OS/2 does not do namespaces but if we are the + * receiver we strip the user namespace prefix in case + * we are receiving from a Linux system + */ + if (HAS_PREFIX(name, USER_PREFIX)) { + // Strip user namespace prefix + if (verbose > 2) + rprintf(FINFO, "receive_xattr: stripping user prefix from %.*s [%s] %s(%d)\n", name_len, name, who_am_i(), __FILE__, __LINE__); // 11 Sep 08 SHL debug + name += UPRE_LEN; + name_len -= UPRE_LEN; + } +#endif // __OS2__ +#endif // HAVE_LINUX_XATTRS /* No rsync.%FOO attributes are copied w/o 2 -X options. */ if (preserve_xattrs < 2 && name_len > RPRE_LEN && name[RPRE_LEN] == '%' && HAS_PREFIX(name, RSYNC_PREFIX)) { @@ -711,10 +746,13 @@ rxa->name_len = name_len; rxa->datum_len = datum_len; rxa->num = num; + if (verbose > 2) + rprintf(FINFO, "receive_xattr: num %u name %.*s [%s] %s(%d)\n", num, rxa->name_len, rxa->name, who_am_i(), __FILE__, __LINE__); // 11 Sep 08 SHL debug } - if (need_sort && count > 1) - qsort(temp_xattr.items, count, sizeof (rsync_xa), rsync_xal_compare_names); + // 28 Jul 08 SHL correct to sort number used not number malloc'ed + if (need_sort && temp_xattr.count > 1) + qsort(temp_xattr.items, temp_xattr.count, sizeof (rsync_xa), rsync_xal_compare_names); ndx = rsync_xal_l.count; /* pre-incremented count */ rsync_xal_store(&temp_xattr); /* adds item to rsync_xal_l */ Only in .: xattrs.o Only in ./zlib: adler32.o Only in ./zlib: compress.o Only in ./zlib: crc32.o Only in ./zlib: ctags.tag Only in ./zlib: deflate.o Only in ./zlib: dummy Only in ./zlib: inffast.o Only in ./zlib: inflate.o Only in ./zlib: inftrees.o Only in ./zlib: trees.o Only in ./zlib: zutil.o | ||||
Date Modified | Username | Field | Change |
---|---|---|---|
2008-09-12 23:41 | Steven Levine | New Issue | |
2008-09-12 23:41 | Steven Levine | File Added: rsync-3.0.3-20080911-shl.diff | |
2008-09-13 22:21 | psmedley | Project | Other Unix Port => Rsync |
2008-09-13 22:58 | psmedley | Note Added: 0000963 | |
2008-09-13 22:58 | psmedley | Assigned To | => Steven Levine |
2008-09-13 22:58 | psmedley | Status | new => feedback |
2009-05-04 10:39 | psmedley | Status | feedback => resolved |
2009-05-04 10:39 | psmedley | Resolution | open => fixed |
2020-08-24 03:14 | psmedley | Status | resolved => closed |