public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
* Cp can't hardlink unqualified wildcard
@ 2012-10-20 18:51 Lawrence Mayer
  2012-10-20 19:35 ` Eric Blake
  0 siblings, 1 reply; 4+ messages in thread
From: Lawrence Mayer @ 2012-10-20 18:51 UTC (permalink / raw)
  To: cygwin

Cp can't hardlink unqualified wildcard

cp -l * DIRECTORY

fails with error 'cp: target `file' is not a directory'

But the equivalent

cp -l ./* DIRECTORY

AND

cp -l PATH OF WORKING DIRECTORY/* DIRECTORY

both appear to work fine.


--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Cp can't hardlink unqualified wildcard
  2012-10-20 18:51 Cp can't hardlink unqualified wildcard Lawrence Mayer
@ 2012-10-20 19:35 ` Eric Blake
  2012-10-20 20:35   ` Lawrence Mayer
  0 siblings, 1 reply; 4+ messages in thread
From: Eric Blake @ 2012-10-20 19:35 UTC (permalink / raw)
  To: cygwin

[-- Attachment #1: Type: text/plain, Size: 1067 bytes --]

On 10/20/2012 12:50 PM, Lawrence Mayer wrote:
> Cp can't hardlink unqualified wildcard
> 
> cp -l * DIRECTORY
> 
> fails with error 'cp: target `file' is not a directory'

Most likely, this is not an error in cp, but a misunderstanding on your
part about how globbing operates.  I bet you have a file in your current
directory whose name starts with '-', and is thus being treated as an
option by cp.

> 
> But the equivalent
> 
> cp -l ./* DIRECTORY

No, that's not quite equivalent - it guarantees that the glob won't be
mis-handled as an option.  Likewise,

cp -l -- * DIRECTORY

will avoid treating the glob as an option.  Not only that, but this is a
FAQ:
https://www.gnu.org/software/coreutils/faq/#I-have-a-file-_0027_002df_0027-and-it-affects-rm_002e

> 
> AND
> 
> cp -l PATH OF WORKING DIRECTORY/* DIRECTORY

Sorry, but that's not what you typed.  It helps to show actual examples
when claiming you have a bug.


-- 
Eric Blake   eblake@redhat.com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 617 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Cp can't hardlink unqualified wildcard
  2012-10-20 19:35 ` Eric Blake
@ 2012-10-20 20:35   ` Lawrence Mayer
  2012-10-20 21:34     ` Eric Blake
  0 siblings, 1 reply; 4+ messages in thread
From: Lawrence Mayer @ 2012-10-20 20:35 UTC (permalink / raw)
  To: cygwin

On 121020 12:35, Eric Blake wrote:
> On 10/20/2012 12:50 PM, Lawrence Mayer wrote:
>> Cp can't hardlink unqualified wildcard
>>
>> cp -l * DIRECTORY
>>
>> fails with error 'cp: target `file' is not a directory'
>
> Most likely, this is not an error in cp, but a misunderstanding on your
> part about how globbing operates.  I bet you have a file in your current
> directory whose name starts with '-', and is thus being treated as an
> option by cp.

Wrong guess. No file starting with '-'.

Larry


--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Cp can't hardlink unqualified wildcard
  2012-10-20 20:35   ` Lawrence Mayer
@ 2012-10-20 21:34     ` Eric Blake
  0 siblings, 0 replies; 4+ messages in thread
From: Eric Blake @ 2012-10-20 21:34 UTC (permalink / raw)
  To: cygwin

[-- Attachment #1: Type: text/plain, Size: 1297 bytes --]

On 10/20/2012 02:34 PM, Lawrence Mayer wrote:
> On 121020 12:35, Eric Blake wrote:
>> On 10/20/2012 12:50 PM, Lawrence Mayer wrote:
>>> Cp can't hardlink unqualified wildcard
>>>
>>> cp -l * DIRECTORY
>>>
>>> fails with error 'cp: target `file' is not a directory'
>>
>> Most likely, this is not an error in cp, but a misunderstanding on your
>> part about how globbing operates.  I bet you have a file in your current
>> directory whose name starts with '-', and is thus being treated as an
>> option by cp.
> 
> Wrong guess. No file starting with '-'.

Still, your bug report is lousy.  There is no mention of the name 'file'
in the sample command line you provided, so the error message you
reported does not match up to the command line that you reportedly used.
 Without seeing the exact problem, we can only guess at what you are
doing wrong.  Please provide an exact transcript of what you typed and
the error you got, as well as enough context that we can reproduce the
problem.  Also, please show what 'echo cp -l * DIRECTORY' (or whatever
the EXACT command is that you are typing, prepended by echo), so that we
can see that the glob is expanding to.

-- 
Eric Blake   eblake@redhat.com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 617 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2012-10-20 21:34 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-10-20 18:51 Cp can't hardlink unqualified wildcard Lawrence Mayer
2012-10-20 19:35 ` Eric Blake
2012-10-20 20:35   ` Lawrence Mayer
2012-10-20 21:34     ` Eric Blake

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).