View Issue Details

IDProjectCategoryView StatusLast Update
0015440CentOS-7-OTHERpublic2018-11-05 11:45
Status closedResolutionwon't fix 
Product Version 
Target VersionFixed in Version 
Summary0015440: cp command does not fail whenever only one parameter is given
DescriptionIf two files with same prefix exist and the copy command is launched with the prefix*:
cp filename* copies filename1 into filename2 instead of returning an error saying that two arguments are requiered to proceed.
Steps To Reproduce1/ create two files with same prefix:
touch filename1 filename2

2/ fill the first with any content:
echo "any content" >> filename1

3/ do a strange copy:
cp filename*

4/ notice the bug:
cat filename2
any content
TagsNo tags attached.




2018-11-05 11:45

manager   ~0033081

This is working as designed. You're using a shell (probably bash) that does wildcard expansion so when you enter `cp filename*` bash expands that to the list of files in the current directory that match the pattern filename* and then it passes those to cp. Sp cp gets both filenames and does the wrong thing. This is not a bug, it's working as expected.

Issue History

Date Modified Username Field Change
2018-11-05 11:41 fab9k1 New Issue
2018-11-05 11:45 TrevorH Status new => closed
2018-11-05 11:45 TrevorH Resolution open => won't fix
2018-11-05 11:45 TrevorH Note Added: 0033081