Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 76273 - ls has severe issues dealing with files named ----*****
Summary: ls has severe issues dealing with files named ----*****
Status: RESOLVED INVALID
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Core system (show other bugs)
Hardware: All Linux
: High normal (vote)
Assignee: Gentoo Linux bug wranglers
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-12-31 18:17 UTC by Andrew Luecke
Modified: 2004-12-31 18:25 UTC (History)
0 users

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Andrew Luecke 2004-12-31 18:17:17 UTC
When a file starts off with --, it is unable to cope with wildcards.. For instance.. 

edit a file named ----gfhgfh with any text editing tool.. then do ls * in that dir..

ls *
ls: unrecognized option `-----gfhgfh'

ls however works, so my feeling is that it is being dealt with in the code, but in the wrong place.. I can help develop a patch if needed.. 

it should also be strongly noted that to the best of my knowledge, I dont think tools like rm are capable of deleting such files easily either, which on servers could allow l33t haxors to create directories like this and make people be unable to easily delete them

Reproducible: Always
Steps to Reproduce:
1. edit a file named ---anything in any text editing tool
2. in terminal, type ls * in that dir
3. :(

Actual Results:  
ls *
ls: unrecognized option `---anything'

Expected Results:  
ls *
---anything 

Gentoo Base System version 1.6.8
Portage 2.0.51-r3 (default-linux/x86/2004.3, gcc-3.3.4, glibc-2.3.4.20040808-r1,
2.6.9 i686)
=================================================================
System uname: 2.6.9 i686 Pentium III (Coppermine)
distcc 2.16 i686-pc-linux-gnu (protocols 1 and 2) (default port 3632) [enabled]
Autoconf: sys-devel/autoconf-2.59-r5
Automake: sys-devel/automake-1.8.5-r1
Binutils: sys-devel/binutils-2.14.90.0.8-r1
Headers:  sys-kernel/linux26-headers-2.6.8.1-r1
Libtools: sys-devel/libtool-1.5.2-r7
ACCEPT_KEYWORDS="x86 ~x86"
AUTOCLEAN="yes"
CFLAGS="-O3 -march=pentium3 -fomit-frame-pointer"
CHOST="i686-pc-linux-gnu"
COMPILER=""
CONFIG_PROTECT="/etc /usr/X11R6/lib/X11/xkb /usr/kde/2/share/config
/usr/kde/3/share/config /usr/lib/mozilla/defaults/pref /usr/share/config
/var/qmail/control"
CONFIG_PROTECT_MASK="/etc/gconf /etc/terminfo /etc/env.d"
CXXFLAGS="-O3 -march=pentium3 -fomit-frame-pointer"
DISTDIR="/usr/portage/distfiles"
FEATURES="autoaddcvs autoconfig ccache distcc distlocks sandbox sfperms"
GENTOO_MIRRORS="http://gentoo.osuosl.org
http://distro.ibiblio.org/pub/Linux/distributions/gentoo"
MAKEOPTS="-j2"
PKGDIR="/usr/portage/packages"
PORTAGE_TMPDIR="/var/tmp"
PORTDIR="/usr/portage"
PORTDIR_OVERLAY=""
SYNC="rsync://rsync.gentoo.org/gentoo-portage"
USE="x86 16bit S3TC X acpi alsa async cups dga gnome gpm gstreamer gtk gtk2
gtkhtml hal howl icq imlib2 insecure-drivers jabber jpeg jpeg2k mime mmx mmx2
mng mono mozsvg mp3 mplayer msn nptl openal pcmcia pcre png quicktime real xrandr"
Comment 1 Sven Wegener gentoo-dev 2004-12-31 18:25:57 UTC
This is normal behaviour. The * is expanded by the shell and the -----gfhgfh is
passed to ls. Everything beginnin with -- is interpreted as an option by ls. But
such an option doesn't exist and it fails. If you have such files you need to
terminate the options with --, like "ls -- *" This makes ls take everything after
the -- as arguments and not as options.