Subject: Re: bug#21065: Small bug in touch

From: Eric Blake <[email-masked]>
Date: Wed, 15 Jul 2015 09:31:05 -0600

tag 21065 notabug
thanks

On 07/15/2015 07:25 AM, Rickard Norlander wrote:
> touch version 8.23
> 
> Command:
> $ touch -- '-'
> Happens:
> Returns successfully, but no file is created (if file exists, timestamp is
> not updated)

Like many other tools, '-' is special-cased in touch to mean operation
on stdin:

$ touch --help | grep -A1 ' - '
A FILE argument string of - is handled specially and causes touch to
change the times of the file associated with standard output.

So you successfully touched stdin (in your case, /dev/tty).  If you want
to create a file named '-', use 'touch ./-'.

See also this FAQ:
https://www.gnu.org/software/coreutils/faq/coreutils-faq.html#How-do-I-remove-files-that-start-with-a-dash_003f

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