bug-coreutils
[Top][All Lists]
Advanced

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

bug#17618: ls -l dangerous when listing links


From: Eric Blake
Subject: bug#17618: ls -l dangerous when listing links
Date: Wed, 28 May 2014 09:46:10 -0600
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.5.0

tag 17618 wontfix
thanks

On 05/28/2014 07:36 AM, Michał Adamczyk wrote:
> Call it a bug or call it a feature. It is dangerous though.
> 
> When using `ls -l` to list a directory with links in it, it will produce
> an output similar to this:
> 
> lrwxrwxrwx 1 user group 30 1980-01-01 00:01 link_name ->
> /path/to/destination/file

> 
> Since the output is empty, you'll get the target of that link
> overwritten with an empty file.
> 
> My suggestion is to change the representation symbols of link to
> something that won't get interpreted.

The use of "->" is required by POSIX:
http://pubs.opengroup.org/onlinepubs/9699919799/utilities/ls.html

>> If the file is a symbolic link and the -L option is not specified, this 
>> information shall be about the link itself and the <pathname> field shall be 
>> of the form:
>> 
>> "%s -> %s", <pathname of link>, <contents of link>
>> 

So we can't change it unless we add a NEW option; but adding a new
option means that it won't be available by default.

There have been suggestions in the past about using a UTF-8 arrow, but
they have similarly been rejected.  Sorry.

I'm closing this report, because we can't do anything about it; but feel
free to add further comments.


-- 
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]