From nobody@FreeBSD.ORG  Fri Oct 27 15:05:36 2000
Return-Path: <nobody@FreeBSD.ORG>
Received: by hub.freebsd.org (Postfix, from userid 32767)
	id BE88237B479; Fri, 27 Oct 2000 15:05:36 -0700 (PDT)
Message-Id: <20001027220536.BE88237B479@hub.freebsd.org>
Date: Fri, 27 Oct 2000 15:05:36 -0700 (PDT)
From: unixoid@pisem.net
Sender: nobody@FreeBSD.ORG
To: freebsd-gnats-submit@FreeBSD.org
Subject: mkdir 
X-Send-Pr-Version: www-1.0

>Number:         22356
>Category:       misc
>Synopsis:       mkdir
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    freebsd-bugs
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Fri Oct 27 15:10:01 PDT 2000
>Closed-Date:    Sat Oct 28 11:18:44 PDT 2000
>Last-Modified:  Sat Oct 28 11:27:48 PDT 2000
>Originator:     JIaMaK
>Release:        FreeBSD 4.1
>Organization:
home
>Environment:
FreeBSD 4.1
>Description:
Sorry, i very bad speak english. You me that so have understood.
If folder is created with '-' at the beginning of its name then commands used in this folder take its name as parameter.
>How-To-Repeat:
If folder is created with '-' at the beginning of its name then commands used in this folder take its name as parameter.
>Fix:


>Release-Note:
>Audit-Trail:

From: Peter Pentchev <roam@orbitel.bg>
To: unixoid@pisem.net
Cc: freebsd-gnats-submit@FreeBSD.org
Subject: Re: misc/22356: mkdir
Date: Sat, 28 Oct 2000 01:17:54 +0300

 On Fri, Oct 27, 2000 at 03:05:36PM -0700, unixoid@pisem.net wrote:
 > >Number:         22356
 > >Category:       misc
 > >Synopsis:       mkdir
 [snip]
 > >Description:
 > Sorry, i very bad speak english. You me that so have understood.
 > If folder is created with '-' at the beginning of its name then commands used in this folder take its name as parameter.
 > >How-To-Repeat:
 > If folder is created with '-' at the beginning of its name then commands used in this folder take its name as parameter.
 
 Why don't you give some examples?  Like the mkdir command, the commands you
 are trying to execute after that, and such?
 
 But first, a question - are you trying to execute commands *in* that directory,
 or *on* it?  I mean, if you have created a dir named 'test',
 are you doing e.g. 'cd test; ls' or are you trying to do 'ls -test'?
 
 If it is "ls -test" that is bugging you, then have you tried putting '--'
 immediately before the directory name, as in 'ls -- -test'; '--' is
 the traditional (GNU originated, I think) way of separating a command's
 flags from its other parameters, so getopt() and similar functions do not
 try to parse the parameters starting with '-' as options.
 
 G'luck,
 Peter
 
 -- 
 If I had finished this sentence,
 

From: Brooks Davis <brooks@one-eyed-alien.net>
To: unixoid@pisem.net
Cc: freebsd-gnats-submit@FreeBSD.ORG
Subject: Re: misc/22356: mkdir
Date: Fri, 27 Oct 2000 15:22:55 -0700

 On Fri, Oct 27, 2000 at 03:05:36PM -0700, unixoid@pisem.net wrote:
 > If folder is created with '-' at the beginning of its name then
 > commands used in this folder take its name as parameter.
 
 This is not a bug.  UNIX file names can contain dashes and they may
 appear any where in a file name.  Well written programs support the "--"
 arguemnt to signal that any further arguments should not be parsed as
 options.  For example "mkdir -- -blah; rmdir -- -blah" works just fine.
 
 If you find dealing with such files annoying, don't create such files.
 To quote Terry Lambert:
 
 If you aim the gun at your foot and pull the trigger, it's UNIX's job to
 ensure reliable delivery of the bullet to where you aimed the gun (in this
 case, Mr. Foot). -- Terry Lambert, FreeBSD-Hackers mailing list.
 
 -- Brooks
 
 -- 
 Any statement of the form "X is the one, true Y" is FALSE.
 

