プロジェクト

全般

プロフィール

Vote #63654

完了

Show error if SCM executable is not in rails PATH (ENV['PATH'])

Admin Redmine さんが約4年前に追加. 約4年前に更新.

ステータス:
Closed
優先度:
通常
担当者:
-
カテゴリ:
SCM_3
対象バージョン:
開始日:
2008/07/24
期日:
進捗率:

0%

予定工数:
category_id:
3
version_id:
2
issue_org_id:
1682
author_id:
1465
assigned_to_id:
0
comments:
5
status_id:
5
tracker_id:
1
plus1:
0
affected_version:
closed_on:
affected_version_id:
ステータス-->[Closed]

説明

Redmine should log a message if the scm executable cannot be found in the user's path that the redmine app is running under.

For our case, the svn command was not in the user's PATH, but there was no way to figure this out without custom loggers and 2 hours of debugging.

The subversion_adapter.rb tries to shellout the command "svn list..." and "svn info..." for gathering info on the connected repository. After it tries this, IO.popen creates a variable called $? which has info on the pipe it created. Specifically, it has an exitstatus, which tells you if the command was successful, or any error it encountered.

Line 105 of lib/redmine/scm/adapters/subversion_adapter.rb has this:

return nil if $? && $?.exitstatus != 0

The $?.exitstatus for us was coming out to be 127, which is "command not found". No log was being created to warn admins about this though, and everything failed silently. It ignores all the important exitstatus numbers (besides 0) and doesn't report any problems whatsoever.

It should put a log message like:

    logger.info "Your SCM (#{your_scm_command_here}) was not found in the PATH (#{ENV['PATH']})"

Or at least should log:

logger.debug("SCM Process Status: #{$?.inspect}")

which will show the exit code.

Not sure if this should bubble up to the repository setup page on the site, but it would be nice so you don't have to dig through the log just to figure out the error.


journals

Here's a patch for solving the problem. Not tested though. Seems simple enough...

=> lib/redmine/scm/adapters/abstract_adapter.rb

Index: abstract_adapter.rb
===================================================================
--- abstract_adapter.rb (revision 1694)
+++ abstract_adapter.rb (working copy)
@@ -176,6 +176,9 @@
io.close_write
block.call(io) if block_given?
end
+ if $? && $?.exitstatus != 0
+ raise Errno::ENOENT, "Exit status is #{$?.exitstatus}"
+ end
rescue Errno::ENOENT => e
msg = strip_credential(e.message)
# The command failed, log it and re-raise

--------------------------------------------------------------------------------
Does the Issues table not actually show the correct updated_at time? I've updated this thread twice, and it still shows up as being updated on the creation date...
--------------------------------------------------------------------------------
It looks like it's a bug from this instance of redmine: mine (@r1682) has not that issue.
--------------------------------------------------------------------------------
Error message changed in r1757.
Errno::ENOENT should be automatically raised if the binary is not available. Wasn't it the case for you? If not, what's your OS? Please reopen if needed.
--------------------------------------------------------------------------------
Adam Grant wrote:
> Does the Issues table not actually show the correct updated_at time? I've updated this thread twice, and it still shows up as being updated on the creation date...

Fixed in r1758 (but not yet applied here). It was a side effect of Rails 2.1 "Dirty objects" feature.
--------------------------------------------------------------------------------

Admin Redmine さんが約4年前に更新

  • カテゴリSCM_3 にセット
  • 対象バージョン0.8_2 にセット

他の形式にエクスポート: Atom PDF

いいね!0
いいね!0