darcs

Issue 574 weird error when trying to do replace with "-" as a valid token char

Title weird error when trying to do replace with "-" as a valid token char
Priority invalid Status wont-fix
Milestone Resolved in
Superseder Nosy List darcs-devel, dmitry.kurochkin, kowey, thorkilnaur, tommy, zooko
Assigned To
Topics

Created on 2008-01-01.23:58:41 by zooko, last changed 2009-09-02.19:38:45 by kowey.

Messages
msg2304 (view) Author: zooko Date: 2008-01-01.23:58:34
Dear People of Darcs:

Thank you, as always, for your work on this valuable tool!

Please observe the following transcript:

------- begin included transcript
HACO wonwin-mcbrootles-computer:~/playground/allmydata/tahoe/trunk- 
hack$ darcs replace --token- 
chars="[ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz_-]" -- 
root-uri --dir-uri docs/configuration.txt

darcs failed:  unrecognized option `--root-uri'

unrecognized option `--dir-uri'

HACO wonwin-mcbrootles-computer:~/playground/allmydata/tahoe/trunk- 
hack$ darcs replace --token- 
chars="[ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz_-]" \\-\ 
\-root\\-uri \\-\\-dir\\-uri docs/configuration.txt

darcs failed:  Bad token spec:   
[ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz_-]
HACO wonwin-mcbrootles-computer:~/playground/allmydata/tahoe/trunk- 
hack$ darcs replace --token- 
chars="[ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz_-]" XXX  
YYY docs/configuration.txt
HACO wonwin-mcbrootles-computer:~/playground/allmydata/tahoe/trunk-hack$
------- end included transcript

Regards,

Zooko
msg2305 (view) Author: zooko Date: 2008-01-02.00:06:21
On Jan 1, 2008, at 4:58 PM, Zooko wrote:

> HACO wonwin-mcbrootles-computer:~/playground/allmydata/tahoe/trunk- 
> hack$ darcs replace --token- 
> chars="[ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz_-]" \\- 
> \\-root\\-uri \\-\\-dir\\-uri docs/configuration.txt
>
> darcs failed:  Bad token spec:
> [ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz_-]
> HACO wonwin-mcbrootles-computer:~/playground/allmydata/tahoe/trunk- 
> hack$ darcs replace --token- 
> chars="[ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz_-]"  
> XXX YYY docs/configuration.txt
> HACO wonwin-mcbrootles-computer:~/playground/allmydata/tahoe/trunk- 
> hack$

To be more explicit, I find it confusing that a bad token spec is not  
bad when different OLD and NEW arguments are passed, and I am  
doubtful that the problem with the first command-line quoted above is  
actually that there is something wrong with its token spec.

I also tried the following variant:

-------
darcs replace --token- 
chars="[ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz_\-\.]" \ 
\-\\-root\\-uri \\-\\-dir\\-uri docs/configuration.txt

darcs failed:  Bad token spec:   
[ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz_\-\.]
-------

and then this:

-------
HACO wonwin-mcbrootles-computer:~/playground/allmydata/tahoe/trunk- 
hack$ darcs replace --token-chars="[A-Za-z_0-9\-\.\\]" \\-\\-root\\- 
uri \\-\\-dir\\-uri docs/configuration.txt
HACO wonwin-mcbrootles-computer:~/playground/allmydata/tahoe/trunk-hack$
HACO wonwin-mcbrootles-computer:~/playground/allmydata/tahoe/trunk- 
hack$ darcs whatsnew docs/configuration.txt
What's new in "docs/configuration.txt":

{
replace ./docs/configuration.txt [A-Za-z_0-9\-\.\] \-\-root\-uri \-\- 
dir\-uri
}
-------

which shows, I think, that the problem that yields "Bad token spec"  
is that darcs is receiving a backslash in its OLD and NEW arguments  
and, um, getting confused somehow.

Regards,

Zooko
msg4498 (view) Author: kowey Date: 2008-05-02.20:06:01
Resurrecting
msg4532 (view) Author: kowey Date: 2008-05-05.16:08:21
Zooko: we now have some new token-char error messages.  Do they help in any way?
msg8648 (view) Author: kowey Date: 2009-09-02.19:35:44
The following works for me:

rm -rf R
darcs init --repo R
cd R
cat > f << END
--root-uri
END
darcs add f
darcs record f -am 'initial'
darcs replace --token-chars="[A-Za-z_-]" -- '--root-uri' '--dir-uri' f
grep dir f
cd ..

It results in the following pending patch:
replace ./f [ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz_-] --root-uri
--dir-uri

It sounds like it's little more than some shell/getopt confusion (note the use
of -- AND the use of quotes) than anything else.  So I'm marking this as
'invalid' (since it's not actually a bug, feature request or third-party bug)
and wont-fix accordingly.  Please feel free to re-open if you can turn it into
one of the above, and thanks for the bug report! :-)
msg8649 (view) Author: kowey Date: 2009-09-02.19:38:43
Also, in my example above, I meant the following pending: replace ./f [A-Za-z_-]
--root-uri --dir-uri
History
Date User Action Args
2008-01-01 23:58:42zookocreate
2008-01-02 00:06:22zookosetstatus: unread -> unknown
nosy: + darcs-devel
messages: + msg2305
2008-02-16 16:06:10markstossetstatus: unknown -> deferred
nosy: droundy, tommy, beschmi, kowey, darcs-devel, zooko
2008-05-02 20:06:02koweysetstatus: deferred -> unknown
nosy: + dagit, - darcs-devel
messages: + msg4498
2008-05-05 16:08:22koweysetnosy: droundy, tommy, beschmi, kowey, zooko, dagit
messages: + msg4532
2008-05-07 14:30:50koweysetstatus: unknown -> waiting-for
nosy: droundy, tommy, beschmi, kowey, zooko, dagit
assignedto: zooko
2009-08-06 17:42:14adminsetnosy: + markstos, jast, Serware, dmitry.kurochkin, darcs-devel, mornfall, simon, thorkilnaur, - droundy
2009-08-06 20:39:18adminsetnosy: - beschmi
2009-08-10 22:10:13adminsetnosy: - markstos, darcs-devel, jast, Serware, mornfall
2009-08-11 00:04:11adminsetnosy: - dagit
2009-08-25 17:55:42adminsetnosy: + darcs-devel, - simon
2009-08-27 13:58:23adminsetnosy: tommy, kowey, darcs-devel, zooko, thorkilnaur, dmitry.kurochkin
2009-09-02 19:35:47koweysetpriority: bug -> invalid
status: waiting-for -> wont-fix
assignedto: zooko ->
messages: + msg8648
nosy: tommy, kowey, darcs-devel, zooko, thorkilnaur, dmitry.kurochkin
2009-09-02 19:38:45koweysetnosy: tommy, kowey, darcs-devel, zooko, thorkilnaur, dmitry.kurochkin
messages: + msg8649