Skip to content

repository credentials should be per-project tunable #1946

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Suwadith opened this issue Dec 13, 2017 · 16 comments
Closed

repository credentials should be per-project tunable #1946

Suwadith opened this issue Dec 13, 2017 · 16 comments
Assignees

Comments

@Suwadith
Copy link

Suwadith commented Dec 13, 2017

Whenever I try to check the revisions of a particular file (Using the History option) It says "Error reading file" (Except for the final Commit/Revision).
I guess it's unable to get those files and because of that I'm unable to use the Annotate option as well. (By unable I mean it literally does nothing.)

This happened with both v1.0 and v1.1-rc17

But when I indexed this repo: https://svn.apache.org/repos/asf/excalibur/trunk/components/datasource/
It worked perfectly fine. Even the Annotate option works.

What can be the cause of this?

Thanks.

@vladak
Copy link
Member

vladak commented Dec 13, 2017

Most likely the svn command that was used to fetch historical versions of the file failed. You'll have to dig into Tomcat logs to see what svn commands were run from the webapp. Again, Tomcat uses logging.properties so it can be tuned to increase the verbosity of the messages.

@Suwadith
Copy link
Author

Suwadith commented Dec 14, 2017

@vladak

I think it has something to do with authentication.

13-Dec-2017 19:29:31.213 WARNING [http-nio-80-exec-7] org.opensolaris.opengrok.util.Executor.exec Non-zero exit status 1 from command [C:\Program Files\TortoiseSVN\bin\svn.exe, cat, -r, 60207, SourceCode\Java\se\xx\xx\xx\xx.java@] in directory E:\Source\Test\xx_xx: svn: E170013: Unable to connect to a repository at URL 'https://subversion.xx.se/PC/Standard/xx_xx/branches/R1.1_xx_xx/SourceCode/Java/se/xx/xx/xx/xx.java' svn: E175013: Access to '/PC/Standard/xx_xx/branches/R1.1_xx_xx/SourceCode/Java/se/xx/xx/xx/xx.java' forbidden

When I tried to access the URL through my browser it asked for my credentials. But I have already set the Environmental variables as you mentioned before.

In the OpenGrok logs it's using them.

2017-12-13 18:58:04.743+0530 FINE t101 Executor.exec: Executing command [C:\Program Files\TortoiseSVN\bin\svn.exe, log, --non-interactive, --username, xxx, --password, xxx, --xml, -v] in directory E:\Source\Test\xx_xx_xx

image

Should I do something else to let Tomcat Access the SVN too?

@Suwadith
Copy link
Author

Suwadith commented Dec 14, 2017

BTW I was able to download Previous revisions of a particular repo using this command

svn checkout https://subversion.xx.se/PC/Standard/xx_xx/branches/R1.1_xx_xx -r 26578

But I didn't use any authentication parameters (E.g --username, --password) with that.

@vladak vladak changed the title Unable to browse through revisions of the same file [Happens with Annotate as well] SVN authentication problem in webapp leads to non functional browsing of historical revisions Dec 14, 2017
@vladak
Copy link
Member

vladak commented Dec 14, 2017

Yeah, the webapp needs to be able to access these environment variables in order to authenticate and fetch the history, otherwise it will just run the svn commands without the username/password options.

@vladak
Copy link
Member

vladak commented Dec 14, 2017

Actually, this could be a dup of #1601.

@vladak
Copy link
Member

vladak commented Dec 14, 2017

Anyhow, the way how the authentication is implemented for SVN repos is wrong. Relying on environment variables makes the setup more complicated (as demonstrated above) and also prevents anyone from using distinct credentials for different SVN repos. They should really be stored as per-project tunable.

@vladak vladak changed the title SVN authentication problem in webapp leads to non functional browsing of historical revisions SVN credentials should be per-project tunable Dec 14, 2017
@vladak
Copy link
Member

vladak commented Dec 14, 2017

Also, it might be possible to store SVN configuration in configuration directory (http://svnbook.red-bean.com/en/1.7/svn.advanced.confarea.html) along with the username/password however #531 might be needed for that.

@vladak
Copy link
Member

vladak commented Dec 14, 2017

As for setting the environment variables in Tomcat, this is usually done via the setenv file (https://tomcat.apache.org/tomcat-7.0-doc/RUNNING.txt mentions setenv.bat for Windows and setenv.sh for Unix).

@vladak
Copy link
Member

vladak commented Dec 14, 2017

Lastly, this should be documented somewhere.

@vladak
Copy link
Member

vladak commented Dec 14, 2017

The basis for per-project configuration was delivered in #1693. This is assuming that all repositories in a project share the same authentication.

@vladak vladak changed the title SVN credentials should be per-project tunable repository credentials should be per-project tunable Dec 14, 2017
@Suwadith
Copy link
Author

Suwadith commented Dec 15, 2017

@vladak How should I declare the user pass combination inside the setenv.bat file

I created the setenv.bat file.
I added the following lines inside it.
set "svn=C:\Program Files\TortoiseSVN\bin\svn.exe --username xxx --password xxx" set "SUBVERSION=C:\Program Files\TortoiseSVN\bin\svn.exe --username xxx --password xxx" exit /b 0
I added it inside the bin folder.
Restarted the tomcat service.
But it doesn't seem to be working.
How should I define them?

@vladak
Copy link
Member

vladak commented Dec 15, 2017

Dunno, my Windows experience is close to 0.

@Suwadith
Copy link
Author

@vladak Ohh ok. I'll keep digging.

@vladak
Copy link
Member

vladak commented Dec 15, 2017

Also, it would not hurt if you got the changes for #1950. Or just wait for the next RC.

@Suwadith
Copy link
Author

Suwadith commented Jan 3, 2018

@vladak For some reason History and Annotate functions are working properly when you use the Zipped version of Tomcat. (By executing startup.bat)
When you install it as a service (Service.bat), that's when the "Error Reading File" Message shows up. Any ideas why this is happening?

@vladak
Copy link
Member

vladak commented Jan 3, 2018

No idea. Pls leave this issue only to track the enhancement. Feel free to create new issues for unrelated questions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants