Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 25 Apr 2012 22:57:02 +0300
From:      Eugen Konkov <kes-kes@yandex.ru>
To:        Gary Palmer <gpalmer@freebsd.org>
Cc:        freebsd-bugs@FreeBSD.org
Subject:   Re[2]: bin/167288: mv can not copy files with '-' sign as first simbol
Message-ID:  <1961834512.20120425225702@yandex.ru>
In-Reply-To: <201204251830.q3PIUED5005708@freefall.freebsd.org>
References:  <201204251830.q3PIUED5005708@freefall.freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help
Здравствуйте, Gary.

Вы писали 25 апреля 2012 г., 21:30:14:

GP> The following reply was made to PR bin/167288; it has been noted by GNATS.

GP> From: Gary Palmer <gpalmer@freebsd.org>
GP> To: Eugen Konkov <kes-kes@yandex.ru>
GP> Cc: freebsd-gnats-submit@FreeBSD.org
GP> Subject: Re: bin/167288: mv can not copy files with '-' sign as first simbol
GP> Date: Wed, 25 Apr 2012 14:25:45 -0400

GP>  On Wed, Apr 25, 2012 at 10:48:23AM +0000, Eugen Konkov wrote:
 >> 
 >> >Number:         167288
 >> >Category:       bin
 >> >Synopsis:       mv can not copy files with '-' sign as first simbol
 >> >Confidential:   no
 >> >Severity:       non-critical
 >> >Priority:       low
 >> >Responsible:    freebsd-bugs
 >> >State:          open
 >> >Quarter:        
 >> >Keywords:       
 >> >Date-Required:
 >> >Class:          sw-bug
 >> >Submitter-Id:   current-users
 >> >Arrival-Date:   Wed Apr 25 10:50:09 UTC 2012
 >> >Closed-Date:
 >> >Last-Modified:
 >> >Originator:     Eugen Konkov
 >> >Release:        10.0-CURRENT
 >> >Organization:
 >> ISP FreeLine
 >> >Environment:
 >> uname -a
 >> FreeBSD fastvpn.in.freeline.in.ua 10.0-CURRENT FreeBSD 10.0-CURRENT #2: Fri Dec 16 18:38:54 EET 2011     kes@fastvpn.in.freeline.in.ua:/usr/obj/usr/src/sys/KES_KERN_v9  i386
 >> 
 >> >Description:
 >> If I use glob symbol, then special symbols in file names must not be counted as special symbols
 >> >How-To-Repeat:
 >> : > -1.wav
 >> mv * /some/dir
 >> mv: illegal option -- 1
 >> usage: mv [-f | -i | -n] [-v] source target
 >>        mv [-f | -i | -n] [-v] source ... directory
GP>  
GP>  
GP>  Standard command line protocol says that you should use -- to 
GP>  mark the end of command line options in this situation, so that any
GP>  -<something> that comes after is not processed as an option

GP>  
GP>  e.g.
GP>  
GP>  mv -- * /some/dir
GP>  
GP>  Since the glob is done in the shell prior to being passed to mv as 
GP>  arguments, there is no way for 'mv' to know any differently.
GP>  
GP>  Gary

glob work on file names. so when shell expands glob it must expand it
in right way: file names must not became options for programms


Ok, if '--' sign is a special and mark the end of command line options
why:
echo -- hello
echoing '-- hello' instead of 'hello'??

this also does not work:
sox -c 2 -- * -c 1 ./../* -r 8000 result.wav
because '-c' will be counted as 'file name'


and what behaviour will be, if file name has ' '?
For example: Saving all file names in directory to file:
echo * > /some/file
as a result I get 'aa aa bb bb'
Which files are in current directory?
1) 'aa aa', 'bb bb'
2) 'aa' 'bb' 'aa bb'
3) your sugggestion

PS. ugly behaviour to my mind
  or unclean spec/docs maybe


-- 
С уважением,
 Eugen                          mailto:kes-kes@yandex.ru




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?1961834512.20120425225702>