Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Fixes filename too long on ecryptfs #84

Merged
merged 1 commit into from

2 participants

@redross

Fixes problems with encrypted partitions, the default
assumes the max filename length to be ~255, but this
is not always the case.

@redross redross Fixes filename too long on ecryptfs
Fixes problems with encrypted partitions, the default
assumes the max filename length to be ~255, but this
is not always the case.
937819c
@redross

It seems, that TRAVIS CI is failing for non jruby versions. Could it be related to the fact, that I couldn't get the test suite running (bundle install failed), until I did bundle update? Though I did not commit in any gem updates, so Tracis report seems fishy to me :)

@nicksieger nicksieger merged commit 4ea9226 into ci-reporter:master
@nicksieger
Owner

Thanks for the PR!

@redross redross deleted the redross:bugfix/filename_error_on_ecryptfs branch
@redross

Thanks for accepting it :) :smile:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Dec 17, 2012
  1. @redross

    Fixes filename too long on ecryptfs

    redross authored
    Fixes problems with encrypted partitions, the default
    assumes the max filename length to be ~255, but this
    is not always the case.
This page is out of date. Refresh to see the latest.
View
3  lib/ci/reporter/report_manager.rb
@@ -43,7 +43,8 @@ def filename_for(suite)
# 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
+ max_filename_size = (ENV['MAX_FILENAME_SIZE'] || MAX_FILENAME_SIZE).to_i
+ 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
14 spec/ci/reporter/report_manager_spec.rb
@@ -50,6 +50,20 @@
File.open(filename) {|f| f.read.should == "<xml></xml>"}
end
+ it "should shorten extremely long report filenames to custom length" do
+ reporter = CI::Reporter::ReportManager.new("spec")
+ suite = mock("test suite")
+ very_long_name = "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(:name).and_return(very_long_name)
+ suite.should_receive(:to_xml).and_return("<xml></xml>")
+ ENV['MAX_FILENAME_SIZE'] = '170'
+ reporter.write_report(suite)
+ filename = "#{REPORTS_DIR}/SPEC-#{very_long_name}"[0..170].gsub(/\s/, '-') + ".xml"
+ filename.length.should be_<= 188
+ File.exist?(filename).should be_true
+ File.open(filename) {|f| f.read.should == "<xml></xml>"}
+ end
+
it "sidesteps existing files by adding an incrementing number" do
filename = "#{REPORTS_DIR}/SPEC-colliding-test-suite-name.xml"
FileUtils.mkdir_p(File.dirname(filename))
Something went wrong with that request. Please try again.