1 /* install - copy files and set attributes
2 Copyright (C) 89, 90, 91, 1995-2008 Free Software Foundation, Inc.
4 This program is free software: you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation, either version 3 of the License, or
7 (at your option) any later version.
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
14 You should have received a copy of the GNU General Public License
15 along with this program. If not, see <http://www.gnu.org/licenses/>. */
17 /* Written by David MacKenzie <djm@gnu.ai.mit.edu> */
22 #include <sys/types.h>
26 #include <selinux/selinux.h>
29 #include "backupfile.h"
33 #include "filenamecat.h"
34 #include "full-read.h"
35 #include "mkancesdirs.h"
37 #include "modechange.h"
38 #include "prog-fprintf.h"
42 #include "stat-time.h"
46 /* The official name of this program (e.g., no `g' prefix). */
47 #define PROGRAM_NAME "install"
49 #define AUTHORS proper_name ("David MacKenzie")
52 # include <sys/wait.h>
55 static int selinux_enabled = 0;
56 static bool use_default_selinux_context = true;
59 # define endgrent() ((void) 0)
63 # define endpwent() ((void) 0)
67 # define lchown(name, uid, gid) chown (name, uid, gid)
70 #if ! HAVE_MATCHPATHCON_INIT_PREFIX
71 # define matchpathcon_init_prefix(a, p) /* empty */
74 /* Initial number of entries in each hash table entry's table of inodes. */
75 #define INITIAL_HASH_MODULE 100
77 /* Initial number of entries in the inode hash table. */
78 #define INITIAL_ENTRY_TAB_SIZE 70
80 /* Number of bytes of a file to copy at a time. */
81 #define READ_SIZE (32 * 1024)
83 static bool change_timestamps (struct stat const *from_sb, char const *to);
84 static bool change_attributes (char const *name);
85 static bool copy_file (const char *from, const char *to,
86 const struct cp_options *x);
87 static bool install_file_in_file_parents (char const *from, char *to,
88 struct cp_options *x);
89 static bool install_file_in_dir (const char *from, const char *to_dir,
90 const struct cp_options *x);
91 static bool install_file_in_file (const char *from, const char *to,
92 const struct cp_options *x);
93 static void get_ids (void);
94 static void strip (char const *name);
95 static void announce_mkdir (char const *dir, void *options);
96 static int make_ancestor (char const *dir, char const *component,
98 void usage (int status);
100 /* The user name that will own the files, or NULL to make the owner
101 the current user ID. */
102 static char *owner_name;
104 /* The user ID corresponding to `owner_name'. */
105 static uid_t owner_id;
107 /* The group name that will own the files, or NULL to make the group
108 the current group ID. */
109 static char *group_name;
111 /* The group ID corresponding to `group_name'. */
112 static gid_t group_id;
114 #define DEFAULT_MODE (S_IRWXU | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH)
116 /* The file mode bits to which non-directory files will be set. The umask has
118 static mode_t mode = DEFAULT_MODE;
120 /* Similar, but for directories. */
121 static mode_t dir_mode = DEFAULT_MODE;
123 /* The file mode bits that the user cares about. This should be a
124 superset of DIR_MODE and a subset of CHMOD_MODE_BITS. This matters
125 for directories, since otherwise directories may keep their S_ISUID
127 static mode_t dir_mode_bits = CHMOD_MODE_BITS;
129 /* Compare files before installing (-C) */
130 static bool copy_only_if_needed;
132 /* If true, strip executable files after copying them. */
133 static bool strip_files;
135 /* If true, install a directory instead of a regular file. */
138 /* Program used to strip binaries, "strip" is default */
139 static char const *strip_program = "strip";
141 /* For long options that have no equivalent short option, use a
142 non-character as a pseudo short option, starting with CHAR_MAX + 1. */
145 PRESERVE_CONTEXT_OPTION = CHAR_MAX + 1,
149 static struct option const long_options[] =
151 {"backup", optional_argument, NULL, 'b'},
152 {"compare", no_argument, NULL, 'C'},
153 {GETOPT_SELINUX_CONTEXT_OPTION_DECL},
154 {"directory", no_argument, NULL, 'd'},
155 {"group", required_argument, NULL, 'g'},
156 {"mode", required_argument, NULL, 'm'},
157 {"no-target-directory", no_argument, NULL, 'T'},
158 {"owner", required_argument, NULL, 'o'},
159 {"preserve-timestamps", no_argument, NULL, 'p'},
160 {"preserve-context", no_argument, NULL, PRESERVE_CONTEXT_OPTION},
161 /* Continue silent support for --preserve_context until Jan 2008. FIXME-obs
162 After that, FIXME-obs: warn in, say, late 2008, and disable altogether
163 a year or two later. */
164 {"preserve_context", no_argument, NULL, PRESERVE_CONTEXT_OPTION},
165 {"strip", no_argument, NULL, 's'},
166 {"strip-program", required_argument, NULL, STRIP_PROGRAM_OPTION},
167 {"suffix", required_argument, NULL, 'S'},
168 {"target-directory", required_argument, NULL, 't'},
169 {"verbose", no_argument, NULL, 'v'},
170 {GETOPT_HELP_OPTION_DECL},
171 {GETOPT_VERSION_OPTION_DECL},
175 /* Compare content of opened files using file descriptors A_FD and B_FD. Return
176 true if files are equal. */
178 have_same_content (int a_fd, int b_fd)
180 enum { CMP_BLOCK_SIZE = 4096 };
181 static char a_buff[CMP_BLOCK_SIZE];
182 static char b_buff[CMP_BLOCK_SIZE];
185 while (0 < (size = full_read (a_fd, a_buff, sizeof a_buff))) {
186 if (size != full_read (b_fd, b_buff, sizeof b_buff))
189 if (memcmp (a_buff, b_buff, size) != 0)
196 /* Return true for mode with non-permission bits. */
198 extra_mode (mode_t input)
200 const mode_t mask = ~S_IRWXUGO & ~S_IFMT;
204 /* Return true if copy of file SRC_NAME to file DEST_NAME is necessary. */
206 need_copy (const char *src_name, const char *dest_name,
207 const struct cp_options *x)
209 struct stat src_sb, dest_sb;
213 if (extra_mode (mode))
216 /* compare files using stat */
217 if (lstat (src_name, &src_sb) != 0)
220 if (lstat (dest_name, &dest_sb) != 0)
223 if (!S_ISREG (src_sb.st_mode) || !S_ISREG (dest_sb.st_mode)
224 || extra_mode (src_sb.st_mode) || extra_mode (dest_sb.st_mode))
227 if (src_sb.st_size != dest_sb.st_size
228 || (dest_sb.st_mode & CHMOD_MODE_BITS) != mode
229 || dest_sb.st_uid != (owner_id == (uid_t) -1 ? getuid () : owner_id)
230 || dest_sb.st_gid != (group_id == (gid_t) -1 ? getgid () : group_id))
233 /* compare SELinux context if preserving */
234 if (selinux_enabled && x->preserve_security_context)
236 security_context_t file_scontext = NULL;
237 security_context_t to_scontext = NULL;
240 if (getfilecon (src_name, &file_scontext) == -1)
243 if (getfilecon (dest_name, &to_scontext) == -1)
245 freecon (file_scontext);
249 scontext_match = STREQ (file_scontext, to_scontext);
251 freecon (file_scontext);
252 freecon (to_scontext);
257 /* compare files content */
258 src_fd = open (src_name, O_RDONLY);
262 dest_fd = open (dest_name, O_RDONLY);
269 content_match = have_same_content (src_fd, dest_fd);
273 return !content_match;
277 cp_option_init (struct cp_options *x)
279 cp_options_default (x);
280 x->copy_as_regular = true;
281 x->dereference = DEREF_ALWAYS;
282 x->unlink_dest_before_opening = true;
283 x->unlink_dest_after_failed_open = false;
284 x->hard_link = false;
285 x->interactive = I_UNSPECIFIED;
286 x->move_mode = false;
287 x->one_file_system = false;
288 x->preserve_ownership = false;
289 x->preserve_links = false;
290 x->preserve_mode = false;
291 x->preserve_timestamps = false;
292 x->require_preserve = false;
293 x->require_preserve_context = false;
294 x->recursive = false;
295 x->sparse_mode = SPARSE_AUTO;
296 x->symbolic_link = false;
297 x->backup_type = no_backups;
299 /* Create destination files initially writable so we can run strip on them.
300 Although GNU strip works fine on read-only files, some others
303 x->mode = S_IRUSR | S_IWUSR;
304 x->stdin_tty = false;
306 x->open_dangling_dest_symlink = false;
308 x->preserve_security_context = false;
309 x->preserve_xattr = false;
315 #ifdef ENABLE_MATCHPATHCON
316 /* Modify file context to match the specified policy.
317 If an error occurs the file will remain with the default directory
320 setdefaultfilecon (char const *file)
323 security_context_t scontext = NULL;
324 static bool first_call = true;
326 if (selinux_enabled != 1)
328 /* Indicate no context found. */
331 if (lstat (file, &st) != 0)
334 if (first_call && IS_ABSOLUTE_FILE_NAME (file))
336 /* Calling matchpathcon_init_prefix (NULL, "/first_component/")
337 is an optimization to minimize the expense of the following
338 matchpathcon call. Do it only once, just before the first
339 matchpathcon call. We *could* call matchpathcon_fini after
340 the final matchpathcon call, but that's not necessary, since
341 by then we're about to exit, and besides, the buffers it
342 would free are still reachable. */
344 char const *p = file + 1;
348 /* Record final leading slash, for when FILE starts with two or more. */
358 while (*p && !ISSLASH (*p));
360 prefix = malloc (p - p0 + 2);
363 stpcpy (stpncpy (prefix, p0, p - p0), "/");
364 matchpathcon_init_prefix (NULL, prefix);
371 /* If there's an error determining the context, or it has none,
372 return to allow default context */
373 if ((matchpathcon (file, st.st_mode, &scontext) != 0) ||
374 STREQ (scontext, "<<none>>"))
376 if (scontext != NULL)
381 if (lsetfilecon (file, scontext) < 0 && errno != ENOTSUP)
383 _("warning: %s: failed to change context to %s"),
384 quotearg_colon (file), scontext);
391 setdefaultfilecon (char const *file)
397 /* FILE is the last operand of this command. Return true if FILE is a
398 directory. But report an error there is a problem accessing FILE,
399 or if FILE does not exist but would have to refer to an existing
400 directory if it referred to anything at all. */
403 target_directory_operand (char const *file)
405 char const *b = last_component (file);
406 size_t blen = strlen (b);
407 bool looks_like_a_dir = (blen == 0 || ISSLASH (b[blen - 1]));
409 int err = (stat (file, &st) == 0 ? 0 : errno);
410 bool is_a_dir = !err && S_ISDIR (st.st_mode);
411 if (err && err != ENOENT)
412 error (EXIT_FAILURE, err, _("accessing %s"), quote (file));
413 if (is_a_dir < looks_like_a_dir)
414 error (EXIT_FAILURE, err, _("target %s is not a directory"), quote (file));
418 /* Process a command-line file name, for the -d option. */
420 process_dir (char *dir, struct savewd *wd, void *options)
422 return (make_dir_parents (dir, wd,
423 make_ancestor, options,
424 dir_mode, announce_mkdir,
425 dir_mode_bits, owner_id, group_id, false)
431 main (int argc, char **argv)
434 int exit_status = EXIT_SUCCESS;
435 const char *specified_mode = NULL;
436 bool make_backups = false;
437 char *backup_suffix_string;
438 char *version_control_string = NULL;
439 bool mkdir_and_install = false;
441 char const *target_directory = NULL;
442 bool no_target_directory = false;
445 bool strip_program_specified = false;
446 security_context_t scontext = NULL;
447 /* set iff kernel has extra selinux system calls */
448 selinux_enabled = (0 < is_selinux_enabled ());
450 initialize_main (&argc, &argv);
451 set_program_name (argv[0]);
452 setlocale (LC_ALL, "");
453 bindtextdomain (PACKAGE, LOCALEDIR);
454 textdomain (PACKAGE);
456 atexit (close_stdin);
466 /* FIXME: consider not calling getenv for SIMPLE_BACKUP_SUFFIX unless
467 we'll actually use backup_suffix_string. */
468 backup_suffix_string = getenv ("SIMPLE_BACKUP_SUFFIX");
470 while ((optc = getopt_long (argc, argv, "bcCsDdg:m:o:pt:TvS:Z:", long_options,
478 version_control_string = optarg;
483 copy_only_if_needed = true;
488 /* System V fork+wait does not work if SIGCHLD is ignored. */
489 signal (SIGCHLD, SIG_DFL);
492 case STRIP_PROGRAM_OPTION:
493 strip_program = xstrdup (optarg);
494 strip_program_specified = true;
500 mkdir_and_install = true;
509 specified_mode = optarg;
515 x.preserve_timestamps = true;
519 backup_suffix_string = optarg;
522 if (target_directory)
523 error (EXIT_FAILURE, 0,
524 _("multiple target directories specified"));
528 if (stat (optarg, &st) != 0)
529 error (EXIT_FAILURE, errno, _("accessing %s"), quote (optarg));
530 if (! S_ISDIR (st.st_mode))
531 error (EXIT_FAILURE, 0, _("target %s is not a directory"),
534 target_directory = optarg;
537 no_target_directory = true;
540 case PRESERVE_CONTEXT_OPTION:
541 if ( ! selinux_enabled)
543 error (0, 0, _("WARNING: ignoring --preserve-context; "
544 "this kernel is not SELinux-enabled"));
547 x.preserve_security_context = true;
548 use_default_selinux_context = false;
551 if ( ! selinux_enabled)
553 error (0, 0, _("WARNING: ignoring --context (-Z); "
554 "this kernel is not SELinux-enabled"));
558 use_default_selinux_context = false;
560 case_GETOPT_HELP_CHAR;
561 case_GETOPT_VERSION_CHAR (PROGRAM_NAME, AUTHORS);
563 usage (EXIT_FAILURE);
567 /* Check for invalid combinations of arguments. */
568 if (dir_arg & strip_files)
569 error (EXIT_FAILURE, 0,
570 _("the strip option may not be used when installing a directory"));
571 if (dir_arg && target_directory)
572 error (EXIT_FAILURE, 0,
573 _("target directory not allowed when installing a directory"));
575 if (x.preserve_security_context && scontext != NULL)
576 error (EXIT_FAILURE, 0,
577 _("cannot force target context to %s and preserve it"),
580 if (backup_suffix_string)
581 simple_backup_suffix = xstrdup (backup_suffix_string);
583 x.backup_type = (make_backups
584 ? xget_version (_("backup type"),
585 version_control_string)
588 if (scontext && setfscreatecon (scontext) < 0)
589 error (EXIT_FAILURE, errno,
590 _("failed to set default file creation context to %s"),
593 n_files = argc - optind;
594 file = argv + optind;
596 if (n_files <= ! (dir_arg || target_directory))
599 error (0, 0, _("missing file operand"));
601 error (0, 0, _("missing destination file operand after %s"),
603 usage (EXIT_FAILURE);
606 if (no_target_directory)
608 if (target_directory)
609 error (EXIT_FAILURE, 0,
610 _("cannot combine --target-directory (-t) "
611 "and --no-target-directory (-T)"));
614 error (0, 0, _("extra operand %s"), quote (file[2]));
615 usage (EXIT_FAILURE);
618 else if (! (dir_arg || target_directory))
620 if (2 <= n_files && target_directory_operand (file[n_files - 1]))
621 target_directory = file[--n_files];
622 else if (2 < n_files)
623 error (EXIT_FAILURE, 0, _("target %s is not a directory"),
624 quote (file[n_files - 1]));
629 struct mode_change *change = mode_compile (specified_mode);
631 error (EXIT_FAILURE, 0, _("invalid mode %s"), quote (specified_mode));
632 mode = mode_adjust (0, false, 0, change, NULL);
633 dir_mode = mode_adjust (0, true, 0, change, &dir_mode_bits);
637 if (strip_program_specified && !strip_files)
638 error (0, 0, _("WARNING: ignoring --strip-program option as -s option was "
641 if (copy_only_if_needed && x.preserve_timestamps)
643 error (0, 0, _("options --compare (-C) and --preserve-timestamps are "
644 "mutually exclusive"));
645 usage (EXIT_FAILURE);
648 if (copy_only_if_needed && strip_files)
650 error (0, 0, _("options --compare (-C) and --strip are mutually "
652 usage (EXIT_FAILURE);
655 if (copy_only_if_needed && extra_mode (mode))
656 error (0, 0, _("the --compare (-C) option is ignored when you"
657 " specify a mode with non-permission bits"));
662 exit_status = savewd_process_files (n_files, file, process_dir, &x);
665 /* FIXME: it's a little gross that this initialization is
666 required by copy.c::copy. */
669 if (!target_directory)
671 if (! (mkdir_and_install
672 ? install_file_in_file_parents (file[0], file[1], &x)
673 : install_file_in_file (file[0], file[1], &x)))
674 exit_status = EXIT_FAILURE;
680 for (i = 0; i < n_files; i++)
681 if (! install_file_in_dir (file[i], target_directory, &x))
682 exit_status = EXIT_FAILURE;
689 /* Copy file FROM onto file TO, creating any missing parent directories of TO.
690 Return true if successful. */
693 install_file_in_file_parents (char const *from, char *to,
694 struct cp_options *x)
696 bool save_working_directory =
697 ! (IS_ABSOLUTE_FILE_NAME (from) && IS_ABSOLUTE_FILE_NAME (to));
698 int status = EXIT_SUCCESS;
702 if (! save_working_directory)
705 if (mkancesdirs (to, &wd, make_ancestor, x) == -1)
707 error (0, errno, _("cannot create directory %s"), to);
708 status = EXIT_FAILURE;
711 if (save_working_directory)
713 int restore_result = savewd_restore (&wd, status);
714 int restore_errno = errno;
716 if (EXIT_SUCCESS < restore_result)
718 if (restore_result < 0 && status == EXIT_SUCCESS)
720 error (0, restore_errno, _("cannot create directory %s"), to);
725 return (status == EXIT_SUCCESS && install_file_in_file (from, to, x));
728 /* Copy file FROM onto file TO and give TO the appropriate
730 Return true if successful. */
733 install_file_in_file (const char *from, const char *to,
734 const struct cp_options *x)
737 if (x->preserve_timestamps && stat (from, &from_sb) != 0)
739 error (0, errno, _("cannot stat %s"), quote (from));
742 if (! copy_file (from, to, x))
746 if (x->preserve_timestamps && (strip_files || ! S_ISREG (from_sb.st_mode))
747 && ! change_timestamps (&from_sb, to))
749 return change_attributes (to);
752 /* Copy file FROM into directory TO_DIR, keeping its same name,
753 and give the copy the appropriate attributes.
754 Return true if successful. */
757 install_file_in_dir (const char *from, const char *to_dir,
758 const struct cp_options *x)
760 const char *from_base = last_component (from);
761 char *to = file_name_concat (to_dir, from_base, NULL);
762 bool ret = install_file_in_file (from, to, x);
767 /* Copy file FROM onto file TO, creating TO if necessary.
768 Return true if successful. */
771 copy_file (const char *from, const char *to, const struct cp_options *x)
775 if (copy_only_if_needed && !need_copy (from, to, x))
778 /* Allow installing from non-regular files like /dev/null.
779 Charles Karney reported that some Sun version of install allows that
780 and that sendmail's installation process relies on the behavior.
781 However, since !x->recursive, the call to "copy" will fail if FROM
784 return copy (from, to, false, x, ©_into_self, NULL);
787 /* Set the attributes of file or directory NAME.
788 Return true if successful. */
791 change_attributes (char const *name)
794 /* chown must precede chmod because on some systems,
795 chown clears the set[ug]id bits for non-superusers,
796 resulting in incorrect permissions.
797 On System V, users can give away files with chown and then not
798 be able to chmod them. So don't give files away.
800 We don't normally ignore errors from chown because the idea of
801 the install command is that the file is supposed to end up with
802 precisely the attributes that the user specified (or defaulted).
803 If the file doesn't end up with the group they asked for, they'll
806 if (! (owner_id == (uid_t) -1 && group_id == (gid_t) -1)
807 && lchown (name, owner_id, group_id) != 0)
808 error (0, errno, _("cannot change ownership of %s"), quote (name));
809 else if (chmod (name, mode) != 0)
810 error (0, errno, _("cannot change permissions of %s"), quote (name));
814 if (use_default_selinux_context)
815 setdefaultfilecon (name);
820 /* Set the timestamps of file TO to match those of file FROM.
821 Return true if successful. */
824 change_timestamps (struct stat const *from_sb, char const *to)
826 struct timespec timespec[2];
827 timespec[0] = get_stat_atime (from_sb);
828 timespec[1] = get_stat_mtime (from_sb);
830 if (utimens (to, timespec))
832 error (0, errno, _("cannot set time stamps for %s"), quote (to));
838 /* Strip the symbol table from the file NAME.
839 We could dig the magic number out of the file first to
840 determine whether to strip it, but the header files and
841 magic numbers vary so much from system to system that making
842 it portable would be very difficult. Not worth the effort. */
845 strip (char const *name)
853 error (EXIT_FAILURE, errno, _("fork system call failed"));
856 execlp (strip_program, strip_program, name, NULL);
857 error (EXIT_FAILURE, errno, _("cannot run %s"), strip_program);
859 default: /* Parent. */
860 if (waitpid (pid, &status, 0) < 0)
861 error (EXIT_FAILURE, errno, _("waiting for strip"));
862 else if (! WIFEXITED (status) || WEXITSTATUS (status))
863 error (EXIT_FAILURE, 0, _("strip process terminated abnormally"));
868 /* Initialize the user and group ownership of the files to install. */
878 pw = getpwnam (owner_name);
881 unsigned long int tmp;
882 if (xstrtoul (owner_name, NULL, 0, &tmp, NULL) != LONGINT_OK
884 error (EXIT_FAILURE, 0, _("invalid user %s"), quote (owner_name));
888 owner_id = pw->pw_uid;
892 owner_id = (uid_t) -1;
896 gr = getgrnam (group_name);
899 unsigned long int tmp;
900 if (xstrtoul (group_name, NULL, 0, &tmp, NULL) != LONGINT_OK
902 error (EXIT_FAILURE, 0, _("invalid group %s"), quote (group_name));
906 group_id = gr->gr_gid;
910 group_id = (gid_t) -1;
913 /* Report that directory DIR was made, if OPTIONS requests this. */
915 announce_mkdir (char const *dir, void *options)
917 struct cp_options const *x = options;
919 prog_fprintf (stdout, _("creating directory %s"), quote (dir));
922 /* Make ancestor directory DIR, whose last file name component is
923 COMPONENT, with options OPTIONS. Assume the working directory is
924 COMPONENT's parent. */
926 make_ancestor (char const *dir, char const *component, void *options)
928 int r = mkdir (component, DEFAULT_MODE);
930 announce_mkdir (dir, options);
937 if (status != EXIT_SUCCESS)
938 fprintf (stderr, _("Try `%s --help' for more information.\n"),
943 Usage: %s [OPTION]... [-T] SOURCE DEST\n\
944 or: %s [OPTION]... SOURCE... DIRECTORY\n\
945 or: %s [OPTION]... -t DIRECTORY SOURCE...\n\
946 or: %s [OPTION]... -d DIRECTORY...\n\
948 program_name, program_name, program_name, program_name);
951 This install program copies files (often just compiled) into destination\n\
952 locations you choose. If you want to download and install a ready-to-use\n\
953 package on a GNU/Linux system, you should instead be using a package manager\n\
954 like yum(1) or apt-get(1).\n\
956 In the first three forms, copy SOURCE to DEST or multiple SOURCE(s) to\n\
957 the existing DIRECTORY, while setting permission modes and owner/group.\n\
958 In the 4th form, create all components of the given DIRECTORY(ies).\n\
962 Mandatory arguments to long options are mandatory for short options too.\n\
965 --backup[=CONTROL] make a backup of each existing destination file\n\
966 -b like --backup but does not accept an argument\n\
968 -C, --compare compare each pair of source and destination files, and\n\
969 in some cases, do not modify the destination at all\n\
970 -d, --directory treat all arguments as directory names; create all\n\
971 components of the specified directories\n\
974 -D create all leading components of DEST except the last,\n\
975 then copy SOURCE to DEST\n\
976 -g, --group=GROUP set group ownership, instead of process' current group\n\
977 -m, --mode=MODE set permission mode (as in chmod), instead of rwxr-xr-x\n\
978 -o, --owner=OWNER set ownership (super-user only)\n\
981 -p, --preserve-timestamps apply access/modification times of SOURCE files\n\
982 to corresponding destination files\n\
983 -s, --strip strip symbol tables\n\
984 --strip-program=PROGRAM program used to strip binaries\n\
985 -S, --suffix=SUFFIX override the usual backup suffix\n\
986 -t, --target-directory=DIRECTORY copy all SOURCE arguments into DIRECTORY\n\
987 -T, --no-target-directory treat DEST as a normal file\n\
988 -v, --verbose print the name of each directory as it is created\n\
991 --preserve-context preserve SELinux security context\n\
992 -Z, --context=CONTEXT set SELinux security context of files and directories\n\
995 fputs (HELP_OPTION_DESCRIPTION, stdout);
996 fputs (VERSION_OPTION_DESCRIPTION, stdout);
999 The backup suffix is `~', unless set with --suffix or SIMPLE_BACKUP_SUFFIX.\n\
1000 The version control method may be selected via the --backup option or through\n\
1001 the VERSION_CONTROL environment variable. Here are the values:\n\
1005 none, off never make backups (even if --backup is given)\n\
1006 numbered, t make numbered backups\n\
1007 existing, nil numbered if numbered backups exist, simple otherwise\n\
1008 simple, never always make simple backups\n\
1010 emit_bug_reporting_address ();