Skip to content
This repository

Fixes filename too long on ecryptfs #84

Merged
merged 1 commit into from 4 months ago

2 participants

Gintaras Sakalauskas Nick Sieger
Gintaras Sakalauskas

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

Gintaras Sakalauskas 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
Gintaras Sakalauskas

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 :)

Nick Sieger nicksieger merged commit 4ea9226 into from December 21, 2013
Nick Sieger nicksieger closed this December 21, 2013
Nick Sieger
Owner

Thanks for the PR!

Gintaras Sakalauskas redross deleted the branch December 21, 2013
Gintaras Sakalauskas

Thanks for accepting it :) :smile:

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

Showing 1 unique commit by 1 author.

Dec 17, 2012
Gintaras Sakalauskas 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
This page is out of date. Refresh to see the latest.
3  lib/ci/reporter/report_manager.rb
@@ -43,7 +43,8 @@ def filename_for(suite)
43 43
         # shorten basename if it exceeds 240 characters
44 44
         # most filesystems have a 255 character limit
45 45
         # so leave some room for the sidesteps
46  
-        basename = basename[0..MAX_FILENAME_SIZE] if basename.length > MAX_FILENAME_SIZE
  46
+        max_filename_size = (ENV['MAX_FILENAME_SIZE'] || MAX_FILENAME_SIZE).to_i
  47
+        basename = basename[0..max_filename_size] if basename.length > max_filename_size
47 48
         
48 49
         # the initial filename, e.g. SPEC-MailsController.xml
49 50
         filename = [basename, suffix].join(".")
14  spec/ci/reporter/report_manager_spec.rb
@@ -50,6 +50,20 @@
50 50
     File.open(filename) {|f| f.read.should == "<xml></xml>"}
51 51
   end
52 52
 
  53
+  it "should shorten extremely long report filenames to custom length" do
  54
+    reporter = CI::Reporter::ReportManager.new("spec")
  55
+    suite = mock("test suite")
  56
+    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"
  57
+    suite.should_receive(:name).and_return(very_long_name)
  58
+    suite.should_receive(:to_xml).and_return("<xml></xml>")
  59
+    ENV['MAX_FILENAME_SIZE'] = '170'
  60
+    reporter.write_report(suite)
  61
+    filename = "#{REPORTS_DIR}/SPEC-#{very_long_name}"[0..170].gsub(/\s/, '-') + ".xml"
  62
+    filename.length.should be_<= 188
  63
+    File.exist?(filename).should be_true
  64
+    File.open(filename) {|f| f.read.should == "<xml></xml>"}
  65
+  end
  66
+
53 67
   it "sidesteps existing files by adding an incrementing number" do
54 68
     filename = "#{REPORTS_DIR}/SPEC-colliding-test-suite-name.xml"
55 69
     FileUtils.mkdir_p(File.dirname(filename))
Commit_comment_tip

Tip: You can add notes to lines in a file. Hover to the left of a line to make a note

Something went wrong with that request. Please try again.