ls Question + bug?

Hannu E K Nevalainen (garbage mail) garbage_collector@telia.com
Mon Mar 31 22:48:00 GMT 2003


> From: cygwin-owner@cygwin.com [mailto:cygwin-owner@cygwin.com]On Behalf
> Of Demmer, Thomas

> I have
> alias ls=/bin/ls.exe --show-control-chars
>
> in my /etc/profile.
>

According to Bash info-pages: Seems to me that it is better to define a
shell function...

It should be something like:

$ ls () { /bin/ls  --show-control-chars $@; }
$ ls
<some files>
$ echo >åäöÃ
ÄÖ
$ ls
<some files> åäöÃ
ÄÖ


NOTE: Do NOT change "/bin/ls" into just "ls", I believe this creates a
hazardous back/loop reference which will eventually hang the computer.
 A test for loop this is obviously done in the builtin "alias" but not
here(?)

Question to more knowledgable people:
 Can the code for alias be reused/converted for shell functions?


Before realizing the potenial problem I had it hang my machine.

How to do "the hang"... ;-)

Windows 98SE:
Right klick on desktop -> New -> Shortcut ->
Enter this:
C:\WINDOWS\COMMAND.COM /E:30720 /c C:\Program\cygwin\cygwin.bat
Click "Next" and then "Finish"
Now start Bash with the new shortcut and enter the following:

1) $ ls () { ls  --show-control-chars $@; }
2) $ ls
<long delay> consuming memory...
CTRL-C seems to work...
3) $ ls
Really soon -> a dead computer. (Powercycling is all that works after that)

NOTE:
 at 2)
	 strace >ls-strace.txt ls
	 works i.e. doesn't hang.
	 My guess: strace doesn't launch the shell function.
	 Attached ls-strace.txt -> $ ls <an empty dir>
 also at 2)
	close Bash and your memory is free'd.

 Cygwin version: Latest almost everything, updated yesterday or so.

/Hannu E K Nevalainen, Mariefred, Sweden

--END OF MESSAGE--
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: ls-strace.txt
URL: <http://cygwin.com/pipermail/cygwin/attachments/20030331/559d49a8/attachment.txt>
-------------- next part --------------
--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Bug reporting:         http://cygwin.com/bugs.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/


More information about the Cygwin mailing list