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

Encountering "The system cannot find the path specified" error when using nul as taxonomy on Windows. #12640

Open
razonyang opened this issue Jul 4, 2024 · 4 comments
Labels
Milestone

Comments

@razonyang
Copy link
Contributor

razonyang commented Jul 4, 2024

What version of Hugo are you using (hugo version)?

$ hugo version
hugo v0.128.1-0ff542b4b9cc7b5cb425bbab8bdb5aace81d0c03+extended windows/amd64 BuildDate=2024-07-02T06:46:41Z VendorInfo=gohugoio

Does this issue reproduce with the latest release?

Yes

Reproduce Steps

$ hugo new site hugo-test1

$ cd hugo-test1

Create content/foo.md with the following content.

---
title: Foobar
tags:
  - "Nul"
---

And then build site.

$ hugo
Start building sites …
hugo v0.128.1-0ff542b4b9cc7b5cb425bbab8bdb5aace81d0c03+extended windows/amd64 BuildDate=2024-07-02T06:46:41Z VendorInfo=gohugoio

WARN  found no layout file for "html" for kind "page": You should create a template file which matches Hugo Layouts Lookup Rules for this combination.
WARN  found no layout file for "html" for kind "taxonomy": You should create a template file which matches Hugo Layouts Lookup Rules for this combination.
WARN  found no layout file for "html" for kind "term": You should create a template file which matches Hugo Layouts Lookup Rules for this combination.
WARN  found no layout file for "html" for kind "home": You should create a template file which matches Hugo Layouts Lookup Rules for this combination.
Total in 7 ms
Error: error building site: render: failed to render pages: mkdir E:\Workspaces\hugo-test1\public\tags\nul: The system cannot find the path specified.

I'm awared that the issue isn't related to Hugo directly (golang/go#24556), is it possible to handle it in Hugo layer?
For example, rename the nul folder as other on Windows?

@bep bep added this to the v0.130.0 milestone Jul 22, 2024
@bep bep removed the NeedsTriage label Jul 22, 2024
@gj52
Copy link

gj52 commented Jul 23, 2024

please check this old docs

https://msdn.microsoft.com/en-gb/library/windows/desktop/aa365247(v=vs.85).aspx

reserved files names from MS-DOS ...

@bep bep modified the milestones: v0.130.0, v0.131.0 Jul 30, 2024
@bep bep modified the milestones: v0.131.0, v0.133.0 Aug 9, 2024
@bep bep modified the milestones: v0.133.0, Unscheduled Aug 29, 2024
@jmooring
Copy link
Member

The underlying problem isn't limited to taxonomy terms. For example, hugo new nul/p1.md throws:

Error: process: readAndProcessContent: walk: Readdir: readdir C:\temp\foo\content\nul: Incorrect function.

And you're left with a directory named "nul" that you cannot delete.

@bep
Copy link
Member

bep commented Sep 12, 2024

So, if I'm reading the link from @gj52 ... all of these are invalid filenames on Windows?

  • foo/nul/p1.md
  • foo/NUL/p1.md
  • foo/nul.md
  • foo/NUL.md

And also any combination of CON, PRN, AUX, NUL, COM0, COM1, COM2, COM3, COM4, COM5, COM6, COM7, COM8, COM9, COM, COM, COM, LPT0, LPT1, LPT2, LPT3, LPT4, LPT5, LPT6, LPT7, LPT8, LPT9, LPT, LPT, and LPT.

@jmooring
Copy link
Member

jmooring commented Sep 12, 2024

Of all of the file names listed above, only "nul" (including case variations) causes a problem.

Command Notes
hugo new nul.md File is created without error. Error thrown when building the site because there's a directory named "nul" in the path.
hugo new nul/p1.md Error thrown when creating file because there's a directory named "nul" in the path.

Although you can delete a file named "nul.whatever", you cannot delete a directory named "nul". I had to use WSL then access /mnt/c/something.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants