Crash with directory in previous file location. #417

Closed
sporkexec opened this Issue Oct 17, 2011 · 0 comments

Comments

Projects
None yet
2 participants

If you have a file, then immediately replace the file with a directory and rebuild, Jekyll crashes:

% touch top && jekyll && rm top && mkdir top && touch top/bottom && jekyll   
Building site: /home/jake/test/jekyll/bin -> /home/jake/test/jekyll/bin/_site
Successfully generated site: /home/jake/test/jekyll/bin -> /home/jake/test/jekyll/bin/_site
Building site: /home/jake/test/jekyll/bin -> /home/jake/test/jekyll/bin/_site
/usr/lib/ruby/1.9.1/fileutils.rb:243:in `mkdir': File exists - /home/jake/test/jekyll/bin/_site/top (Errno::EEXIST)
    from /usr/lib/ruby/1.9.1/fileutils.rb:243:in `fu_mkdir'
    from /usr/lib/ruby/1.9.1/fileutils.rb:217:in `block (2 levels) in mkdir_p'
    from /usr/lib/ruby/1.9.1/fileutils.rb:215:in `reverse_each'
    from /usr/lib/ruby/1.9.1/fileutils.rb:215:in `block in mkdir_p'
    from /usr/lib/ruby/1.9.1/fileutils.rb:201:in `each'
    from /usr/lib/ruby/1.9.1/fileutils.rb:201:in `mkdir_p'
    from /home/jake/test/jekyll/lib/jekyll/static_file.rb:57:in `write'
    from /home/jake/test/jekyll/lib/jekyll/site.rb:249:in `block in write'
    from /home/jake/test/jekyll/lib/jekyll/site.rb:248:in `each'
    from /home/jake/test/jekyll/lib/jekyll/site.rb:248:in `write'
    from /home/jake/test/jekyll/lib/jekyll/site.rb:42:in `process'
    from ./jekyll:250:in `<main>'

Note that doing the opposite (creating a folder then overwriting with a file) behaves as expected:

% mkdir top && touch top/bottom && jekyll && rm -r top && touch top && jekyll
Building site: /home/jake/test/jekyll/bin -> /home/jake/test/jekyll/bin/_site
Successfully generated site: /home/jake/test/jekyll/bin -> /home/jake/test/jekyll/bin/_site
Building site: /home/jake/test/jekyll/bin -> /home/jake/test/jekyll/bin/_site
Successfully generated site: /home/jake/test/jekyll/bin -> /home/jake/test/jekyll/bin/_site

maul-esel added a commit to maul-esel/jekyll that referenced this issue May 11, 2013

Do not exclude a dir from deleting if it exists as file
If a previous build included a file, and a new build includes a
directory with the same name as previously the file, this resul-
ted in the original file not being deleted. When an attempt was
made to create the new directory, it threw an exception.

Fixes #417.

@mattr- mattr- closed this in 96efa9e Jul 1, 2013

mattr- added a commit that referenced this issue Jul 1, 2013

Merge pull request #1118 from maul-esel/dir-bug-take2
[bugfix #417] delete old files that have been replaced by a directory

@jekyllbot jekyllbot locked and limited conversation to collaborators Feb 27, 2017

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