This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 131440 - userid with domain & backslash not allowed
Summary: userid with domain & backslash not allowed
Alias: None
Product: versioncontrol
Classification: Unclassified
Component: Mercurial (show other bugs)
Version: 6.x
Hardware: All Windows XP
: P3 blocker (vote)
Assignee: issues@versioncontrol
Keywords: RELNOTE
Depends on:
Reported: 2008-03-28 18:01 UTC by chazware
Modified: 2009-07-13 13:28 UTC (History)
0 users

See Also:
Issue Type: DEFECT
Exception Reporter:

main_work_76922_d79a7c659c64-clone-windows-domain-hint.patch (2.04 KB, text/plain)
2008-04-02 17:37 UTC, John Rice
trace log from previous comment. (36.33 KB, text/plain)
2008-04-10 17:46 UTC, chazware

Note You need to log in before you can comment on or make changes to this bug.
Description chazware 2008-03-28 18:01:44 UTC
When using "Clone Other", I need to enter a Windows networking userid in the form "DOMAIN\userid:password" but the
backslash is causing the wizard to display the message "Invalid Repository URL".  Command line use of "hg clone" allow
the use of the backslash character.

I tried changing the backslash to %5C, which is the hex value of backslash, and that gets through the URL check and
starts the clone process.  However, the clone never finishes.

Clone appears to create the directories and files but I have to exit out NetBeans and restart it before I can use the
repository to open the project.
Comment 1 chazware 2008-03-28 18:04:46 UTC
Change OS to Windows XP, since that is where I have the problem.  I have not tried this anywhere else, but I expect it
would fail the same way on all Windows versions.
Comment 2 John Rice 2008-04-02 17:21:48 UTC
Replacing the \ with %5C will allow the Wizard to accept this URI. To do the validation we are just creating a URI using
the passed in string, it is this creation that fails with a URISyntaxException. So '\' is not allowed in the URI.

We should release note it as it will catch others I'm sure.
Comment 3 John Rice 2008-04-02 17:37:17 UTC
Created attachment 59568 [details]
Comment 4 John Rice 2008-04-02 17:39:13 UTC
Change URI hint that appears in Wizard when on Windows, to give user some hint as to how to include a DOMAIN in the URI:


Committed to main:

changeset:   77089:4e0135fa441c
tag:         tip
date:        Wed Apr 02 17:35:42 2008 +0100
summary:     #131440: add hint for Clone Wizard for Windows if using DOMAIN\username must use DOMAIN%5Cusername in uri

Comment 5 chazware 2008-04-03 14:53:38 UTC
I am not satisfied with this "fix", which is no fix at all.  Why are you checking the URI with the userid and password
included?  A "real fix" would be to change the dialog to prompt for the URI without the userid and password and prompt
for userid and password separately.  That URI could be checked and any syntax exception it recieves would be a real
exception.  The complete URI is then built by adding the "userid:password@" before passing it off to the "hg clone" command.

BTW, this still leaves the problem of the clone operation never completing or is that a separate issue?  Should I enter
another bug issue for that problem?
Comment 6 John Rice 2008-04-03 15:19:41 UTC
OK - I understand what you are saying, we can strip out the userId:password@ and validate the remaining URI, before
reassembling and sending onto hg.

In subversion the username and password is entered separately on the Wizard and we could certainly do that, but that is
an enhancement request.

Its a separate issue that clone is not completing, please raise another bug for that. Did you try and run this from the
command line to see what happens? Can you provide log output:

Can you add -J-Dorg.netbeans.modules.mercurial.level=100
to netbeans_default_options in your netbeans.conf and send us the output.

Comment 7 chazware 2008-04-10 15:23:42 UTC
The initial bug issue I enterd concerned the use of a backslash in the UTI for cloning a repository.  See issue 131440.
I added the -J-Dorg.netbeans.modules.mercurial.level=100 to netbeans_default_options in your netbeans.conf and send us
the output, as suggested by jrice in issue 131440.

I started up NetBeans and tried to clone a small project. 
I used the work around of %5C for a backslash in the URI during an initial hg clone the command never completes. The
lower right cycling progress bar just keeps on chugging for many minutes even though the repository is small (3 source
files and only an initial commit).

