bug-coreutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#24599: Cannot process files named -


From: Eric Blake
Subject: bug#24599: Cannot process files named -
Date: Mon, 3 Oct 2016 14:39:06 -0500
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.3.0

tag 24599 notabug
thanks

On 10/03/2016 01:12 PM, João Miguel wrote:
> Good afternoon,
> 
> As I was trying to reimplement the coreutils in Haskell (for fun :D), I
> noticed that many commands (such as "cat -- -") will disregard the --
> and try to read the stdin.

Generally because that is the behavior required by POSIX.

> 
> I initially thought this was not a bug (found no report about this in
> these mailing lists while searching for «file named ""-""»), but it
> works as expected with vi ("vi -" tries to read stdin, "vi -- -" edits
> the file named -).

Arguably a bug in vi.  But this is not the vi list, so hard to make that
call here.

If you WANT to read a file named '-' in the current directory, you can
ALWAYS use './-'.  Therefore, special-casing whether a lone '-' appeared
before or after the '--' end-of-options designator, when getopt() does
NOT treat plain "-" as an option in the first place, is not worth the
hassle.

I have no idea if the Haskell mapping of getopt() functionality makes
this easier or harder for your task at hand, but I can state that the
behavior in coreutils is intentional and not a bug.

> Hoping you can reply soon (not subscribed),

It's list policy to reply-to-all, precisely so you do not have to subscribe.

At any rate, since the behavior is intentional, and complies with POSIX,
I'm marking this as not a bug.  However, feel free to add further
comments or questions to the thread.

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

Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]