Defect #3743

Mercurial repository path on windows....

Added by Haralampije Justantinovic almost 10 years ago. Updated over 8 years ago.

Status:ClosedStart date:2009-08-15
Priority:NormalDue date:
Assignee:-% Done:

100%

Category:SCM
Target version:-
Resolution: Affected version:

Description

Hi,

I'm running bitNami snstalation for Windows. I managed to succesify run redmine but when I wanted to browse my Mercurial repository I got the following error.

An error occurred when trying to access the repository: No such file or directory - hg -R "D:/iProjects/project/" --cwd "D:/iProjects/project/" locate -r tip

Then I tried to run manualy command line hg -R "D:/iProjects/project/" --cwd "D:/iProjects/project/" locate -r tip and worked fine....

I think there is something strange going on!

Thanks

Mercurial_Problem.png (7.08 KB) Haralampije Justantinovic, 2009-08-22 14:31

Mercurial_Problem2.png (18.2 KB) Haralampije Justantinovic, 2009-08-22 14:38

hg_win.patch Magnifier (791 Bytes) Jason Best, 2010-04-12 21:20


Related issues

Related to Redmine - Defect #6911: Viewing files or diff with mercurial gives an error Closed 2010-11-16
Related to Redmine - Defect #1126: Unable to display Bazaar repository Closed 2008-04-28

History

#1 Updated by Jean-Philippe Lang almost 10 years ago

Make sure that hg.exe is available in the PATH environment variable of Redmine.

#2 Updated by Haralampije Justantinovic almost 10 years ago

Jean-Philippe Lang wrote:

Make sure that hg.exe is available in the PATH environment variable of Redmine.

yep. hg.exe is in the path... when I type hg in any folder... I get hg command menu..

PS.
I think it has something to do with how command string was built and executed.... when I type hg -R "D:/iProjects/project/" --cwd "D:/iProjects/project/" locate -r tip it works welll....

but if you notice in the error message it says An error occurred when trying to access the repository: No such file or directory - hg -R "D:/iProjects/project/" --cwd "D:/iProjects/project/" locate -r tip

maybe there is an extra dash between word directoryy and hg.... I don't know.... Have you tried bitnami distribution?

#3 Updated by Haralampije Justantinovic almost 10 years ago

Also, notice that I'm using bachslash rather than slash... because when I use slash and type

D:\iProjects\project

redmine adds an backslash and my path becomes

becomes D:\iProjects\project/

which is invalid....

So I used backslashs only.... it works in command prompt... but maybe it has problems if you execute that trough ruby?

Hope this helps you to help me :)

#4 Updated by Haralampije Justantinovic almost 10 years ago

I'll take it that there is no solution for this yet....

it's a pitty

#5 Updated by Matt Brown almost 10 years ago

http://www.redmine.org/boards/2/topics/8062

The issue is that the trailing / gets added to the target which is the string that is the repo path before hitting the function in mercurial_adapter.rb

Locate that, modify it and we'll be golden.

To support local/SMB repos on Windows systems, it would make more sense to add this trailing / in the adapters, instead of adding it to the string (the repo path) that's passed into the function in the adapter.

#6 Updated by Matt Brown almost 10 years ago

(wish i could edit my post... eh chem...)

Make that... there should be no addition (trailing characters) to the repo name, but either error handling for the missing trailing \ or / condition or a note added to the repository tab in settings.

#7 Updated by Matt Brown almost 10 years ago

In ..\redmine-0.8.4/lib/redmine/scm/adapters/abstract_adapter.rb

