public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
* [ -d ' ' ] && echo yes
@ 2003-02-03 22:03 Norton Allen
  2003-02-03 22:14 ` Elfyn McBratney
  0 siblings, 1 reply; 10+ messages in thread
From: Norton Allen @ 2003-02-03 22:03 UTC (permalink / raw)
  To: cygwin

Inasmuch as such a directory does not exist, this should
not give any output:

  [ -d ' ' ] && echo yes

I suspect this is not a feature of bash, but more deeply
buried, since

  ls -ld ' '

believes ' ' is a directory and

  ls -la ' '

will give you 'total 0' (no . or .. entries).
It also believes any name consisting of all spaces is
a directory.

On the plus side, you can't create a real directory or
file named ' ', because it thinks one already exists.

  -Norton Allen
  

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

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [ -d ' ' ] && echo yes
  2003-02-03 22:03 [ -d ' ' ] && echo yes Norton Allen
@ 2003-02-03 22:14 ` Elfyn McBratney
  2003-02-03 22:19   ` Norton Allen
  0 siblings, 1 reply; 10+ messages in thread
From: Elfyn McBratney @ 2003-02-03 22:14 UTC (permalink / raw)
  To: cygwin, Norton Allen

> Inasmuch as such a directory does not exist, this should
> not give any output:
>
>   [ -d ' ' ] && echo yes
>
> I suspect this is not a feature of bash, but more deeply
> buried, since
>
>   ls -ld ' '
>
> believes ' ' is a directory and

In a way it is. ' ' or '           ' no matter how many spaces is a loopback
to the current directory AFAIK. If you try to cd to ' ' or '    ' you will
see the pwd is /path/directory/you/are/in/.


Regards,

Elfyn McBratney
elfyn@exposure.org.uk
www.exposure.org.uk



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

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [ -d ' ' ] && echo yes
  2003-02-03 22:14 ` Elfyn McBratney
@ 2003-02-03 22:19   ` Norton Allen
  2003-02-03 22:24     ` Elfyn McBratney
  0 siblings, 1 reply; 10+ messages in thread
From: Norton Allen @ 2003-02-03 22:19 UTC (permalink / raw)
  To: Elfyn McBratney; +Cc: cygwin, allen

Elfyn McBratney wrote:
> 
> > Inasmuch as such a directory does not exist, this should
> > not give any output:
> >
> >   [ -d ' ' ] && echo yes
> >
> > I suspect this is not a feature of bash, but more deeply
> > buried, since
> >
> >   ls -ld ' '
> >
> > believes ' ' is a directory and
> 
> In a way it is. ' ' or '           ' no matter how many spaces is a loopback
> to the current directory AFAIK. If you try to cd to ' ' or '    ' you will
> see the pwd is /path/directory/you/are/in/.

Are you saying it's a feature? If so, a feature of cygwin or
of Windows? Under the Windows Command Prompt, cd " " does not
complain, and leaves you in the current directory as you
describe, but dir " " gives an error. This is certainly
not how it works under other OSes.

 -Norton
 

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

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [ -d ' ' ] && echo yes
  2003-02-03 22:19   ` Norton Allen
@ 2003-02-03 22:24     ` Elfyn McBratney
  2003-02-03 22:30       ` Norton Allen
  0 siblings, 1 reply; 10+ messages in thread
From: Elfyn McBratney @ 2003-02-03 22:24 UTC (permalink / raw)
  To: cygwin, Norton Allen

> Are you saying it's a feature? If so, a feature of cygwin or
> of Windows? Under the Windows Command Prompt, cd " " does not
> complain, and leaves you in the current directory as you
> describe, but dir " " gives an error. This is certainly
> not how it works under other OSes.


I'm pretty sure it's a feature of SUSv3... Or one of the other POSIXy
standards.

However I've been working for hours so my brain is fried and may be spewing
out random recollections '-)


Regards,

Elfyn McBratney
elfyn@exposure.org.uk
www.exposure.org.uk



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

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [ -d ' ' ] && echo yes
  2003-02-03 22:24     ` Elfyn McBratney
@ 2003-02-03 22:30       ` Norton Allen
  2003-02-03 22:35         ` Elfyn McBratney
  2003-02-03 22:45         ` Max Bowsher
  0 siblings, 2 replies; 10+ messages in thread
From: Norton Allen @ 2003-02-03 22:30 UTC (permalink / raw)
  To: Elfyn McBratney; +Cc: cygwin, allen

Elfyn McBratney wrote:
> 
> > Are you saying it's a feature? If so, a feature of cygwin or
> > of Windows? Under the Windows Command Prompt, cd " " does not
> > complain, and leaves you in the current directory as you
> > describe, but dir " " gives an error. This is certainly
> > not how it works under other OSes.
> 
> 
> I'm pretty sure it's a feature of SUSv3... Or one of the other POSIXy
> standards.
> 
> However I've been working for hours so my brain is fried and may be spewing
> out random recollections '-)

  FWIW, I've just tested on Linux (of some flavor) and OpenBSD,
  and neither thinks ' ' is a directory.
  
  In any event, I'd like to figure out whether it's a bug or
  a feature under Cygwin so I can move forward.
  
   -Norton
   

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

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [ -d ' ' ] && echo yes
  2003-02-03 22:30       ` Norton Allen
