Skip to content

cant get tar from core utils to work #2567

Done

Description

@kmpm

Description

I am trying to tar files on a windows 11 machine but keep getting errors.
Even with the most minimal tar I keep get errors about Rel: can't make <whatever file> relative to

Create the provided taskfile in an empty directory and call it Taskfile.yml

When I do this in a directory called D:\taskfile-uroot and run task I get...

task: [default] tar -cf test.tar Taskfile.yml
task: Failed to run task "default": Rel: can't make D:\taskfile-uroot\Taskfile.yml relative to

What I expect to get is a file called test.tar containing the taskfile.

Version

3.45.5

Operating system

Windows 11 Pro 24H2

Experiments Enabled

No response

Example Taskfile

# https://taskfile.dev
version: '3'
tasks:
  default:
    cmds:
      - tar -cf test.tar Taskfile.yml

Activity

  1. added
    state: needs triage
    on Dec 12, 2025
  2. added
    dep: charm/tutle
    and removed
    state: needs triage
    on Dec 14, 2025
  3. added theissue type on Dec 14, 2025
  4. trulede commented on Dec 14, 2025

    @trulede
    Contributor

    I was able to list the content of a tar file, but could not create one (same issue).

  5. added
    os: windows
    on Dec 14, 2025
  6. trulede commented on Jan 6, 2026

    @trulede
    Contributor

    This is, I think, a problem with some internal path handling. For example, this:

    - tar -cf test.tar {{.USER_WORKING_DIR}}/Taskfile.yml
    results in this error

    task: Failed to run task "default": GetFileAttributesEx \\wsl.localhost\Ubuntu\home\trule\git\task\ISSUES\2259\wsl.localhostUbuntuhometrulegittask\Taskfile.yml: The system cannot find the path specified.

    And there are several things wrong there ... but at least this part "wsl.localhostUbuntuhometrulegittask" is quite wrong.

  7. trulede commented on Jan 6, 2026

    @trulede
    Contributor

    OK, the problem is here:

    u-root/u-root/pkg/core/tar/tar.go

    // Resolve all input paths relative to working directory
    resolvedArgs := make([]string, len(args))
    for i, arg := range args {
    	resolvedArgs[i] = t.ResolvePath(arg)
    }
    

    this code actually resolves paths to absolute paths, not relative, and tar does not like that. Not sure the exact solution, because ResolvePath is also used to resolve absolute paths.

  8. trulede commented on Jan 6, 2026

    @trulede
    Contributor

    @andreynering the problem here is that tar wants paths which are relative to the working dir (or tar file actually), but the code above makes the paths absolute. Removing the call to ResolvePath() fixes the problem.

    WDYT? I see you worked on that code somewhat recently.

  9. andreynering commented on Jan 6, 2026

    @andreynering
    Member

    @trulede Thank you for taking a look. I can eventually take a look, but probably not soon.

  10. removed
    os: windows
    on Jan 6, 2026
  11. ggrothendieck commented on May 10, 2026

    @ggrothendieck

    One thing to be aware of is that tar.exe is also included and on your PATH with Windows itself. Try where tar:

    C:\Windows\System32\tar.exe
    
  12. kmpm commented on May 10, 2026

    @kmpm
    Author

    @ggrothendieck, yeah I could also use make and makefile but task was supposed to be simpler 😅

  13. trulede commented on May 28, 2026

    @trulede
    Contributor

    @kmpm These days CoPilot can write a Makefile or a Script, and they are pretty good.

    There is a PR now in u-root/u-root#3606 which fixes the problem

    Build command.
    GOOS=windows GOARCH=amd64 go build -o task.exe ./cmd/task

  14. vmaerten commented on Nov 29, 2026

    @vmaerten
    Member

    It'll be fixed in the next release (by #3107)

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    dep: charm/tutle

    Type

    Fields

    No fields configured for bug.

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions