Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Fix for Errno::ENAMETOOLONG #37

Merged
merged 1 commit into from

4 participants

@iamruinous

I added code and spec to shorten filenames that will cause Errno::ENAMETOOLONG on filesystems that will only support 255 characters.

There were a couple other reports of this issue, but their solutions were not up to date with the latest version of ci_reporter.

I made the code compatible with the latest sidestep code and included a spec.

@dneighbors

+1 when this occurs it can leave hudson in an unreliable state

@nicksieger
Owner

Thanks for this. I'll try to get this merged soon. Have a couple other priorities at the moment.

@nicksieger nicksieger merged commit dc3c2bb into ci-reporter:master
@nicksieger
Owner

Thanks.

@mstump

Can you put out a release with this fix please. Thanks.

@nicksieger
Owner

Sure, 1.6.6 is out and has this fix.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Jul 19, 2011
  1. added code and spec to shorten filenames that will cause Errno::ENAME…

    Jade Meskill authored Integrum Pairing Station committed
    …TOOLONG
This page is out of date. Refresh to see the latest.
View
8 lib/ci/reporter/report_manager.rb
@@ -33,12 +33,18 @@ def write_report(suite)
# SPEC-MailsController.N.xml
#
# with N < 100000, to prevent endless sidestep loops
- MAX_SIDESTEPS = 100000
+ MAX_SIDESTEPS = 100000
+ MAX_FILENAME_SIZE = 240
#
def filename_for(suite)
basename = "#{@basename}-#{suite.name.gsub(/[^a-zA-Z0-9]+/, '-')}"
suffix = "xml"
+ # shorten basename if it exceeds 240 characters
+ # most filesystems have a 255 character limit
+ # so leave some room for the sidesteps
+ basename = basename[0..MAX_FILENAME_SIZE] if basename.length > MAX_FILENAME_SIZE
+
# the initial filename, e.g. SPEC-MailsController.xml
filename = [basename, suffix].join(".")
View
11 spec/ci/reporter/report_manager_spec.rb
@@ -36,4 +36,15 @@
File.exist?(filename).should be_true
File.open(filename) {|f| f.read.should == "<xml></xml>"}
end
+
+ it "should shorten extremely long report filenames" do
+ reporter = CI::Reporter::ReportManager.new("spec")
+ suite = mock("test suite")
+ suite.should_receive(:name).and_return("some test suite name that goes on and on and on and on and on and on and does not look like it will end any time soon and just when you think it is almost over it just continues to go on and on and on and on and on until it is almost over but wait there is more and then el fin")
+ suite.should_receive(:to_xml).and_return("<xml></xml>")
+ reporter.write_report(suite)
+ filename = "#{REPORTS_DIR}/SPEC-some-test-suite-name-that-goes-on-and-on-and-on-and-on-and-on-and-on-and-does-not-look-like-it-will-end-any-time-soon-and-just-when-you-think-it-is-almost-over-it-just-continues-to-go-on.xml"
+ File.exist?(filename).should be_true
+ File.open(filename) {|f| f.read.should == "<xml></xml>"}
+ end
end
Something went wrong with that request. Please try again.