Project

General

Profile

Actions

Defect #3743

closed

Mercurial repository path on windows....

Added by Haralampije Justantinovic over 15 years ago. Updated almost 14 years ago.

Status:
Closed
Priority:
Normal
Assignee:
-
Category:
SCM
Target version:
-
Start date:
2009-08-15
Due date:
% Done:

100%

Estimated time:
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


Files

Mercurial_Problem.png (7.08 KB) Mercurial_Problem.png Haralampije Justantinovic, 2009-08-22 14:31
Mercurial_Problem2.png (18.2 KB) Mercurial_Problem2.png Haralampije Justantinovic, 2009-08-22 14:38
hg_win.patch (791 Bytes) hg_win.patch Jason Best, 2010-04-12 21:20

Related issues

Related to Redmine - Defect #6911: Viewing files or diff with mercurial gives an errorClosed2010-11-16

Actions
Related to Redmine - Defect #1126: Unable to display Bazaar repositoryClosed2008-04-28

Actions
Actions #1

Updated by Jean-Philippe Lang over 15 years ago

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

Actions #2

Updated by Haralampije Justantinovic over 15 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?

Actions #3

Updated by Haralampije Justantinovic over 15 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 :)

Actions #4

Updated by Haralampije Justantinovic over 15 years ago

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

it's a pitty

Actions #5

Updated by Matt Brown over 15 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.

Actions #6

Updated by Matt Brown over 15 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.

Actions #7

Updated by Matt Brown over 15 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.

Actions #8

Updated by Haralampije Justantinovic over 15 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..

Actions #9

Updated by Haralampije Justantinovic over 15 years ago

Is there anyone actualy using Windows + Bitnami + Redmine?

Thanks

Actions #10

Updated by Haralampije Justantinovic over 15 years ago

Another example of error

Actions #11

Updated by Matt Brown about 15 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

Actions #12

Updated by Haralampije Justantinovic about 15 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

Actions #13

Updated by Matt Brown about 15 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.

Actions #14

Updated by Haralampije Justantinovic about 15 years ago

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

Thanks for your reply

Actions #15

Updated by Alex B. about 15 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

Actions #16

Updated by Alex B. about 15 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.

Actions #17

Updated by Jason Best over 14 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)

Actions #18

Updated by Toshi MARUYAMA almost 14 years ago

  • Category set to SCM
  • Priority changed from High to Normal
Actions #19

Updated by Toshi MARUYAMA almost 14 years ago

  • Status changed from Resolved to Closed

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

Actions

Also available in: Atom PDF