FreeBSD Bugzilla – Attachment 224339 Details for
Bug 199466
cp(1) should accept -P without -R as well per POSIX.1-2008 or like GNU cp
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
cp(1): Make -P work independantly of -R
0001-cp-1-Make-P-work-without-R-as-per-POSIX.patch (text/plain), 2.05 KB, created by
Cameron Katri
on 2021-04-21 19:28:55 UTC
(
hide
)
Description:
cp(1): Make -P work independantly of -R
Filename:
MIME Type:
Creator:
Cameron Katri
Created:
2021-04-21 19:28:55 UTC
Size:
2.05 KB
patch
obsolete
>From 2b453c700d55e46eee08d906f30dba3bb071983c Mon Sep 17 00:00:00 2001 >From: Cameron Katri <me@cameronkatri.com> >Date: Wed, 21 Apr 2021 15:04:22 -0400 >Subject: [PATCH] cp(1): Make -P work without -R (as per POSIX) > >--- > bin/cp/cp.1 | 4 ++-- > bin/cp/cp.c | 16 ++++++++++------ > 2 files changed, 12 insertions(+), 8 deletions(-) > >diff --git a/bin/cp/cp.1 b/bin/cp/cp.1 >index f7e2d639def..993b2c7d9f1 100644 >--- a/bin/cp/cp.1 >+++ b/bin/cp/cp.1 >@@ -84,10 +84,10 @@ If the > .Fl R > option is specified, all symbolic links are followed. > .It Fl P >+No symbolic links are followed. > If the > .Fl R >-option is specified, no symbolic links are followed. >-This is the default. >+option is specified, this is the default. > .It Fl R > If > .Ar source_file >diff --git a/bin/cp/cp.c b/bin/cp/cp.c >index 3a23394df35..d1612003542 100644 >--- a/bin/cp/cp.c >+++ b/bin/cp/cp.c >@@ -99,7 +99,7 @@ main(int argc, char *argv[]) > { > struct stat to_stat, tmp_stat; > enum op type; >- int Hflag, Lflag, ch, fts_options, r, have_trailing_slash; >+ int Hflag, Lflag, Pflag, ch, fts_options, r, have_trailing_slash; > char *target; > > fts_options = FTS_NOCHDIR | FTS_PHYSICAL; >@@ -108,13 +108,14 @@ main(int argc, char *argv[]) > switch (ch) { > case 'H': > Hflag = 1; >- Lflag = 0; >+ Lflag = Pflag = 0; > break; > case 'L': > Lflag = 1; >- Hflag = 0; >+ Hflag = Pflag = 0; > break; > case 'P': >+ Pflag = 1; > Hflag = Lflag = 0; > break; > case 'R': >@@ -123,6 +124,7 @@ main(int argc, char *argv[]) > case 'a': > pflag = 1; > Rflag = 1; >+ Pflag = 1; > Hflag = Lflag = 0; > break; > case 'f': >@@ -145,7 +147,7 @@ main(int argc, char *argv[]) > break; > case 'r': > rflag = Lflag = 1; >- Hflag = 0; >+ Hflag = Pflag = 0; > break; > case 's': > sflag = 1; >@@ -180,8 +182,10 @@ main(int argc, char *argv[]) > fts_options |= FTS_LOGICAL; > } > } else { >- fts_options &= ~FTS_PHYSICAL; >- fts_options |= FTS_LOGICAL | FTS_COMFOLLOW; >+ if (!Pflag) { >+ fts_options &= ~FTS_PHYSICAL; >+ fts_options |= FTS_LOGICAL | FTS_COMFOLLOW; >+ } > } > (void)signal(SIGINFO, siginfo); > >-- >2.31.1 >
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 Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 199466
: 224339