v1.4.3 is broken on Windows #1948

Closed
XhmikosR opened this Issue Jan 14, 2014 · 20 comments

Projects

None yet

8 participants

@XhmikosR
Contributor

While with v1.4.2 and the same settings/environment worked fine, with 1.4.3 I get the following

Microsoft Windows [Version 6.1.7601]
Copyright (c) 2009 Microsoft Corporation.  All rights reserved.

C:\Users\xmr\Desktop\mpc-hc.org>ruby -v
ruby 1.9.3p484 (2013-11-22) [i386-mingw32]

C:\Users\xmr\Desktop\mpc-hc.org>jekyll build --trace
Configuration file: C:/Users/xmr/Desktop/mpc-hc.org/_config.yml
            Source: ./source/
       Destination: ./_site/
      Generating... C:/RailsInstaller/Ruby1.9.3/lib/ruby/1.9.1/fileutils.rb:247:
in `mkdir': Invalid argument - C:/Users/xmr/Desktop/mpc-hc.org/_site/C: (Errno::EINVAL)
        from C:/RailsInstaller/Ruby1.9.3/lib/ruby/1.9.1/fileutils.rb:247:in `fu_mkdir'
        from C:/RailsInstaller/Ruby1.9.3/lib/ruby/1.9.1/fileutils.rb:221:in `block (2 levels) in mkdir_p'
        from C:/RailsInstaller/Ruby1.9.3/lib/ruby/1.9.1/fileutils.rb:219:in `reverse_each'
        from C:/RailsInstaller/Ruby1.9.3/lib/ruby/1.9.1/fileutils.rb:219:in `block in mkdir_p'
        from C:/RailsInstaller/Ruby1.9.3/lib/ruby/1.9.1/fileutils.rb:205:in `each'
        from C:/RailsInstaller/Ruby1.9.3/lib/ruby/1.9.1/fileutils.rb:205:in `mkdir_p'
        from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/jekyll-1.4.3/lib/jekyll/convertible.rb:168:in `write'
        from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/jekyll-1.4.3/lib/jekyll/site.rb:259:in `block in write'
        from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/jekyll-1.4.3/lib/jekyll/site.rb:397:in `block (2 levels) in each_site_file'
        from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/jekyll-1.4.3/lib/jekyll/site.rb:396:in `each'
        from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/jekyll-1.4.3/lib/jekyll/site.rb:396:in `block in each_site_file'
        from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/jekyll-1.4.3/lib/jekyll/site.rb:395:in `each'
        from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/jekyll-1.4.3/lib/jekyll/site.rb:395:in `each_site_file'
        from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/jekyll-1.4.3/lib/jekyll/site.rb:259:in `write'
        from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/jekyll-1.4.3/lib/jekyll/site.rb:41:in `process'
        from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/jekyll-1.4.3/lib/jekyll/command.rb:18:in `process_site'
        from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/jekyll-1.4.3/lib/jekyll/commands/build.rb:23:in `build'
        from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/jekyll-1.4.3/lib/jekyll/commands/build.rb:7:in `process'
        from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/jekyll-1.4.3/bin/jekyll:77:in `block (2 levels) in <top (required)>'
        from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/commander-4.1.5/lib/commander/command.rb:180:in `call'
        from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/commander-4.1.5/lib/commander/command.rb:180:in `call'
        from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/commander-4.1.5/lib/commander/command.rb:155:in `run'
        from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/commander-4.1.5/lib/commander/runner.rb:402:in `run_active_command'
        from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/commander-4.1.5/lib/commander/runner.rb:78:in `run!'
        from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/commander-4.1.5/lib/commander/delegates.rb:11:in `run!'
        from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/commander-4.1.5/lib/commander/import.rb:10:in `block in <top (required)>

My _config.yml https://github.com/mpc-hc/mpc-hc.org/blob/jekyll/_config.yml

@parkr
Member
parkr commented Jan 14, 2014

Looks like this line uses / which is a Unix file path convention.

@parkr
Member
parkr commented Jan 14, 2014

v1.4.3 is not necessary unless you're running a host, so I'd suggest downgrading to v1.4.2 for now and we'll fix this for v2.0.0 :)

@XhmikosR
Contributor

Yeah, I already did, but you know, gem install jekyll will get 1.4.3 :P

Thanks for looking into this, I hope a fix will be out soon. It's already hard to set things up on Windows, let's not make it harder for the poor Windows users :)

@XhmikosR XhmikosR referenced this issue in github/pages-gem Jan 14, 2014
Merged

Upgrade to Jekyll v1.4.3. #43

@mattr-
Member
mattr- commented Jan 14, 2014

We just need to make a small change. '/' -> File::SEPARATOR. I'll see if I can't take care of this later tonight.

@parkr
Member
parkr commented Jan 14, 2014

@mattr- Is that enough, or do we have to set it to either / or C:\\?

@mattr-
Member
mattr- commented Jan 14, 2014

Dunno. I'll double check.

@perlauge

As far as I can tell, then the issue is that the destination methods of page.rb and post.rb in the 1.4.3 gem are not the same as those on the master branch on GitHub.

As the implementations of the method seem alike I wonder why it hasn't been pulled up into convertible.rb

@Nukker
Nukker commented Jan 16, 2014

Thank you the bug of solution . let me mark this bug

@tamouse
tamouse commented Jan 16, 2014

You will have to adjust the following line as well, since that's checking if the last character is the path separator. Could do self.url[-1] == File::SEPARATOR instead...

@perlauge

I politely disagree - URLs will use '/' as file separator. And in any case Ruby will convert Windows/DOS file separator '' to '/'
Try out:

C:\>irb
irb(main):001:0> File.expand_path('.')
=> "C:/"
irb(main):002:0>

C:\>
@mikejbrown mikejbrown added a commit to mikejbrown/mikejbrown.github.com that referenced this issue Jan 17, 2014
@mikejbrown mikejbrown Update bundle
Note that jekyll 1.4.3 currently breaks on windows,
but github pages builds ok.

See jekyll/jekyll#1948
6ec6c6f
@parkr parkr referenced this issue Jan 27, 2014
@benbalter @parkr benbalter + parkr sanity check for pages permalink traversal
Signed-off-by: Parker Moore <parkrmoore@gmail.com>
3901c88
@XhmikosR XhmikosR referenced this issue in juthilo/run-jekyll-on-windows Feb 3, 2014
Closed

Jekyll 1.4.3 doesn't work on windows #2

@perlauge
perlauge commented Feb 6, 2014

As mentioned before, then the issue can be fixed (for Windows) by removing the destination methods of page.rband post.rb then add the following to convertible.rb

    def destination(dest)
      # The url needs to be unescaped in order to preserve the correct filename
      path = File.join(dest, CGI.unescape(self.url))
      path = File.join(path, "index.html") if path[/\.html$/].nil?
      path
    end

This is using the "append index.html" if the path doesn't end with a .html extension as seen in https://github.com/jekyll/jekyll/blob/master/lib/jekyll/post.rb#L261 and not as the page version https://github.com/jekyll/jekyll/blob/master/lib/jekyll/page.rb#L137 where the check is to see if the path ends with a /

I tested this by adding a permalink: ../../../../../../somefile line in the content matter - the result is project path/_site/somefile/index.html as wanted to be contained within the project.

@parkr
Member
parkr commented Feb 6, 2014

@perlauge Can you please turn that into a PR? :)

@XhmikosR
Contributor
XhmikosR commented Feb 6, 2014

👍 for the PR :D

@perlauge
perlauge commented Feb 7, 2014

As mentioned earlier #1948 (comment), then the version on master is not the same as the one deployed as a gem.

Example:
diff -b GitHub/jekyll/lib/jekyll/page.rb Ruby193/lib/ruby/gems/1.9.1/gems/jekyll-1.4.3/lib/jekyll/page.rb

11a12
>       url
13,14d13
<       dir
<       name
16d14
<       url
138c136
<       path = File.join(dest, self.url)
---
>       path = File.join(dest, File.expand_path(self.url, "/"))

This makes it really difficult to create a nice change, as I would not be changing the true files.

On top of this I'm wondering why this is the case.

@parkr
Member
parkr commented Feb 8, 2014

@perlauge We still need to merge #1946 into master.

@perlauge
perlauge commented Feb 8, 2014

@parkr I think we have a miscommunication here. I believe that whatever code was in the 1.4.3 gem should be somewhere on the master branch, but for page.rb the latest change was line 138 modified June 15, 2013 - that means this part should have been in 1.4.2 as well.

The code in the unravelled gem of 1.4.3 does not look like the master - which, to me at least, must mean that someone has modified the checked out code and then built a gem. This sort of worries me.

@parkr
Member
parkr commented Feb 8, 2014

We released from the v1-stable branch. It's an official release- nothing to worry about. Master branch doesn't have v1.4.3

@parkr parkr added a commit that referenced this issue Feb 18, 2014
@parkr parkr Sanitize paths uniformly, in a Windows-friendly way.
Fixes kinda a #1948 thing.
Related to #1946.
85ed29d
@parkr parkr added a commit that referenced this issue Feb 18, 2014
@parkr parkr Sanitize paths uniformly, in a Windows-friendly way.
Fixes kinda a #1948 thing.
Related to #1946.
d107ca2
@parkr parkr added a commit that referenced this issue Feb 20, 2014
@parkr parkr Sanitize paths uniformly, in a Windows-friendly way.
Fixes kinda a #1948 thing.
Related to #1946.
0d382c8
@parkr parkr added a commit that referenced this issue Feb 24, 2014
@parkr parkr Sanitize paths uniformly, in a Windows-friendly way.
Fixes kinda a #1948 thing.
Related to #1946.
57d0746
@XhmikosR
Contributor
XhmikosR commented Mar 1, 2014

Any news on this?

@XhmikosR XhmikosR added a commit to twbs/bootstrap that referenced this issue Mar 10, 2014
@XhmikosR XhmikosR Bump Jekyll version used in Travis to v1.4.2.
Note that while v1.4.3 is the latest stable version, it has a nasty Windows bug.
(jekyll/jekyll#1948)
91d0a6d
@parkr parkr closed this in #2109 Mar 11, 2014
@thany
thany commented Mar 12, 2014

worth noting how to install 1.4.2 instead of latest:

gem install jekyll --version "=1.4.2"

@eyecatchup

worth noting how to install 1.4.2 instead of latest:

gem install jekyll --version "=1.4.2"

True. Came accross the same issue today and only found an answer on SO. For completeness, if you've already installed Jekyll 1.4.3, run gem uninstall jekyll first, followed by gem install jekyll --version "=1.4.2".

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