Original

        def target(path)
          path ||= ''
          base = path.match(/^\//) ? root_url : url
          shell_quote("#{base}/#{path}".gsub(/[?<>\*]/, ''))
        end

Here is some editing I've done to remove the trailing /

Patch

        def target(path)
          path ||= ''
          base = path.match(/^\//) ? root_url : url
        if "#{path}".length > 0
        shell_quote("#{base}/#{path}".gsub(/[?<>\*]/, ''))
        else
        shell_quote("#{base}".gsub(/[?<>\*]/, ''))
        end
        end

Oops... guess what... the trailing / doesn't matter.

Verify that the user running ruby.exe has access to the SMB path.

#8 Updated by Haralampije Justantinovic almost 10 years ago

Hi Matt,

I did what you said... but still have the same error...

see attached.

PS.
I'm not rubby guy... I don't understand single line of ruby code..

#9 Updated by Haralampije Justantinovic almost 10 years ago

Is there anyone actualy using Windows + Bitnami + Redmine?

Thanks

#10 Updated by Haralampije Justantinovic almost 10 years ago

Another example of error

#11 Updated by Matt Brown almost 10 years ago

Haral,

What user is running ruby.exe? (if you'd like run tasklist /v on the server where redmine resides and post the output)

Does this user have file-system security access (NTFS folder/file access) to the repo? (if you'd like run cacls d:\iProjects\n????r\.hg\dirstate , obviously replacing the ???? with the proper path, on the server where redmine resides and post the output)

I've never heard of bitnami. Is that a hosted redmine solution?

Thanks,

Matt

#12 Updated by Haralampije Justantinovic almost 10 years ago

Hi Matt,

I will do this in the evening.. I don't have access to my machine at the moment...

http://bitnami.org/ provides redmine installation out of box.... If you could install this on your windows machine... you could be able to reproduce the problem.

Tell me how did it go...

Thanks

#13 Updated by Matt Brown almost 10 years ago

  • % Done changed from 0 to 40

Are your repos on the same Virtual Machine where Redmine "exists" (where ruby.exe is running)?

If not, then you'll have to access the repo over SMB (a shared folder). You have to make sure that the user running ruby.exe has access to the repos. Please note that this can be a security issue if you wish to control access to your repos.

The repos will be accessed under the security context of the user running ruby.exe, so if you give this user access to all of the repos, then anyone who can designate a repository for a project can have access to files in any repository where this user has access.

In this instance, to maintain security, I'd recommend utilizing http/s to serve the repos. I have yet to do this myself, and I will not implement the repo integration until this is completed. Another option would be to have the most senior developer (who is supposed to have access to all the repos) be the "redmine administrator," where no one else can create or "own" a project. Therefore, only this senior developer/redmine administrator can designate repositories for projects.

#14 Updated by Haralampije Justantinovic almost 10 years ago

hi matt, we are using (trying to) native installer for windows platform... Very weird problem isn't it?

Thanks for your reply

#15 Updated by Alex B. almost 10 years ago

  • Status changed from New to Resolved
  • % Done changed from 40 to 100

Haralampije Justantinovic wrote:

hi matt, we are using (trying to) native installer for windows platform... Very weird problem isn't it?

Thanks for your reply

Not really - the following solved my problem (same configuration as yours, same errormessage):
- stop Bitnami Redmine Stack
- go to the apache2 config
- search an directory directive and after </directory> insert the following (replacing your path instead of "D:/reposit"):

<Directory "D:/reposit">
Order Allow,Deny
Allow from All
</Directory>

- start Bitnami Redmine Stack
- put the Path of your repository into Redmine Mercurial Settings (in my case D:/reposit/myprojectrepository)
- voila, should working as supposed (though i doesn't know or mind wether this puts a security hole into)
- don't mind about the last inserted slash, you can - imho - insert forward and backward slashes as you wish - just make sure you

#16 Updated by Alex B. almost 10 years ago

Alex B. wrote:

- don't mind about the last inserted slash, you can - imho - insert forward and backward slashes as you wish - just make sure you

not adding a trailing one.

#17 Updated by Jason Best over 9 years ago

I was having problems with HG_BIN as well on Redmine 0.9.3 on Apache/windows. Attached is a diff for the modification I made. For some reason HG_BIN = "hg.exe" works fine, but HG_BIN = "hg" did not work (hg is on my path, verified all permissions). Here was the error that occurred before I applied my patch:

Errno::ENOEXEC (Exec format error - hg -R "C:\\hg\fastcrossing\fastcrossing-hg/" root):
lib/redmine/scm/adapters/abstract_adapter.rb:191:in `popen'
lib/redmine/scm/adapters/abstract_adapter.rb:191:in `shellout'
lib/redmine/scm/adapters/abstract_adapter.rb:177:in `shellout'
lib/redmine/scm/adapters/mercurial_adapter.rb:67:in `info'
app/models/repository/mercurial.rb:56:in `fetch_changesets'
app/controllers/repositories_controller.rb:70:in `show'

Rendering C:/redmine-0.9.3/public/500.html (500 Internal Server Error)

#18 Updated by Toshi MARUYAMA over 8 years ago

  • Category set to SCM
  • Priority changed from High to Normal

#19 Updated by Toshi MARUYAMA over 8 years ago

  • Status changed from Resolved to Closed

Svn trunk r4795 adds a feature of configurable path of executable for scm adapters (#7517).

Also available in: Atom PDF