@ 2003-02-03 22:35         ` Elfyn McBratney
  2003-02-03 22:45         ` Max Bowsher
  1 sibling, 0 replies; 10+ messages in thread
From: Elfyn McBratney @ 2003-02-03 22:35 UTC (permalink / raw)
  To: cygwin, Norton Allen

>   FWIW, I've just tested on Linux (of some flavor) and OpenBSD,
>   and neither thinks ' ' is a directory.
>
>   In any event, I'd like to figure out whether it's a bug or
>   a feature under Cygwin so I can move forward.

Sorry, it is my head then :/

It may just be a Cygwin geature, and by looking at the strace output

  293 1191913 [main] ls 2188 fhandler_base::fstat: here
   99 1192012 [main] ls 2188 fstat64: 0 = fstat (1, 0x241FCA8)
  298 1192310 [main] ls 2188 writev: writev (1, 0x241FD78, 1)
  480 1192790 [main] ls 2188 fhandler_base::write: binary write
total 0

It looks as if passing ' ' to ls -al makes it think that ' ' is the current
working directory. Never looked at the fhandler code so I'm probably way out
:::::-)


Regards,

Elfyn McBratney
elfyn@exposure.org.uk
www.exposure.org.uk



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

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [ -d ' ' ] && echo yes
  2003-02-03 22:30       ` Norton Allen
  2003-02-03 22:35         ` Elfyn McBratney
@ 2003-02-03 22:45         ` Max Bowsher
  2003-02-03 22:55           ` wayne
  2003-02-04  2:32           ` Norton Allen
  1 sibling, 2 replies; 10+ messages in thread
From: Max Bowsher @ 2003-02-03 22:45 UTC (permalink / raw)
  To: Norton Allen, Elfyn McBratney; +Cc: cygwin, allen

Norton Allen wrote:
> Elfyn McBratney wrote:
>>
>>> Are you saying it's a feature? If so, a feature of cygwin or
>>> of Windows? Under the Windows Command Prompt, cd " " does not
>>> complain, and leaves you in the current directory as you
>>> describe, but dir " " gives an error. This is certainly
>>> not how it works under other OSes.
>>
>>
>> I'm pretty sure it's a feature of SUSv3... Or one of the other POSIXy
>> standards.
>>
>> However I've been working for hours so my brain is fried and may be
>> spewing out random recollections '-)
>
>   FWIW, I've just tested on Linux (of some flavor) and OpenBSD,
>   and neither thinks ' ' is a directory.
>
>   In any event, I'd like to figure out whether it's a bug or
>   a feature under Cygwin so I can move forward.

It's a bug/feature in Windows. Trying to manipulate such a directory in an
ordinary cmd shell or in explorer produces spurious error messages and/or
silent failiures.

I.e. it falls into the same category as 'aux' and 'foo...' - file names
which Windows simply won't do.

Max.


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

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [ -d ' ' ] && echo yes
  2003-02-03 22:45         ` Max Bowsher
@ 2003-02-03 22:55           ` wayne
  2003-02-03 23:01             ` Max Bowsher
  2003-02-04  2:32           ` Norton Allen
  1 sibling, 1 reply; 10+ messages in thread
From: wayne @ 2003-02-03 22:55 UTC (permalink / raw)
  To: cygwin

Isn't space a valid file or directory name in unix?  Since it
is if the filename " " does not exist you would get an error.

On Mon, Feb 03, 2003 at 10:45:11PM -0000, Max Bowsher wrote:
> Norton Allen wrote:
> > Elfyn McBratney wrote:
> >>
> >>> Are you saying it's a feature? If so, a feature of cygwin or
> >>> of Windows? Under the Windows Command Prompt, cd " " does not
> >>> complain, and leaves you in the current directory as you
> >>> describe, but dir " " gives an error. This is certainly
> >>> not how it works under other OSes.
> >>
> >>
> >> I'm pretty sure it's a feature of SUSv3... Or one of the other POSIXy
> >> standards.
> >>
> >> However I've been working for hours so my brain is fried and may be
> >> spewing out random recollections '-)
> >
> >   FWIW, I've just tested on Linux (of some flavor) and OpenBSD,
> >   and neither thinks ' ' is a directory.
> >
> >   In any event, I'd like to figure out whether it's a bug or
> >   a feature under Cygwin so I can move forward.
> 
> It's a bug/feature in Windows. Trying to manipulate such a directory in an
> ordinary cmd shell or in explorer produces spurious error messages and/or
> silent failiures.
> 
> I.e. it falls into the same category as 'aux' and 'foo...' - file names
> which Windows simply won't do.
> 
> Max.
> 
> 
> --
> 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/

-- 
Slowly and surely the unix crept up on the Nintendo user ...
Wayne Willcox                          I will not eat green eggs and ham
wayne@reliant.immure.com                     I will not eat them Sam I Am!!
A wise person makes his own decisions, a weak one obeys public opinion.
                -- Chinese proverb

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

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [ -d ' ' ] && echo yes
  2003-02-03 22:55           ` wayne
