The Samba-Bugzilla – Attachment 717 Details for
Bug 1900
rsync --daemon hangs with --numeric-ids
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Change option parsing
options.patch (text/plain), 6.65 KB, created by
Wayne Davison
on 2004-10-11 04:01:21 UTC
(
hide
)
Description:
Change option parsing
Filename:
MIME Type:
Creator:
Wayne Davison
Created:
2004-10-11 04:01:21 UTC
Size:
6.65 KB
patch
obsolete
>--- options.c 11 Oct 2004 10:43:25 -0000 1.184 >+++ options.c 11 Oct 2004 10:49:00 -0000 >@@ -289,11 +289,6 @@ void usage(enum logcode F) > rprintf(F," --files-from=FILE read FILE for list of source-file names\n"); > rprintf(F," -0, --from0 all *-from file lists are delimited by nulls\n"); > rprintf(F," --version print version number\n"); >- rprintf(F," --daemon run as an rsync daemon\n"); >- rprintf(F," --no-detach do not detach from the parent\n"); >- rprintf(F," --address=ADDRESS bind to the specified address\n"); >- rprintf(F," --config=FILE specify alternate rsyncd.conf file\n"); >- rprintf(F," --port=PORT specify alternate rsyncd port number\n"); > rprintf(F," --blocking-io use blocking I/O for the remote shell\n"); > rprintf(F," --no-blocking-io turn off --blocking-io\n"); > rprintf(F," --stats give some file transfer stats\n"); >@@ -310,13 +305,12 @@ void usage(enum logcode F) > #endif > rprintf(F," -h, --help show this help screen\n"); > >- rprintf(F,"\n"); >- >- rprintf(F,"\nPlease see the rsync(1) and rsyncd.conf(5) man pages for full documentation\n"); >+ rprintf(F,"\nUse \"rsync --daemon --help\" to see the daemon-mode command-line options.\n"); >+ rprintf(F,"Please see the rsync(1) and rsyncd.conf(5) man pages for full documentation.\n"); > rprintf(F,"See http://rsync.samba.org/ for updates, bug reports, and answers\n"); > } > >-enum {OPT_VERSION = 1000, OPT_SENDER, OPT_EXCLUDE, OPT_EXCLUDE_FROM, >+enum {OPT_VERSION = 1000, OPT_DAEMON, OPT_SENDER, OPT_EXCLUDE, OPT_EXCLUDE_FROM, > OPT_DELETE_AFTER, OPT_DELETE_EXCLUDED, OPT_LINK_DEST, > OPT_INCLUDE, OPT_INCLUDE_FROM, OPT_MODIFY_WINDOW, > OPT_READ_BATCH, OPT_WRITE_BATCH, OPT_TIMEOUT, >@@ -380,8 +374,6 @@ static struct poptOption long_options[] > {"link-dest", 0, POPT_ARG_STRING, &compare_dest, OPT_LINK_DEST, 0, 0 }, > /* TODO: Should this take an optional int giving the compression level? */ > {"compress", 'z', POPT_ARG_NONE, &do_compression, 0, 0, 0 }, >- {"daemon", 0, POPT_ARG_NONE, &daemon_opt, 0, 0, 0 }, >- {"no-detach", 0, POPT_ARG_NONE, &no_detach, 0, 0, 0 }, > {"stats", 0, POPT_ARG_NONE, &do_stats, 0, 0, 0 }, > {"progress", 0, POPT_ARG_NONE, &do_progress, 0, 0, 0 }, > {"partial", 0, POPT_ARG_NONE, &keep_partial, 0, 0, 0 }, >@@ -390,11 +382,8 @@ static struct poptOption long_options[] > {"blocking-io", 0, POPT_ARG_VAL, &blocking_io, 1, 0, 0 }, > {"no-blocking-io", 0, POPT_ARG_VAL, &blocking_io, 0, 0, 0 }, > {0, 'P', POPT_ARG_NONE, 0, 'P', 0, 0 }, >- {"config", 0, POPT_ARG_STRING, &config_file, 0, 0, 0 }, >- {"port", 0, POPT_ARG_INT, &rsync_port, 0, 0, 0 }, > {"log-format", 0, POPT_ARG_STRING, &log_format, 0, 0, 0 }, > {"bwlimit", 0, POPT_ARG_INT, &bwlimit, 0, 0, 0 }, >- {"address", 0, POPT_ARG_STRING, &bind_address, 0, 0, 0 }, > {"backup-dir", 0, POPT_ARG_STRING, &backup_dir, 0, 0, 0 }, > {"hard-links", 'H', POPT_ARG_NONE, &preserve_hard_links, 0, 0, 0 }, > {"read-batch", 0, POPT_ARG_STRING, &batch_name, OPT_READ_BATCH, 0, 0 }, >@@ -408,6 +397,39 @@ static struct poptOption long_options[] > {"ipv4", '4', POPT_ARG_VAL, &default_af_hint, AF_INET, 0, 0 }, > {"ipv6", '6', POPT_ARG_VAL, &default_af_hint, AF_INET6, 0, 0 }, > #endif >+ {"daemon", 0, POPT_ARG_NONE, 0, OPT_DAEMON, 0, 0 }, >+ {"address", 0, POPT_ARG_STRING, 0, OPT_DAEMON, 0, 0 }, >+ {"config", 0, POPT_ARG_STRING, 0, OPT_DAEMON, 0, 0 }, >+ {"no-detach", 0, POPT_ARG_NONE, 0, OPT_DAEMON, 0, 0 }, >+ {"port", 0, POPT_ARG_INT, 0, OPT_DAEMON, 0, 0 }, >+ POPT_TABLEEND >+}; >+ >+static void daemon_usage(enum logcode F) >+{ >+ print_rsync_version(F); >+ >+ rprintf(F,"\nUsage: rsync --daemon [OPTION]...\n"); >+ rprintf(F," --daemon run as an rsync daemon\n"); >+ rprintf(F," --no-detach do not detach from the parent\n"); >+ rprintf(F," --address=ADDRESS bind to the specified address\n"); >+ rprintf(F," --config=FILE specify alternate rsyncd.conf file\n"); >+ rprintf(F," --port=PORT specify alternate rsyncd port number\n"); >+ rprintf(F," -h, --help show this help screen (w/--daemon)\n"); >+ >+ rprintf(F,"\nIf you were not trying to invoke rsync as a daemon, avoid using any of the\n"); >+ rprintf(F,"daemon-specific rsync options. See also the rsyncd.conf(5) man page.\n"); >+} >+ >+static struct poptOption long_daemon_options[] = { >+ /* longName, shortName, argInfo, argPtr, value, descrip, argDesc */ >+ {"daemon", 0, POPT_ARG_NONE, &daemon_opt, 0, 0, 0 }, >+ {"address", 0, POPT_ARG_STRING, &bind_address, 0, 0, 0 }, >+ {"config", 0, POPT_ARG_STRING, &config_file, 0, 0, 0 }, >+ {"no-detach", 0, POPT_ARG_NONE, &no_detach, 0, 0, 0 }, >+ {"port", 0, POPT_ARG_INT, &rsync_port, 0, 0, 0 }, >+ {"server", 0, POPT_ARG_NONE, &am_server, 0, 0, 0 }, >+ {"help", 'h', POPT_ARG_NONE, 0, 'h', 0, 0 }, > POPT_TABLEEND > }; > >@@ -524,6 +546,41 @@ int parse_arguments(int *argc, const cha > print_rsync_version(FINFO); > exit_cleanup(0); > >+ case OPT_DAEMON: >+ if (am_daemon) { >+ strcpy(err_buf, "Attempt to hack rsync thwarted!\n"); >+ return 0; >+ } >+ poptFreeContext(pc); >+ pc = poptGetContext(RSYNC_NAME, *argc, *argv, >+ long_daemon_options, 0); >+ while ((opt = poptGetNextOpt(pc)) != -1) { >+ switch (opt) { >+ case 'h': >+ daemon_usage(FINFO); >+ exit_cleanup(0); >+ >+ default: >+ rprintf(FERROR, >+ "rsync: %s: %s (in daemon mode)\n", >+ poptBadOption(pc, POPT_BADOPTION_NOALIAS), >+ poptStrerror(opt)); >+ goto daemon_error; >+ } >+ } >+ if (!daemon_opt) { >+ rprintf(FERROR, "Daemon option(s) used without --daemon.\n"); >+ daemon_error: >+ rprintf(FERROR, >+ "(Type \"rsync --daemon --help\" for assistance with daemon mode.)\n"); >+ exit_cleanup(RERR_SYNTAX); >+ } >+ *argv = poptGetArgs(pc); >+ *argc = count_args(*argv); >+ daemon_opt = 0; >+ am_daemon = 1; >+ return 1; >+ > case OPT_MODIFY_WINDOW: > /* The value has already been set by popt, but > * we need to remember that we're using a >@@ -767,12 +824,6 @@ int parse_arguments(int *argc, const cha > } > } > >- if (daemon_opt) { >- daemon_opt = 0; >- am_daemon = 1; >- return 1; >- } >- > if (!backup_suffix) > backup_suffix = backup_dir ? "" : BACKUP_SUFFIX; > backup_suffix_len = strlen(backup_suffix);
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Actions:
View
Attachments on
bug 1900
: 717