GNU bug report logs - #23213
cp command with -P option odd behavior over ssh

Previous Next

Package: coreutils;

Reported by: Kousik Mandal <kousikmandal <at> gmail.com>

Date: Mon, 4 Apr 2016 11:14:02 UTC

Severity: normal

Done: Paul Eggert <eggert <at> cs.ucla.edu>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 23213 in the body.
You can then email your comments to 23213 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-coreutils <at> gnu.org:
bug#23213; Package coreutils. (Mon, 04 Apr 2016 11:14:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Kousik Mandal <kousikmandal <at> gmail.com>:
New bug report received and forwarded. Copy sent to bug-coreutils <at> gnu.org. (Mon, 04 Apr 2016 11:14:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Kousik Mandal <kousikmandal <at> gmail.com>
To: bug-coreutils <at> gnu.org
Subject: cp command with -P option odd behavior over ssh
Date: Mon, 4 Apr 2016 16:42:57 +0530
[Message part 1 (text/plain, inline)]
Hi Team,

In Linux system, I have created /tmp/123 directory.
---snip---
mkdir -p /tmp/123
---snip---

/tmp/4576 is a non existent directory, now I am executing following cp
command
---snip---
cp -vPprf /tmp/123 /tmp/4576
`/tmp/123' -> `/tmp/4576'


ls /tmp/4576
123
---snip---

So above command is successfully copied directory 123 under /tmp/4576

Now I am trying to execute the same command over ssh

----snip---
[user1 <at> test~]$ ssh user1 <at> testsh -c  'cp -vPprf /tmp/123 /tmp/4576'
user1 <at> test's password:
cp: missing file arguments
Try `cp --help' for more information.
----snip---

but it's always failing. I have tried the same command on multiple Linux
system and found same failure.

Can you please help me why it's failing?
Is it a bug with cp -P option?
Are there any workaround mean any kind of configuration change is needed to
get it work?

Thanks,
Kousik
[Message part 2 (text/html, inline)]

Reply sent to Paul Eggert <eggert <at> cs.ucla.edu>:
You have taken responsibility. (Mon, 04 Apr 2016 14:58:01 GMT) Full text and rfc822 format available.

Notification sent to Kousik Mandal <kousikmandal <at> gmail.com>:
bug acknowledged by developer. (Mon, 04 Apr 2016 14:58:02 GMT) Full text and rfc822 format available.

Message #10 received at 23213-done <at> debbugs.gnu.org (full text, mbox):

From: Paul Eggert <eggert <at> cs.ucla.edu>
To: Kousik Mandal <kousikmandal <at> gmail.com>, 23213-done <at> debbugs.gnu.org
Subject: Re: bug#23213: cp command with -P option odd behavior over ssh
Date: Mon, 4 Apr 2016 07:57:40 -0700
On 04/04/2016 04:12 AM, Kousik Mandal wrote:
> [user1 <at> test~]$ ssh user1 <at> testsh -c  'cp -vPprf /tmp/123 /tmp/4576'

ssh -c takes a cipher-spec as an operand, not a command.




Information forwarded to bug-coreutils <at> gnu.org:
bug#23213; Package coreutils. (Mon, 04 Apr 2016 16:42:01 GMT) Full text and rfc822 format available.

Message #13 received at 23213 <at> debbugs.gnu.org (full text, mbox):

From: Kousik Mandal <kousikmandal <at> gmail.com>
To: 23213 <at> debbugs.gnu.org
Subject: More observation on cp command option
Date: Mon, 4 Apr 2016 22:11:14 +0530
[Message part 1 (text/plain, inline)]
Hi Team,

Last time in my email one space was missing and that lead to confusion I
guess. I am very sorry for typo.

The cp command I tried to execute over ssh

----snip---
[user1 <at> test ~]$ *ssh user1 <at> test       sh -c  'cp -vPprf /tmp/123 /tmp/4576'*
user1 <at> test's password:
cp: missing file arguments
Try `cp --help' for more information.
----snip---
last time by mistake I missed space between ssh user1 <at> test and sh -c  'cp
-vPprf /tmp/123 /tmp/4576'

but it's always failing. I have tried the same command on multiple Linux
system and found same failure.


I dig into further following are the observations

---snip---
[user1 <at> test ~]$
*which cp/bin/cp*

[user1 <at> test ~]$
*cp --versioncp (GNU coreutils) 5.97*
Copyright (C) 2006 Free Software Foundation, Inc.
This is free software.  You may redistribute copies of it under the terms of
the GNU General Public License <http://www.gnu.org/licenses/gpl.html>.
There is NO WARRANTY, to the extent permitted by law.

Written by Torbjorn Granlund, David MacKenzie, and Jim Meyering.
---snip---

Then I execute
[user1 <at> test ~]$ *ssh user1 <at> test sh -c  "'which cp; cp -vPprf /tmp/123
/tmp/4576'"*
user1 <at> test's password:
*/usr/local/bin/cp*
cp: Warning: the meaning of `-P' will change in the future to conform to
POSIX.
Use `--parents' for the old meaning, and `--no-dereference' for the new one.
/tmp -> /tmp/4576/tmp
`/tmp/123' -> `/tmp/4576/tmp/123'


[user1 <at> test ~]$* /usr/local/bin/cp --version*
cp (fileutils) 4.1
Written by Torbjorn Granlund, David MacKenzie, and Jim Meyering.

Copyright (C) 2001 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.


So from the above observation it's very clear the problem is while trying
to execute cp command over ssh then it's taking */usr/local/bin/cp *instead
of
*/bin/cp *which is causing the problem.


But in *PATH *env variable */bin* is preceding */usr/local/bin *
[user1 <at> test ~]$ *echo $PATH*
/usr/lib64/qt-3.3/bin:/usr/kerberos/bin:*/bin*
:/usr/bin:/usr/dev_infra/platform/bin:/usr/dev_infra/generic/bin:
*/usr/local/bin*:/usr/X11R6/bin:/usr/local/ade/bin:/scratch/user1/bin

Even I checked in over ssh in PATH /bin appearing before /usr/local/bin
[user1 <at> test ~]$ *ssh user1 <at> test   sh -c  "'echo $PATH; which cp; cp -vPprf
/tmp/123 /tmp/4576'"*
user1 <at> test's password:
/usr/lib64/qt-3.3/bin:/usr/kerberos/bin:*/bin*
:/usr/bin:/usr/dev_infra/platform/bin:/usr/dev_infra/generic/bin:
*/usr/local/bin*:/usr/X11R6/bin:/usr/local/ade/bin:/scratch/user1/bin
*/usr/local/bin/cp*
cp: Warning: the meaning of `-P' will change in the future to conform to
POSIX.
Use `--parents' for the old meaning, and `--no-dereference' for the new one.


Can you please give me any pointer why over ssh cp command is taking
*/usr/local/bin
*specific executable rather than* /bin* specific executable?

Is there any way to force the cp command to take /bin specific executable
over ssh?

Thanks in advance.

Best Regards,
Kousik
[Message part 2 (text/html, inline)]

Information forwarded to bug-coreutils <at> gnu.org:
bug#23213; Package coreutils. (Mon, 04 Apr 2016 16:59:02 GMT) Full text and rfc822 format available.

Message #16 received at 23213 <at> debbugs.gnu.org (full text, mbox):

From: Kousik Mandal <kousikmandal <at> gmail.com>
To: help-debbugs <at> gnu.org, 23213 <at> debbugs.gnu.org
Subject: Fwd: More observation on cp command option
Date: Mon, 4 Apr 2016 22:28:31 +0530
[Message part 1 (text/plain, inline)]
Hi Team,

Last time in my email one space was missing and that lead to confusion I
guess. I am very sorry for typo.

The cp command I tried to execute over ssh

----snip---
[user1 <at> test ~]$ *ssh user1 <at> test       sh -c  'cp -vPprf /tmp/123 /tmp/4576'*
user1 <at> test's password:
cp: missing file arguments
Try `cp --help' for more information.
----snip---
last time by mistake I missed space between ssh user1 <at> test and sh -c  'cp
-vPprf /tmp/123 /tmp/4576'

but it's always failing. I have tried the same command on multiple Linux
system and found same failure.


I dig into further following are the observations

---snip---
[user1 <at> test ~]$
*which cp/bin/cp*

[user1 <at> test ~]$
*cp --versioncp (GNU coreutils) 5.97*
Copyright (C) 2006 Free Software Foundation, Inc.
This is free software.  You may redistribute copies of it under the terms of
the GNU General Public License <http://www.gnu.org/licenses/gpl.html>.
There is NO WARRANTY, to the extent permitted by law.

Written by Torbjorn Granlund, David MacKenzie, and Jim Meyering.
---snip---

Then I execute
[user1 <at> test ~]$ *ssh user1 <at> test sh -c  "'which cp; cp -vPprf /tmp/123
/tmp/4576'"*
user1 <at> test's password:
*/usr/local/bin/cp*
cp: Warning: the meaning of `-P' will change in the future to conform to
POSIX.
Use `--parents' for the old meaning, and `--no-dereference' for the new one.
/tmp -> /tmp/4576/tmp
`/tmp/123' -> `/tmp/4576/tmp/123'


[user1 <at> test ~]$* /usr/local/bin/cp --version*
cp (fileutils) 4.1
Written by Torbjorn Granlund, David MacKenzie, and Jim Meyering.

Copyright (C) 2001 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.


So from the above observation it's very clear the problem is while trying
to execute cp command over ssh then it's taking */usr/local/bin/cp *instead
of
*/bin/cp *which is causing the problem.


But in *PATH *env variable */bin* is preceding */usr/local/bin *
[user1 <at> test ~]$ *echo $PATH*
/usr/lib64/qt-3.3/bin:/usr/kerberos/bin:*/bin*
:/usr/bin:/usr/dev_infra/platform/bin:/usr/dev_infra/generic/bin:
*/usr/local/bin*:/usr/X11R6/bin:/usr/local/ade/bin:/scratch/user1/bin

Even I checked in over ssh in PATH /bin appearing before /usr/local/bin
[user1 <at> test ~]$ *ssh user1 <at> test   sh -c  "'echo $PATH; which cp; cp -vPprf
/tmp/123 /tmp/4576'"*
user1 <at> test's password:
/usr/lib64/qt-3.3/bin:/usr/kerberos/bin:*/bin*
:/usr/bin:/usr/dev_infra/platform/bin:/usr/dev_infra/generic/bin:
*/usr/local/bin*:/usr/X11R6/bin:/usr/local/ade/bin:/scratch/user1/bin
*/usr/local/bin/cp*
cp: Warning: the meaning of `-P' will change in the future to conform to
POSIX.
Use `--parents' for the old meaning, and `--no-dereference' for the new one.


Can you please give me any pointer why over ssh cp command is taking
*/usr/local/bin
*specific executable rather than* /bin* specific executable?

Is there any way to force the cp command to take /bin specific executable
over ssh?

Thanks in advance.

Best Regards,
Kousik
[Message part 2 (text/html, inline)]

Information forwarded to bug-coreutils <at> gnu.org:
bug#23213; Package coreutils. (Mon, 04 Apr 2016 17:05:02 GMT) Full text and rfc822 format available.

Message #19 received at 23213 <at> debbugs.gnu.org (full text, mbox):

From: Paul Eggert <eggert <at> cs.ucla.edu>
To: Kousik Mandal <kousikmandal <at> gmail.com>, 23213 <at> debbugs.gnu.org
Subject: Re: bug#23213: More observation on cp command option
Date: Mon, 4 Apr 2016 10:04:24 -0700
This is really a question about ssh, not about coreutils, so I suggest 
bringing this up in an ssh format. That being said, try debugging your 
problem with 'sh -xc' instead of plain 'sh -c'. You'll find that the 
problem is not with 'cp'.




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Tue, 03 May 2016 11:24:03 GMT) Full text and rfc822 format available.

This bug report was last modified 9 years and 45 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.