@ 2003-02-03 23:01             ` Max Bowsher
  0 siblings, 0 replies; 10+ messages in thread
From: Max Bowsher @ 2003-02-03 23:01 UTC (permalink / raw)
  To: Wayne Willcox, cygwin

wayne wrote:
> Isn't space a valid file or directory name in unix?  Since it
> is if the filename " " does not exist you would get an error.

Yep, but not a stupid error like this:

C:\Documents and Settings\max>mkdir " "
The system could not find the environment option that was entered.

Huh? What is that supposed to mean? Yet another piece of Redmond idiocy, it
appears.

Max.

> On Mon, Feb 03, 2003 at 10:45:11PM -0000, Max Bowsher wrote:
>> Norton Allen wrote:
>>> Elfyn McBratney wrote:
>>>>
>>>>> Are you saying it's a feature? If so, a feature of cygwin or
>>>>> of Windows? Under the Windows Command Prompt, cd " " does not
>>>>> complain, and leaves you in the current directory as you
>>>>> describe, but dir " " gives an error. This is certainly
>>>>> not how it works under other OSes.
>>>>
>>>>
>>>> I'm pretty sure it's a feature of SUSv3... Or one of the other
>>>> POSIXy standards.
>>>>
>>>> However I've been working for hours so my brain is fried and may be
>>>> spewing out random recollections '-)
>>>
>>>   FWIW, I've just tested on Linux (of some flavor) and OpenBSD,
>>>   and neither thinks ' ' is a directory.
>>>
>>>   In any event, I'd like to figure out whether it's a bug or
>>>   a feature under Cygwin so I can move forward.
>>
>> It's a bug/feature in Windows. Trying to manipulate such a directory
>> in an ordinary cmd shell or in explorer produces spurious error
>> messages and/or silent failiures.
>>
>> I.e. it falls into the same category as 'aux' and 'foo...' - file
>> names which Windows simply won't do.
>>
>> Max.
>>
>>
>> --
>> 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/
>
> --
> Slowly and surely the unix crept up on the Nintendo user ...
> Wayne Willcox                          I will not eat green eggs and
> ham wayne@reliant.immure.com                     I will not eat them
> Sam I Am!! A wise person makes his own decisions, a weak one obeys
> public opinion.
>                 -- Chinese proverb


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

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [ -d ' ' ] && echo yes
  2003-02-03 22:45         ` Max Bowsher
  2003-02-03 22:55           ` wayne
@ 2003-02-04  2:32           ` Norton Allen
  1 sibling, 0 replies; 10+ messages in thread
From: Norton Allen @ 2003-02-04  2:32 UTC (permalink / raw)
  To: Max Bowsher; +Cc: allen, elfyn-cygwin, cygwin

Max Bowsher wrote:
> 
> Norton Allen wrote:
> > Elfyn McBratney wrote:
> >>
> >>> Are you saying it's a feature? If so, a feature of cygwin or
> >>> of Windows? Under the Windows Command Prompt, cd " " does not
> >>> complain, and leaves you in the current directory as you
> >>> describe, but dir " " gives an error. This is certainly
> >>> not how it works under other OSes.
> >>
> >>
> >> I'm pretty sure it's a feature of SUSv3... Or one of the other POSIXy
> >> standards.
> >>
> >> However I've been working for hours so my brain is fried and may be
> >> spewing out random recollections '-)
> >
> >   FWIW, I've just tested on Linux (of some flavor) and OpenBSD,
> >   and neither thinks ' ' is a directory.
> >
> >   In any event, I'd like to figure out whether it's a bug or
> >   a feature under Cygwin so I can move forward.
> 
> It's a bug/feature in Windows. Trying to manipulate such a directory in an
> ordinary cmd shell or in explorer produces spurious error messages and/or
> silent failiures.
> 
> I.e. it falls into the same category as 'aux' and 'foo...' - file names
> which Windows simply won't do.

OK, thanks for the info. I was familiar with the oddities of aux, et. al,
but had not encountered the space thingy. -Norton


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

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2003-02-04  2:32 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-02-03 22:03 [ -d ' ' ] && echo yes Norton Allen
2003-02-03 22:14 ` Elfyn McBratney
2003-02-03 22:19   ` Norton Allen
2003-02-03 22:24     ` Elfyn McBratney
2003-02-03 22:30       ` Norton Allen
2003-02-03 22:35         ` Elfyn McBratney
2003-02-03 22:45         ` Max Bowsher
2003-02-03 22:55           ` wayne
2003-02-03 23:01             ` Max Bowsher
2003-02-04  2:32           ` Norton Allen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).