[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#23213: Fwd: More observation on cp command option
From: |
Kousik Mandal |
Subject: |
bug#23213: Fwd: More observation on cp command option |
Date: |
Mon, 4 Apr 2016 22:28:31 +0530 |
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---
address@hidden ~]$ *ssh address@hidden sh -c 'cp -vPprf /tmp/123
/tmp/4576'*
address@hidden's password:
cp: missing file arguments
Try `cp --help' for more information.
----snip---
last time by mistake I missed space between ssh address@hidden 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---
address@hidden ~]$
*which cp/bin/cp*
address@hidden ~]$
*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
address@hidden ~]$ *ssh address@hidden sh -c "'which cp; cp -vPprf /tmp/123
/tmp/4576'"*
address@hidden'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'
address@hidden ~]$* /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 *
address@hidden ~]$ *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
address@hidden ~]$ *ssh address@hidden sh -c "'echo $PATH; which cp; cp
-vPprf
/tmp/123 /tmp/4576'"*
address@hidden'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