Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

EOF error when "static" directory is empty #5673

Closed
purrloftruth opened this Issue Feb 3, 2019 · 9 comments

Comments

Projects
None yet
5 participants
@purrloftruth
Copy link

commented Feb 3, 2019

  • hugo version:
    Hugo Static Site Generator v0.54.0/extended darwin/amd64 BuildDate: unknown (installed via Homebrew)
  • Steps to reproduce:
    1. Create a site folder with an empty static directory.
    2. Run hugo.
  • Observed result:
    Output resembling the following:
    Total in 215 ms
    Error: Error copying static files: EOF
    
    The list of total files generated does not display. Files generate and build into the default destination directory as expected.
  • Expected result:
    Output resembling the following:
      
                       | EN
    +------------------+----+
      Pages            | 13
      Paginator pages  |  0
      Non-page files   |  0
      Static files     |  0
      Processed images |  0
      Aliases          |  0
      Sitemaps         |  1
      Cleaned          |  0
    
    Total in 209 ms
    
    This was the behavior previously observed with my test case in 0.53.0, and the behavior observed when the empty "static" directory is deleted or a file is added to it (with the addition of that blank file being notated in the list of generated files).
  • Other observations:
    This also affects hugo server; namely, preventing it from running entirely. In order to get hugo server to run, either the empty "static" directory needs to be deleted or a file needs to be added to it.
@tryzniak

This comment has been minimized.

Copy link
Contributor

commented Feb 3, 2019

Interesting. I can't reproduce it neither on 0.54 nor on HEAD commit of the repo. Can you create a repo with the site that's failing to build?

@moorereason moorereason changed the title 0.14.0: Building (partially) fails with EOF error when "static" directory is empty 0.54.0: Building (partially) fails with EOF error when "static" directory is empty Feb 4, 2019

@purrloftruth

This comment has been minimized.

Copy link
Author

commented Feb 5, 2019

Nothing significant has changed in my environment in the past few days, but I now seem to be unable to replicate this, even though I could make this trigger over and over and over just a few days ago. I'll re-open if I see it again and can provide any more information on what particular circumstances make it happen.

@themartorana

This comment has been minimized.

Copy link

commented Feb 20, 2019

Appears (to me) to be an empty folder inside of static.

Hugo:
Hugo Static Site Generator v0.54.0/extended darwin/amd64 BuildDate: unknown

My layout:

...
▶ resources
▼ static
    ▼ css
        site.css
    ▼ js
▶ themes
...

As soon as I add a file to static/js Hugo renders fine. Without any files, Hugo errors:

❯ hugo
Total in 2 ms
Error: Error copying static files: EOF

Cheers.

@bep bep reopened this Feb 20, 2019

@bep bep added the Bug label Feb 20, 2019

@bep bep added this to the v1.0.0 milestone Feb 20, 2019

@bep

This comment has been minimized.

Copy link
Member

commented Feb 20, 2019

This looks like a bug to me. Readdir in Golang returns io.EOF when a directory is empty, which I suspect is what happens here -- and it shouldn't fail.

@bep bep modified the milestones: v1.0.0, v0.56 Feb 20, 2019

@bep bep changed the title 0.54.0: Building (partially) fails with EOF error when "static" directory is empty EOF error when "static" directory is empty Feb 20, 2019

@tryzniak

This comment has been minimized.

Copy link
Contributor

commented Feb 21, 2019

It's strange, on my machine everything works fine. Here is the output of hugo version:
Hugo Static Site Generator v0.54.0/extended darwin/amd64 BuildDate: unknown
I'm using https://github.com/bep/hugotest as a test hugo site. It builds without any issues, no matter if I add an empty folder or not to static.

@moorereason

This comment has been minimized.

Copy link
Contributor

commented Feb 22, 2019

@themartorana, can you provide a test site that reproduces this issue?

@themartorana

This comment has been minimized.

Copy link

commented Feb 22, 2019

@moorereason done! And I found a couple things along the way required to create the error:

  1. Must be using a theme (and have it set in the config)
  2. Must have an empty folder in /static and it must have a matching empty folder in the theme's ./static directory! (This feels like the important bit.)

image 2019-02-22 at 11 42 11 am

If I renamed the /static/css folder to /static/empty-test the error went away. But if I added a matching folder /themes/empty-dir-theme/static/empty-test the error came back.

Repo here: https://github.com/themartorana/hugo-empty-dir-test-site

@moorereason

This comment has been minimized.

Copy link
Contributor

commented Feb 22, 2019

@themartorana, excellent! 🏆

I'm able to reproduce the issue with your repo after the following:

sh$ mkdir content static themes/empty-dir-theme/static && hugo
Total in 1 ms
Error: Error copying static files: EOF

sh$ hugo env
Hugo Static Site Generator v0.55.0-DEV-908692FA linux/amd64 BuildDate: 2019-02-22T09:49:09-0600
GOOS="linux"
GOARCH="amd64"
GOVERSION="go1.11.5"
@moorereason

This comment has been minimized.

Copy link
Contributor

commented Feb 22, 2019

Filed upstream issue: spf13/afero#197

@bep bep modified the milestones: v0.56, v0.55 Mar 9, 2019

@bep bep closed this in 10bb614 Mar 26, 2019

nguyenvanduocit added a commit to 12bitvn/hugo that referenced this issue Apr 5, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.