GNU bug report logs - #17618
ls -l dangerous when listing links

Previous Next

Package: coreutils;

Reported by: Michał Adamczyk <szemkel <at> owce.org>

Date: Wed, 28 May 2014 15:31:04 UTC

Severity: normal

Tags: notabug, wontfix

Done: Pádraig Brady <P <at> draigBrady.com>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Michał Adamczyk <szemkel <at> owce.org>
To: 17618 <at> debbugs.gnu.org
Subject: bug#17618: ls -l dangerous when listing links
Date: Wed, 28 May 2014 15:36:09 +0200
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

Pretty cool, huh?
However, if you select this line and accidentally hit right mouse 
button, it'll get copied to your prompt. And if you select more than one 
line, it'll get copied with \n which will get interpreted as if you 
pushed the Enter.

So the whole line gets interpreted as a command:
lrwxrwxrwx [no such command] 1 user group 30 1980-01-01 00:01 link_name 
- [parameters for non-existing command] > /path/to/destination/file 
[redirect output to that 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.


Cheers,

Mike




This bug report was last modified 11 years ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.