Skip to content

Built-in *cp* sometimes ignores working directory #2836

@elieux

Description

@elieux

Description

Hi.

Since Task gained the built-in Coreutils implementations, I've been encountering a consistent failure with Cp. I'm not entirely convinced it's an issue directly in u-root code (or how I'd even test it) so I'm reporting it here.

The problem seems to be that the check for "target ... is not a directory" is not using the same working directory as the rest. If I do the test below but first create ROOT\subsubdir manually to pass the check, Cp continues and actually copies the files into ROOT\subdir\subsubdir correctly.

> task test
task: [test] pwd
ROOT\subdir
task: [test] rm -rf subsubdir/
task: [test] mkdir subsubdir/
task: [test] touch file1 file2
task: [test] ls
ROOT\subdir\file1
ROOT\subdir\file2
ROOT\subdir\subsubdir
task: [test] cp file1 file2 subsubdir/
task: Failed to run task "test": coreutils: target "subsubdir/" is not a directory

Version

3.50.0

Operating system

Windows

Experiments Enabled

none

Example Taskfile

version: "3"

tasks:
  test:
    dir: subdir
    cmds:
      - pwd
      - rm -rf subsubdir/
      - mkdir subsubdir/
      - touch file1 file2
      - ls
      - cp file1 file2 subsubdir/

Metadata

Metadata

Assignees

No one assigned

    Labels

    dep: u-root/u-rootIssues related to the upstream core utils used by Task.

    Type

    No fields configured for bug.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions