Skip to content

Conversation

@enc
Copy link

@enc enc commented Nov 22, 2020

Uses the absolute path to make sure we can move up.

It's not smart yet, but it works.

so it could fix #289

Also resolves #395 since it was so simple to change.

Uses the absolute path to make sure we can move up.

It's not smart yet, but it works.
@enc
Copy link
Author

enc commented Nov 22, 2020

Ok, this will not work on windows...

I will check this later.

Comment on lines +149 to +150
dirFragments := strings.Split(dir, string(os.PathSeparator))
dir = "/" + strings.Join(dirFragments[1:len(dirFragments)-1], string(os.PathSeparator))
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not using instead:

Suggested change
dirFragments := strings.Split(dir, string(os.PathSeparator))
dir = "/" + strings.Join(dirFragments[1:len(dirFragments)-1], string(os.PathSeparator))
dir, _ := path.Split(dir)

@amoutiers
Copy link

Great feature !
Like git, docker-compose, ...

@mvgijssel
Copy link

Yeah big +1 on this change!

Copy link
Contributor

@ghostsquad ghostsquad left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This behavior can actually be quite dangerous. I would recommend against implementation of this without further discussion of risk. Additionally, this change is not backwards compatible, right now an "error" is produced if you run task from a directory that does not contain a taskfile. As such, this feature should be hidden behind a feature flag in the CLI (with a default enabled: false).

Git CVE-2022-24765 describes the risk actually quite well:

https://github.blog/2022-04-12-git-security-vulnerability-announced/

can be installed got `go get` given that you have a recent version of [Go][go].

```bash
go get -u github.com/go-task/task/cmd/task
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you can no longer install task with go get as of 1.18.

https://tip.golang.org/doc/go1.18#introduction

This document should reflect the use of go install

dir = "/" + strings.Join(dirFragments[1:len(dirFragments)-1], string(os.PathSeparator))

} else {
found = true
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

technically, you don't even need found here, you can just break.

@andreynering
Copy link
Member

Closing in favor of #920

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Why is go get not supported? Search for Taskfiles in parent directories

6 participants