This is the mail archive of the cygwin@cygwin.com mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

RE: ls Question + bug?


> From: cygwin-owner at cygwin dot com [mailto:cygwin-owner at cygwin dot 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--

Attachment: ls-strace.txt
Description: Text document

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

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]