If I check outside of NetBeans the local respository files are created, but NetBeans is left waiting.  If I kill the
Mercurial child process, I can open the project in the same NetBenas sesiion and work with it.

The Mercurial output window contains 2 lines:

======================== begin log output ======================
Mercurial Clone
======================== end log output ======================
Is there someplace else that the trace output would appear?

P.S., This respository is clonable using "hg clone" on a command line.  With the backslah or the %5C in the URI.  The
"hg clone" command completes without a problem.
Comment 8 John Rice 2008-04-10 16:54:58 UTC
Can you attach the generated log file, thanks. Do you have a test repo that I can access to try and do the clone from
our end using the DOMAIN and a test userid?

Mercurial logging:
~/.netbeans/<NB Version>/etc/netbeans.conf
Or in Dev build:

netbeans_default_options="... -J-Dorg.netbeans.modules.mercurial.level=100  ... "

Log output:
~/.netbeans/<NB Version>/var/log/messages.log
Or in Dev build:
Comment 9 chazware 2008-04-10 17:45:41 UTC
Unfortunately I don't have an externally accessible repository you can use to test.

I have made the changes to netbeans.config and attempted the clone. I waited for about 5 minutes for the clone operation
to complete and then exited Netbeans.  

I will attach the messages.log file.  I made a minor modification to the log. I changed all occurrences of my password
to "password" in the log file.  Otherwise, it is unchanged.  
Comment 10 chazware 2008-04-10 17:46:43 UTC
Created attachment 60003 [details]
trace log from previous comment.
Comment 11 chazware 2008-04-15 15:17:28 UTC
Some additional problems I found with backslash in the the userid string.

Whenever Netbeans writes out the hgrc file it changes the backslash characters(s) that existed in the file.  In order
for the command line "hg" commands to work the userid string must contain a single backslash character in the userid
portion of the string.

The problems I found are:

1) When reading the hgrc file with a single backslash, the backslash is removed when the information is displayed in the
Mercurial properties dialog.  If you then fix up the string in the dialog by adding the backslash, 2 backsalsh
characters are written to the file.

2) Again starting with an hgrc file that has a single blackslash character in the userid string, if another value in the
properties dialog is changed, then the blackslash disappears from the userid string (i.e., the string is wrtten as
displayed in the dialog).  

At this point, any push or pull operation now fails authorization.  This is true when the operation is done from
NetBeans or from the command line.
Comment 12 John Rice 2008-05-29 16:46:42 UTC
The correct fix is to patch ini4j so it does not interpret the backslash as an escape sequence.

The code is now consistent in that for the <project>\.hg\hgrc, the %USEPROFILE%\Mercurial.ini and <Install Mercurial
Path>\Mercurial.ini it will escape any \ chars in the files before opening them with ini4j.

The result is that the DOMAIN\userid will be converted to DOMAIN\\userid.

As a workaround in the Push/ Pull and Clone Other HgCommand code we could detect if a DOMAIN has been specified as part
of the path and use the --config option to override the path setting, having replaced the \\ with a single \
Comment 14 chazware 2008-11-19 16:13:00 UTC
I have looked at ini4j and found that it does not meet the needs for this feature.  

The Mercurial plug-in needs to read a Python style configuration file(s).  The problems with using ini2j to read these
files are many.

1) they are not the same as Windows INI files
2) ini4j does not handle special characters in a manner that is compatible with Windows INI files 
3) ini4j does not handle special characters in a manner that is compatible with Python configuration files.

This leads me to the conclusion that using ini4j for the Mercurial plug-in is the WRONG solution and unless something
more appropriate is used this issue will not be solved.

Comment 15 Ondrej Vrabec 2009-04-16 10:21:59 UTC
fixing the ini4j part:
cdev #b20dc2ba0046
ini4j has been patched - a single backslash is now saved and read correctly
Comment 16 Marian Petras 2009-07-13 13:28:17 UTC
The "real fix", as suggested by the reporter on Apr 3 13:53:38 2008 GMT, has been implemented in NetBeans 6.7 as part of
fix of bug #162661 (see for more details).

Marked as FIXED. Feel free to reopen this bug report if you find it is not completely fixed.