From: Salvo Bartolotta <bartequi@inwind.it>
To: unixoid@pisem.net
Cc: freebsd-gnats-submit@freebsd.org
Subject: Re: misc/22356: mkdir 
Date: Fri, 27 Oct 2000 23:57:06 GMT

 >>>>>>>>>>>>>>>>>> Original Message <<<<<<<<<<<<<<<<<<
 
 On 10/27/00, 11:05:36 PM, unixoid@pisem.net wrote regarding
 misc/22356: mkdir :
 
 
 > >Number:         22356
 > >Category:       misc
 > >Synopsis:       mkdir
 > >Confidential:   no
 > >Severity:       serious
 > >Priority:       medium
 > >Responsible:    freebsd-bugs
 > >State:          open
 > >Quarter:
 > >Keywords:
 > >Date-Required:
 > >Class:          change-request
 > >Submitter-Id:   current-users
 > >Arrival-Date:   Fri Oct 27 15:10:01 PDT 2000
 > >Closed-Date:
 > >Last-Modified:
 > >Originator:     JIaMaK
 > >Release:        FreeBSD 4.1
 > >Organization:
 > home
 > >Environment:
 > FreeBSD 4.1
 > >Description:
 > Sorry, i very bad speak english. You me that so have understood.
 > If folder is created with '-' at the beginning of its name then
 commands used in this folder take its name as parameter.
 
 
 
 Dear Sir or Madam,
 
 I am afraid I am missing your point.
 
 
 >=3D=3D=3D=3D> mkdir -- -trial   # create the -trial directory
 
 # ls -l lists, inter alia, the -trial directory.
 
 >=3D=3D=3D=3D> cd "-trial"       # let's cd to -trial
 
 >=3D=3D=3D=3D> pwd               # where are we ?
 /usr/home/[...]/-trial
 
 >=3D=3D=3D=3D> touch mywildtrial # let's touch(1) a file
 263 12:36am ~/-trial >=3D=3D=3D=3D> ll # "ls -l" in tcsh shell
 total 0
 -rw-r--r--  1 [...]  0 Oct 28 00:36 mywildtrial
 
 >=3D=3D=3D=3D> vi mywildtrial
 
 /* I write the sentence "The quick brown computer jumped over the
 seven lazy users" (cf vilearn, in the ports collection :-) and then
 save the file. */
 
 >=3D=3D=3D=3D> ll
 
 265 12:37am ~/-trial >=3D=3D=3D=3D> ll
 total 1
 -rw-r--r--  1 [...]  58 Oct 28 00:37 mywildtrial
 
 >=3D=3D=3D=3D> mkdir -- -nestedtrial # A little baroque...
 
 265 12:37am ~/-trial >=3D=3D=3D=3D> ll
 total 2
 drwxr-xr-x  2 [...] 512 Oct 28 00:43 -nestedtrial
 -rw-r--r--  1 [...]  58 Oct 28 00:37 mywildtrial
 
 
 I don't normally create such things; this is just an extemporaneous
 exercise :-)
 
 What commands are you referring to ?
 
 Best regards,
 Salvo
 
 
 
 
State-Changed-From-To: open->closed 
State-Changed-By: mpp 
State-Changed-When: Sat Oct 28 11:18:44 PDT 2000 
State-Changed-Why:  
This is a case of user error. 

When trying to create or manipulate files or directories, you 
need to prevent the utility in question from interpreting the 
file name as an option.  In this case, the following would work: 

mkdir -- -test 
or 
mkdir ./test 
or 
mkdir /full/path/-test 

See the FAQ at www.freebsd.org for more information on common 
questions like this. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=22356 
>Unformatted:
