aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--THANKS1
-rw-r--r--doc/cpio.110
-rw-r--r--doc/cpio.texi22
-rw-r--r--src/userspec.c19
4 files changed, 46 insertions, 6 deletions
diff --git a/THANKS b/THANKS
index 4c47877..45b0dfb 100644
--- a/THANKS
+++ b/THANKS
@@ -14,6 +14,7 @@ Brian Mays <brian@debian.org>
14Clint Adams <schizo@debian.org> 14Clint Adams <schizo@debian.org>
15Dmitry V. Levin <ldv@altlinux.org> 15Dmitry V. Levin <ldv@altlinux.org>
16Jim Castleberry <bhg9aha02@sneakemail.com> 16Jim Castleberry <bhg9aha02@sneakemail.com>
17Joshua Briefman <sirgatez@gmail.com>
17Holger Fleischmann <holger_fleischmann@mra.man.de> 18Holger Fleischmann <holger_fleischmann@mra.man.de>
18Ladislav Michnovič <ladislav.michnovic@gmail.com> 19Ladislav Michnovič <ladislav.michnovic@gmail.com>
19Matthew Braithwaite <mab@cnet.com> 20Matthew Braithwaite <mab@cnet.com>
diff --git a/doc/cpio.1 b/doc/cpio.1
index 53f9395..d48d2df 100644
--- a/doc/cpio.1
+++ b/doc/cpio.1
@@ -13,7 +13,7 @@
13.\" 13.\"
14.\" You should have received a copy of the GNU General Public License 14.\" You should have received a copy of the GNU General Public License
15.\" along with GNU cpio. If not, see <http://www.gnu.org/licenses/>. 15.\" along with GNU cpio. If not, see <http://www.gnu.org/licenses/>.
16.TH CPIO 1 "January 29, 2014" "CPIO" "GNU CPIO" 16.TH CPIO 1 "January 30, 2014" "CPIO" "GNU CPIO"
17.SH NAME 17.SH NAME
18cpio \- copy files to and from archives 18cpio \- copy files to and from archives
19.SH SYNOPSIS 19.SH SYNOPSIS
@@ -182,6 +182,14 @@ files differently).
182In copy-in and copy-pass mode, set the ownership of all files created 182In copy-in and copy-pass mode, set the ownership of all files created
183to the specified \fIUSER\fR and/or \fIGROUP\fR. In copy-out mode, 183to the specified \fIUSER\fR and/or \fIGROUP\fR. In copy-out mode,
184store the supplied owner information in the archive. 184store the supplied owner information in the archive.
185
186\fIUSER\fR and \fIGROUP\fR are first looked up in the system user and
187group databases. If not found, \fBcpio\fR checks if they consist of
188decimal digits only and, if so, treats them as numeric UID and GID,
189correspondingly.
190
191To avoid the lookup and ensure that arguments are treated as numeric
192values, prefix them with a plus sign, e.g.: \fB-R +0:+0\fR.
185.TP 193.TP
186.B \-\-quiet 194.B \-\-quiet
187Do not print the number of blocks copied at the end of the run. 195Do not print the number of blocks copied at the end of the run.
diff --git a/doc/cpio.texi b/doc/cpio.texi
index 5a739ab..7c60d5f 100644
--- a/doc/cpio.texi
+++ b/doc/cpio.texi
@@ -295,7 +295,7 @@ Use @var{command} instead of @command{rsh} to access remote archives.
295@item -R 295@item -R
296@itemx --owner=[@var{user}][:.][@var{group}] 296@itemx --owner=[@var{user}][:.][@var{group}]
297Set the ownership of all files created to the specified @var{user} 297Set the ownership of all files created to the specified @var{user}
298and/or @var{group}. 298and/or @var{group}. @xref{owner}.
299@item -v 299@item -v
300@itemx --verbose 300@itemx --verbose
301Verbosely list the files processed. 301Verbosely list the files processed.
@@ -515,7 +515,7 @@ Interactively rename files
515@item -R 515@item -R
516@itemx --owner=[@var{user}][:.][@var{group}] 516@itemx --owner=[@var{user}][:.][@var{group}]
517Set the ownership of all files created to the specified @var{user} 517Set the ownership of all files created to the specified @var{user}
518and/or @var{group}. 518and/or @var{group}. @xref{owner}.
519@item -s 519@item -s
520@itemx --swap-bytes 520@itemx --swap-bytes
521Swap the bytes of each halfword in the files 521Swap the bytes of each halfword in the files
@@ -796,6 +796,7 @@ Run in copy-pass mode.
796[@ref{copy-in}] 796[@ref{copy-in}]
797@*Interactively rename files. 797@*Interactively rename files.
798 798
799@anchor{owner}
799@item -R @var{owner} 800@item -R @var{owner}
800@itemx --owner @var{owner} 801@itemx --owner @var{owner}
801[@ref{copy-in},@ref{copy-out},@ref{copy-pass}] 802[@ref{copy-in},@ref{copy-out},@ref{copy-pass}]
@@ -817,6 +818,23 @@ cpio --owner :users
817@end group 818@end group
818@end smallexample 819@end smallexample
819 820
821The argument parts are first looked up in the system user and
822group databases, correspondingly. If any of them is not found there,
823it is treated as numeric UID or GID, provided that it consists of
824decimal digits only.
825
826To avoid the lookup and ensure that arguments are treated as numeric
827values, prefix them with a plus sign, e.g.:
828
829@smallexample
830@group
831cpio --owner +0
832cpio --owner +0:
833cpio --owner +0:+0
834cpio --owner :+0
835@end group
836@end smallexample
837
820@noindent 838@noindent
821If the group is omitted but the @samp{:} or @samp{.} separator is 839If the group is omitted but the @samp{:} or @samp{.} separator is
822given, as in the second example. the given user's login group will be 840given, as in the second example. the given user's login group will be
diff --git a/src/userspec.c b/src/userspec.c
index 8cffd65..82cfcef 100644
--- a/src/userspec.c
+++ b/src/userspec.c
@@ -108,10 +108,16 @@ parse_user_spec (const char *spec_arg, uid_t *uid, gid_t *gid,
108 108
109 if (u != NULL) 109 if (u != NULL)
110 { 110 {
111 pwd = getpwnam (u); 111 if (*u == '+')
112 if (pwd == NULL)
113 { 112 {
113 pwd = NULL;
114 ++u;
115 }
116 else
117 pwd = getpwnam (u);
114 118
119 if (pwd == NULL)
120 {
115 if (!isnumber_p (u)) 121 if (!isnumber_p (u))
116 error_msg = _("invalid user"); 122 error_msg = _("invalid user");
117 else 123 else
@@ -155,7 +161,14 @@ parse_user_spec (const char *spec_arg, uid_t *uid, gid_t *gid,
155 if (g != NULL && error_msg == NULL) 161 if (g != NULL && error_msg == NULL)
156 { 162 {
157 /* Explicit group. */ 163 /* Explicit group. */
158 grp = getgrnam (g); 164 if (*g == '+')
165 {
166 grp = NULL;
167 ++g;
168 }
169 else
170 grp = getgrnam (g);
171
159 if (grp == NULL) 172 if (grp == NULL)
160 { 173 {
161 if (!isnumber_p (g)) 174 if (!isnumber_p (g))

Return to:

Send suggestions and report system problems to the System administrator.